On Sat, May 26, 2007 at 03:25:35PM -0700, Rui Maciel wrote: > I've just started looking into gnu indent and I'm having some trouble > making it format the source code using tabs. In the man pages it is > said that the -ut and -ts options could handle that but no matter how > I run indent, the source code still appears exactly like if it was run > with indent --no-tabs.
The -ut and -ts options only specify the use of tabs in general. They don't affect indentation. I haven't used indent in a while, but after playing with it for a bit, this seems like a good set of options for you: indent -i8 -bli0 -npsl -npcs foo.c The -i8 option says to indent 8 spaces, and these will be turned into tabs by default. The -bli0 option tells it not to indent curly braces (which are, by default, indented 2 spaces in accordance with GNU conventions). The -npsl option says not to add a line break after function return types, and -npcs indicates no space between function names and argument lists (although your own example is inconsistent in that respect, so you may not like that option). > int test(int param) > { > if (param == 1)) > { > printf ("error\n"); > return EXIT_SUCCESS; > } > return EXIT_SUCCESS; > } Here's the result, minus an unmatched parenthesis that slipped into your example: $ indent -i8 -bli0 -npsl -npcs foo.c ; cat foo.c int test(int param) { if (param == 1) { printf("error\n"); return EXIT_SUCCESS; } return EXIT_SUCCESS; } There are a lot more options to fine tune results, all listed in the man page. Hope that helps.