Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 May 2002 14:56:55 +0100 (BST)
From:      jason+freebsd@kanda.com
To:        shubhamr <shubhamr@malkauns.nsc.com>
Cc:        "questions@FreeBSD.ORG" <questions@freebsd.org>
Subject:   Re: coments in freebsd
Message-ID:  <20020507145015.R67080-100000@uk2.kanda-systems.net>
In-Reply-To: <3CD7C423.3CAD457D@malkauns.nsc.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On Tue, 7 May 2002, shubhamr wrote:

> I have numerous files .c files not written acording to the ANSI c
> style.They have comented using // instead of regular /*
> */.convention.How do I compile them?

Hi,

I take it that you are wanting to use these files with a compiler that
doesn't support // syntax.  Check with the compiler documentation first,
sometimes they have a switch to enable c++ style comments.

Alternatively you could use the sed command (available within FreeBSD) to
convert all the // comments into /* comments.

To convert a file:

  cat cfile.c sed "s/\(.*\)\/\/\(.*\)/\1 \/*\2 \*\//" > cfile.c.fixed

Then:

  mv cfile.c.filed cfile.c

I suggest you make backups of your c files before beginning this
operation.

If you have more than a few c files you'll probably want to script this
operation.

Regards

Jason

====================================================================
Jason Taylor.          Kanda Systems Ltd.     Tel: +44/0 1970 621030
Systems Manager.       Unit 17 Glanyrafon     Fax: +44/0 1970 621040
jason@kanda.com.       Enterprise Park.    Mobile: +44/0 7976 926918
http://www.kanda.com.  Ceredigion, UK          http://shop.kanda.com
====================================================================



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020507145015.R67080-100000>