[comp.lang.c] Program for Formatting C Source

jjr@ut-ngp.UUCP (Jeff Rodriguez) (07/20/87)

Does anyone have a program that formats C source to make it
look "pretty" (i.e., proper indentation is added)?

				Jeff Rodriguez
				jjr@ngp.utexas.edu

kimcm@olamb.UUCP (Kim Chr. Madsen) (07/21/87)

In article <5648@ut-ngp.UUCP>, jjr@ut-ngp.UUCP (Jeff Rodriguez) writes:
> Does anyone have a program that formats C source to make it
> look "pretty" (i.e., proper indentation is added)?

If you're running UNIX try looking up the cb(1) in the manual!

					Kim Chr. Madsen.

chris@mimsy.UUCP (Chris Torek) (07/22/87)

There are two widely available (to Unix users, at any rate) programs
for `beautifying' C code, to wit, `cb', a standard utility on most
Unix systems, and `indent', distributed with 4.2 and 4.3 BSD.  The
4.3BSD version is considerably better.

Indent was written at the University of Illinois, and is copyright
by their Board of Trustees.  It was subsequently hacked substantially
by James Gosling and (I think) Bill Shannon.  I believe that it
may be redistributed freely, at least as long as one retains the
University of Illinois copyright notices, but I advise anyone
contemplating such to check first.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690)
Domain:	chris@mimsy.umd.edu	Path:	seismo!mimsy!chris

kimcm@olamb.UUCP (Kim Chr. Madsen) (07/23/87)

In article <7641@mimsy.UUCP>, chris@mimsy.UUCP (Chris Torek) writes:
> There are two widely available (to Unix users, at any rate) programs
> for `beautifying' C code, to wit, `cb', a standard utility on most
> Unix systems, and `indent', distributed with 4.2 and 4.3 BSD.  The
> 4.3BSD version is considerably better.

Just to say that it's also on SYSV, though the version of cb looks pretty
much like one derived directly from V7. I think it's a standard SYSV tool,
but I don't have my SVID at hand...


						Kim Chr. Madsen.

swh@hpsmtc1.HP.COM (Steve Harrold) (07/23/87)

There are a number of "pretty printers" and "beautifiers" for C in the PC
world.  For example,

From Polytron (the makers of PolyMake) there is a product called, strangely
enough, "C Beautifier".  It offers far more flexibility than the unis cb(1).

Also, checkout Aldebaran Laboratories product called SourcePrint.  It has
less flexibility in re-formatting, but it sure puts out nice PRINT listings.
For example, it will draw lines on the output connecting the open and
close braces (as well as doing the indenting).

gordon@cae780.TEK.COM (Brian Gordon) (07/24/87)

In article <303@olamb.UUCP> kimcm@olamb.UUCP (Kim Chr. Madsen) writes:
>In article <5648@ut-ngp.UUCP>, jjr@ut-ngp.UUCP (Jeff Rodriguez) writes:
>> Does anyone have a program that formats C source to make it
>> look "pretty" (i.e., proper indentation is added)?
>
>If you're running UNIX try looking up the cb(1) in the manual!

(My mailed response to the Jeff bounced)

For lots of flexibility, try 'indent' if it is on your system (e.g. 4.3bsd).
You might spend some time choosing options -- it has 2.308E27 of them -- but
you can probably come up with something you are willing to live with.

FROM:   Brian G. Gordon, CAE Systems Division of Tektronix, Inc.
UUCP:   tektronix!cae780!gordon [or gordon@cae780.CAE.TEK.COM]

dparter@ccvaxa.UUCP (07/27/87)

> There are two widely available (to Unix users, at any rate) programs
> for `beautifying' C code, to wit, `cb', a standard utility on most
> Unix systems, and `indent', distributed with 4.2 and 4.3 BSD.  The
> 4.3BSD version is considerably better.

Does anyone have src to the troff macros that indent uses when 
invoked with the -troff option? I can't seem to find them on our 
4.3 system.

thanks,

	--david

---------
David W. Parter
gould/csd - urbana
uucp:	ihnp4!uiucdcs!ccvaxa!dparter
arpa:	dparter@gswd-vms.arpa   or   dparter@gswd-vms.gould.com

feg@clyde.ATT.COM (Forrest Gehrke) (07/30/87)

In article <4304@cae780.TEK.COM>, gordon@cae780.TEK.COM (Brian Gordon) writes:
> In article <303@olamb.UUCP> kimcm@olamb.UUCP (Kim Chr. Madsen) writes:
> >In article <5648@ut-ngp.UUCP>, jjr@ut-ngp.UUCP (Jeff Rodriguez) writes:
> >> Does anyone have a program that formats C source to make it
> >> look "pretty" (i.e., proper indentation is added)?
> >
> >If you're running UNIX try looking up the cb(1) in the manual!

        Is there anything around which will do the same thing (or similar
        to it) which will run under ms-dos?

        Forrest Gehrke