Re: [off-topic] formatting C-code

From: Ebon Mists (mud@quake.cloudnet.com)
Date: 10/11/96


> 
> Do anyone know any filter/prog that will format C-code ?
> 
> At my old school we had cb and some other prog to do it but I can't find
> anything at the big linux ftp sites..
> 
> /Berzerk @ vincent.ludd.luth.se 4000

If you mean just cosmetic format, like turning  this:
if(x == 1){
printf("ok");
for(c = 0; c; c++)
printf("ok");
}

into this:
if(x == 1) {
  printf("ok");
  for(c = 0; c; c++)
    printf("ok");
}

That's the indent command. It takes a lot of funky paramaters. Read the man
pages on indent, but here are the paramaters I use and my files all look
pretty nicew:

indent -br -npcs -npsl -ce -cli2 -nsob <filename to indent>

I'd suggest making an alias for it so you only have to type in 'ind' or
something similar.

Hades
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/18/00 PST