version 1.6, 1999/06/05 01:21:27 |
version 1.7, 1999/07/04 11:53:55 |
|
|
.Op Fl troff |
.Op Fl troff |
.Op Fl v | Fl \&nv |
.Op Fl v | Fl \&nv |
.Sh DESCRIPTION |
.Sh DESCRIPTION |
.Nm indent |
.Nm |
is a |
is a |
.Ar C |
.Ar C |
program formatter. It reformats the |
program formatter. It reformats the |
|
|
If |
If |
.Ar output-file |
.Ar output-file |
is specified, |
is specified, |
.Nm indent |
.Nm |
checks to make sure it is different from |
checks to make sure it is different from |
.Ar input-file . |
.Ar input-file . |
.Pp |
.Pp |
The options listed below control the formatting style imposed by |
The options listed below control the formatting style imposed by |
.Nm indent . |
.Nm indent . |
|
|
.Fl nsob . |
.Fl nsob . |
.It Fl \&st |
.It Fl \&st |
Causes |
Causes |
.Nm indent |
.Nm |
to take its input from stdin, and put its output to stdout. |
to take its input from stdin, and put its output to stdout. |
.It Fl T Ns Ar typename |
.It Fl T Ns Ar typename |
Adds |
Adds |
|
|
.Ic typedef |
.Ic typedef |
causes a syntactic change in the |
causes a syntactic change in the |
language and |
language and |
.Nm indent |
.Nm |
can't find all |
can't find all |
instances of |
instances of |
.Ic typedef . |
.Ic typedef . |
.It Fl troff |
.It Fl troff |
Causes |
Causes |
.Nm indent |
.Nm |
to format the program for processing by |
to format the program for processing by |
.Xr troff 1 . |
.Xr troff 1 . |
It will produce a fancy |
It will produce a fancy |
|
|
turns on `verbose' mode; |
turns on `verbose' mode; |
.Fl \&nv |
.Fl \&nv |
turns it off. When in verbose mode, |
turns it off. When in verbose mode, |
.Nm indent |
.Nm |
reports when it splits one line of input into two or more lines of output, |
reports when it splits one line of input into two or more lines of output, |
and gives some size statistics at completion. The default is |
and gives some size statistics at completion. The default is |
.Fl \&nv . |
.Fl \&nv . |
.El |
.El |
.Pp |
.Pp |
You may set up your own `profile' of defaults to |
You may set up your own `profile' of defaults to |
.Nm indent |
.Nm |
by creating a file called |
by creating a file called |
.Pa .indent.pro |
.Pa .indent.pro |
in your login directory and/or the current directory and including |
in your login directory and/or the current directory and including |
whatever switches you like. A `.indent.pro' in the current directory takes |
whatever switches you like. A `.indent.pro' in the current directory takes |
precedence over the one in your login directory. If |
precedence over the one in your login directory. If |
.Nm indent |
.Nm |
is run and a profile file exists, then it is read to set up the program's |
is run and a profile file exists, then it is read to set up the program's |
defaults. Switches on the command line, though, always override profile |
defaults. Switches on the command line, though, always override profile |
switches. The switches should be separated by spaces, tabs or newlines. |
switches. The switches should be separated by spaces, tabs or newlines. |
|
|
.Ss Comments |
.Ss Comments |
.Sq Em Box |
.Sq Em Box |
.Em comments . |
.Em comments . |
.Nm indent |
.Nm |
assumes that any comment with a dash, star, or newline immediately after |
assumes that any comment with a dash, star, or newline immediately after |
the start of comment (that is, `/*\-', `/**' or `/*' followed |
the start of comment (that is, `/*\-', `/**' or `/*' followed |
immediately by a newline character) is a comment surrounded |
immediately by a newline character) is a comment surrounded |
|
|
.Pp |
.Pp |
.Em Straight text . |
.Em Straight text . |
All other comments are treated as straight text. |
All other comments are treated as straight text. |
.Nm indent |
.Nm |
fits as many words (separated by blanks, tabs, or newlines) on a |
fits as many words (separated by blanks, tabs, or newlines) on a |
line as possible. Blank lines break paragraphs. |
line as possible. Blank lines break paragraphs. |
.Pp |
.Pp |
|
|
.Pp |
.Pp |
.Ss Preprocessor lines |
.Ss Preprocessor lines |
In general, |
In general, |
.Nm indent |
.Nm |
leaves preprocessor lines alone. The only |
leaves preprocessor lines alone. The only |
reformatting that it will do is to straighten up trailing comments. It |
reformatting that it will do is to straighten up trailing comments. It |
leaves embedded comments alone. Conditional compilation |
leaves embedded comments alone. Conditional compilation |
.Pq Ic #ifdef...#endif |
.Pq Ic #ifdef...#endif |
is recognized and |
is recognized and |
.Nm indent |
.Nm |
attempts to correctly |
attempts to correctly |
compensate for the syntactic peculiarities introduced. |
compensate for the syntactic peculiarities introduced. |
.Pp |
.Pp |
.Ss C syntax |
.Ss C syntax |
.Nm indent |
.Nm |
understands a substantial amount about the syntax of C, but it |
understands a substantial amount about the syntax of C, but it |
has a `forgiving' parser. It attempts to cope with the usual sorts of |
has a `forgiving' parser. It attempts to cope with the usual sorts of |
incomplete and misformed syntax. In particular, the use of macros like: |
incomplete and misformed syntax. In particular, the use of macros like: |
|
|
.Pp |
.Pp |
is handled properly. |
is handled properly. |
.Sh ENVIRONMENT |
.Sh ENVIRONMENT |
.Nm indent |
.Nm |
uses the |
uses the |
.Ev HOME |
.Ev HOME |
environment variable. |
environment variable. |
|
|
.El |
.El |
.Sh HISTORY |
.Sh HISTORY |
The |
The |
.Nm indent |
.Nm |
command appeared in |
command appeared in |
.Bx 4.2 . |
.Bx 4.2 . |
.Sh BUGS |
.Sh BUGS |
.Nm indent |
.Nm |
has even more switches than |
has even more switches than |
.Xr ls 1 . |
.Xr ls 1 . |
.Pp |
.Pp |