-.\" Copyright (c) 1983 Regents of the University of California.
-.\" All rights reserved. The Berkeley software License Agreement
-.\" specifies the terms and conditions for redistribution.
+.\" Copyright (c) 1985 Sun Microsystems, Inc.
+.\" Copyright (c) 1980 The Regents of the University of California.
+.\" Copyright (c) 1976 Board of Trustees of the University of Illinois.
+.\" All rights reserved.
.\"
-.\" @(#)indent.1 6.4 (Berkeley) %G%
+.\" Redistribution and use in source and binary forms are permitted
+.\" provided that the above copyright notice and this paragraph are
+.\" duplicated in all such forms and that any documentation,
+.\" advertising materials, and other materials related to such
+.\" distribution and use acknowledge that the software was developed
+.\" by the University of California, Berkeley, the University of Illinois,
+.\" Urbana, and Sun Microsystems, Inc. The name of either University
+.\" or Sun Microsystems may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+.\" WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+.\"
+.\" @(#)indent.1 6.5 (Berkeley) %G%
.\"
-.TH INDENT 1 ""
-.UC 5
+
+.TH INDENT 1 "
.SH NAME
indent \- indent and format C program source
.SH SYNOPSIS
[\ \fB\-bap\fR\ |\ \fB\-nbap\fR\ ]
[\ \fB\-bbb\fR\ |\ \fB\-nbbb\fR\ ]
[\ \fB\-bc\fR\ |\ \fB\-nbc\fR\ ]
-[\ \fB\-bl\fR\ |\ \fB\-br\fR\ ]
+[\ \fB\-bl\fR\ ]
+[\ \fB\-br\fR\ ]
[\ \fB\-c\fIn\fR\ ]
[\ \fB\-cd\fIn\fR\ ]
[\ \fB\-cdb\fR\ |\ \fB\-ncdb\fR\ ]
[\ \fB\-cli\fIn\fR\ ]
[\ \fB\-d\fIn\fR\ ]
[\ \fB\-di\fIn\fR\ ]
-[\ \fB\-dj\fR\ |\ \fB\-ndj\fR\ ]
-[\ \fB\-ei\fR\ |\ \fB\-nei\fR\ ]
[\ \fB\-fc1\fR\ |\ \fB\-nfc1\fR\ ]
[\ \fB\-i\fIn\fR\ ]
[\ \fB\-ip\fR\ |\ \fB\-nip\fR\ ]
[\ \fB\-l\fIn\fR\ ]
[\ \fB\-lc\fIn\fR\ ]
[\ \fB\-lp\fR\ |\ \fB\-nlp\fR\ ]
-[\ \fB\-npro\fR\ ]
[\ \fB\-pcs\fR\ |\ \fB\-npcs\fR\ ]
-[\ \fB\-ps\fR\ |\ \fB\-nps\fR\ ]
+[\ \fB\-npro\fR\ ]
[\ \fB\-psl\fR\ |\ \fB\-npsl\fR\ ]
[\ \fB\-sc\fR\ |\ \fB\-nsc\fR\ ]
[\ \fB\-sob\fR\ |\ \fB\-nsob\fR\ ]
[\ \fB\-troff\fR\ ]
[\ \fB\-v\fR\ |\ \fB\-nv\fR\ ]
.SH DESCRIPTION
-.IX indent "" "\fLindent\fP \(em format C source"
-.IX "programming tools" "indent" "" "\fLindent\fP \(em format C source"
-.IX "languages" "indent" "" "\fLindent\fP \(em format C source"
-.IX "C programming language" "indent" "" "\fLindent\fP \(em format C source"
-.IX "pretty printer" "indent" "" "\fLindent\fP \(em format C source"
-.IX "format C programs" "" "format C programs \(em \fLindent\fP"
-.IX "code formatter" "indent" "" "\fLindent\fP \(em format C source"
-.IX "cb" "indent" "\fLcb\fP" "try \fLindent\fP \(em format C source"
.I Indent
is a \fBC\fR program formatter. It reformats the \fBC\fR program in the
\fIinput-file\fR according to the switches. The switches which can be
The options listed below control the formatting style imposed by
.IR indent .
.TP 15
-.BR \-bad , \-nbad
-If
-.B \-bad
-is specified, a blank line is forced after every block of
-declarations. Default:
-.BR \-nbad .
-.TP 15
.BR \-bap , \-nbap
If
.B \-bap
is specified, a blank line is forced after every procedure body. Default:
.B \-nbap.
.TP 15
+.BR \-bad , \-nbad
+If
+.B \-bad
+is specified, a blank line is forced after every block of
+declarations. Default:
+.B \-nbad.
+.TP 15
.BR \-bbb , \-nbbb
If
.B \-bbb
is specified, then a newline is forced after each comma in a declaration.
.B \-nbc
turns off this option. The default is
-.BR \-nbc .
+.BR \-bc .
.TP 15
.BR \-br , \-bl
Specifying
/* this is a comment */
.ft R
.fi
-This only affects block comments, not comments to the right of
-code. The default is
-.BR \-cdb .
+This only affects block comments, not comments to the right of code. The default is
+.B \-cdb .
.TP 15
.BI \-ce , \-nce
-Enables (disables) forcing `else's to cuddle up to the immediately preceding
+Enables (disables) forcing `else's to cuddle up to the immediatly preceeding
`}'. The default is
-.BR \-ce .
+.B \-ce .
.TP 15
.BI \-ci n
Sets the continuation indent to be \fIn\fR. Continuation
Causes case labels to be indented
.I n
tab stops to the right of the containing \fBswitch\fR statement.
-\fB\-cli0.5\fR causes case labels to be indented half a tab stop. The
+\fB-cli0.5\fR causes case labels to be indented half a tab stop. The
default is
-.BR \-cli0 .
-(This is the only option that takes a fractional argument.)
+.B \-cli0 .
.TP 15
.BI \-d n
Controls the placement of comments which are not to the
-right of code. Specifying
+right of code. The default
.B \-d1
means that such comments are placed one indentation level to the
-left of code. The default
+left of code. Specifying
.B \-d0
lines up these comments with the code. See the section on comment
indentation below.
.BI \-di n
Specifies the indentation, in character positions, from a declaration keyword
to the following identifier. The default is
-.BR \-di16 .
-.TP 15
+.B \-di16 .
+.if 0 \{.TP 15
.BR \-dj , \-ndj
.B \-dj
left justifies declarations.
.BI \-ei , \-nei
Enables (disables) special
.B else-if
-processing. If enabled,
+processing. If it's enabled,
.BR if "s"
following
.BR else "s"
-will have the same indentation as the preceding
+will have the same indendation as the preceeding
.B if
-statement. The default is
-.BR \-ei .
+statement.\}
.TP 15
.BI \-fc1 , \-nfc1
Enables (disables) the formatting of comments that start in column 1.
used. The default is \fB\-fc1\fR.
.TP 15
.BI \-i n
-The number of spaces for one indentation level. The default is 8.
+The number of spaces for one indentation level. The default is 4.
.TP 15
.BI \-ip , \-nip
Enables (disables) the indentation of parameter declarations from the left
margin. The default is
-.BR \-ip .
+.B \-ip .
.TP 15
.BI \-l n
-Maximum length of an output line. The default is 78.
+Maximum length of an output line. The default is 75.
+.TP 15
+.B \-npro
+Causes the profile files, `./.indent.pro' and `~/.indent.pro', to be ignored.
.TP 15
.BI \-lp , \-nlp
Lines up code surrounded by parenthesis in continuation lines. If a line
has a left paren which is not closed on that line, then continuation lines
will be lined up to start at the character position just after the left
-paren. For example, here is how a piece of continued code looks with
-\fB\-nlp\fR in effect:
+paren. For example, here is how a piece of continued code looks with -nlp
+in effect:
.ne 2
.nf
.ft L
.ft R
.fi
.ne 5
-With \fB\-lp\fR in effect (the default) the code looks somewhat clearer:
+With \fB-lp\fR in effect (the default) the code looks somewhat clearer:
.nf
.ft L
-.ta \w' p1 = first_procedure('u
p1 = first_procedure(second_procedure(p2, p3),
- third_procedure(p4, p5));
+ third_procedure(p4, p5));
.ft R
.fi
.ne 5
-Inserting two more newlines we get:
+Inserting a couple more newlines we get:
.nf
.ft L
-.ta \w' p1 = first_procedure('u +\w'second_procedure('u
p1 = first_procedure(second_procedure(p2,
- p3),
-.ta \w' p1 = first_procedure('u +\w'third_procedure('u
- third_procedure(p4,
- p5));
+ p3),
+ third_procedure(p4,
+ p5));
.ft R
.fi
.TP 15
-.B \-npro
-Causes the profile files, `./.indent.pro' and `~/.indent.pro', to be ignored.
-.TP 15
-.BR \-pcs , \-npcs
-If true (\fB\-pcs\fR) all procedure calls will have a space inserted between
-the name and the `('. The default is
-.BR \-npcs .
-.TP 15
-.BR \-ps , \-nps
-If true (\fB\-ps\fR) the pointer following operator `\->' will be
-surrounded by spaces on either side. The default is
-.BR \-nps .
+.B \-pcs , \-npcs
+If true (\fB-pcs\fR) all procedure calls will have a space inserted between
+the name and the '('. The default is
+.B \-npcs
.TP 15
-.BR \-psl , \-npsl
-If true (\fB\-psl\fR) the names of procedures being defined are placed in
+.B \-psl , \-npsl
+If true (\fB-psl\fR) the names of procedures being defined are placed in
column 1 \- their types, if any, will be left on the previous lines. The
default is
-.BR \-psl .
+.B -psl
.TP 15
-.BR \-sc , \-nsc
+.BI \-sc , \-nsc
Enables (disables) the placement of asterisks (`*'s) at the left edge of all
-comments. The default is
-.BR \-sc .
+comments.
.TP 15
.BR \-sob , \-nsob
If
.B \-sob
is specified, indent will swallow optional blank lines. You can use this to
get rid of blank lines after declarations. Default:
-.BR \-nsob .
+.B \-nsob
.TP 15
.B \-st
Causes
harmed if you miss a few, but the program won't be formatted as nicely as
it should. This sounds like a painful thing to have to do, but it's really
a symptom of a problem in C: \fBtypedef\fR causes a syntactic change in the
-language and \fIindent\fR can't find all \fBtypedef\fRs.
+laguage and \fIindent\fR can't find all \fBtypedef\fRs.
.TP 15
.B \-troff
Causes
.B indent
to format the program for processing by troff. It will produce a fancy
listing in much the same spirit as
-.BR vgrind .
+.BR vgrind.
If the output file is not specified, the default is standard output,
rather than formatting in place.
.TP 15
.BR \-v , \-nv
.B \-v
-turns on `verbose' mode;
+turns on `verbose' mode,
.B \-nv
turns it off. When in verbose mode,
.I indent
.I indent
by creating a file called
.BI . indent . pro
-in either your login directory and/or the current directory and including
-whatever switches you like. Switches in `.indent.pro' in the current
-directory override those in your login directory (with the exception of
-.B -T
-type definitions, which just accumulate). If
+in either your login directory or the current directory and including
+whatever switches you like. A `.indent.pro' in the current directory takes
+precedence over the one in your login directory. If
.I indent
is run and a profile file exists, then it is read to set up the program's
-defaults. The switches should be separated by spaces, tabs or newlines.
-Switches on the command line, however, override profile switches.
+defaults. Switches on the command line, though, always override profile
+switches. The switches should be separated by spaces, tabs or newlines.
.LP
.B Comments
.LP
.B Preprocessor lines
.LP
In general, \fIindent\fR leaves preprocessor lines alone. The only
-reformatting that it will do is to straighten up trailing comments. It
-leaves embedded comments alone. Conditional compilation
+reformmatting that it will do is to straighten up trailing comments. It
+leaves imbedded comments alone. Conditional compilation
(\fB#ifdef...#endif\fR) is recognized and \fIindent\fR attempts to correctly
-compensate for the syntactic peculiarities introduced.
+compensate for the syntactic peculiarites introduced.
.LP
.B C syntax
.LP
.br
\&./.indent.pro profile file
.br
-~/.indent.pro profile file
.SH BUGS
.I Indent
has even more switches than \fIls\fR.
-.sp
+
.ne 5
A common mistake that often causes grief is typing:
.nf