CB(1) Silicon Graphics CB(1)
cb - C program beautifier
cb [ -s ] [ -j ] [ -n ] [ -l leng ] [ -t shiftwidth ] [ file ... ]
The cb command reads C programs either from its arguments or from the
standard input, and writes them on the standard output with spacing and
indentation that display the structure of the code. Under default
options, cb preserves all user new-lines.
cb accepts the following options.
-s Canonicalizes the code to the style of Kernighan and Ritchie
in The C Programming Language.
-j Causes split lines to be put back together.
-n Causes pairs of left braces with only whitespace between them
to be interpreted as code braces. By default, such pairs of
braces are assumed to be structure initializations and less
indentation is done; this causes code-brace pairs to produce
odd output. An example will clarify this.
File t.c:
int x; main() { { { x = 3; } } }
cb t.c produces
int x;
main() {
{ {
x = 3;
}
}
}
Note the right braces prematurely at the left margin. On the
other hand, cb -n t.c produces
int x;
main() {
{
{
x = 3;
}
}
}
Page 1 Release 6.4
CB(1) Silicon Graphics CB(1)
-l leng Causes cb to split lines that are longer than leng.
-t shiftwidth
tells cb to use a soft tab stop which is different from the
hard tabs. Tab characters will be used to save space where
possible.
cc(1).
Kernighan, B. W., and Ritchie, D. M., The C Programming Language.
Prentice-Hall, 1978.
Punctuation that is hidden in preprocessor statements will cause indentation
errors.
Page 2 Release 6.4 [ Back ]
|