Difference between revisions of "GNU Indent"
Lone Rifle (talk | contribs) m (Categorize) |
|||
Line 41: | Line 41: | ||
If you investigate this firther - please add possible solution/options below. | If you investigate this firther - please add possible solution/options below. | ||
+ | |||
+ | [[Category:Development]] |
Revision as of 09:08, 18 November 2009
GNU Indent is a tool from the GNU Project. It can fix and unify the formating in C file. You can get a Windows Version from here. And a online version of the man page can be found here.
Here the best option I found so far
indent -o foo.c -gnu -bli0 -hnl -nut -i4 -l130 foo.c
If you got a better/different version please write it down here.
Aleksey
I took time to further research the indenting options and came up with the following (%1 - input file name, %2 - output file name):
indent -o %2 -gnu -bli0 -hnl -nut -i4 -l110 -bls -ncs -npcs -nprs -nsaf -nsob -lp -cli4 -cbi0 %1
This indenting works almost perfectly, however it still has a few problems:
1)
do { something; } while();
While should be on the same line as the "}". (hint: experiment with do-while cuddling option, maybe it's the right thing)
2) Labels indenting by 2 spaces, so it looks like this:
a = b + 3; ... MY_LABEL: free(something); return;
3) Function declarations look a bit wrong:
NTSTATUS NTSYSAPI NtMakeSystemStable() { ...
If you investigate this firther - please add possible solution/options below.