indent is a Unix utility that reformats C and C++ code in a user-defined indent style and coding style. Support for C++ code is considered experimental.
It can fix and unify the formating in C file.
indent -o foo.c -gnu -bli0 -hnl -nut -i4 -l130 foo.c
Another better way to use is perhaps this
indent -o %2 -gnu -bli0 -hnl -nut -i4 -l110 -bls -ncs -npcs -nprs -nsaf
-nsob -lp -cli4 -cbi0 %1
%1 - input file name
%2 - output file name
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()
{ ...
No comments:
Post a Comment