One issue in the formatting of code is how far each line should be
indented from the left margin. When the beginning of a statement such
as if
or for
is encountered, the indentation level is
increased by the value specified by the `-i' option. For example,
use `-i8' to specify an eight character indentation for each
level. When a statement is broken across two lines, the second line is
indented by a number of additional spaces specified by the `-ci'
option. `-ci' defaults to 0. However, if the `-lp' option is
specified, and a line has a left parenthesis which is not closed on that
line, then continuation lines will be lined up to start at the character
position just after the left parenthesis. This processing also applies
to `[' and applies to `{' when it occurs in initialization
lists. For example, a piece of continued code might look like this with
`-nlp -ci3' in effect:
p1 = first_procedure (second_procedure (p2, p3), third_procedure (p4, p5));
With `-lp' in effect the code looks somewhat clearer:
p1 = first_procedure (second_procedure (p2, p3), third_procedure (p4, p5));
indent
assumes that tabs are placed at regular intervals of both
input and output character streams. These intervals are by default 8
columns wide, but (as of version 1.2) may be changed by the `-ts'
option. Tabs are treated as the equivalent number of spaces.
The indentation of type declarations in old-style function definitions is controlled by the `-ip' parameter. This is a numeric parameter specifying how many spaces to indent type declarations. For example, the default `-ip5' makes definitions look like this:
char * create_world (x, y, scale) int x; int y; float scale; { . . . }
For compatibility with other versions of indent, the option `-nip' is provided, which is equivalent to `-ip0'.
ASCII C allows white space to be placed on preprocessor command lines
between the character `#' and the command name. By default,
indent
removes this space, but specifying the `-lps' option
directs indent
to leave this space unmodified.
Go to the first, previous, next, last section, table of contents.