diff options
author | Jason McIntyre <jmc@cvs.openbsd.org> | 2003-11-28 22:04:01 +0000 |
---|---|---|
committer | Jason McIntyre <jmc@cvs.openbsd.org> | 2003-11-28 22:04:01 +0000 |
commit | f54719677791386bf7b440f70afa136c6ff57167 (patch) | |
tree | e33107b6738fdef46e2cda5c833a981c0aed5a9d /usr.bin/indent/indent.1 | |
parent | e9d7b69dbfde782a9721fa8b63908a3d667b79de (diff) |
- some fixes from PR 1446
- much simpler groff macros
- sync SYNOPSIS with reality
- document which options are broken (-bap, -ip, -ln, -sob)
- remove groff macros
- document defaults
- document -lcn
Together with pjanzen's fixes (rev. 1.10), fixes PR 1446
Diffstat (limited to 'usr.bin/indent/indent.1')
-rw-r--r-- | usr.bin/indent/indent.1 | 127 |
1 files changed, 65 insertions, 62 deletions
diff --git a/usr.bin/indent/indent.1 b/usr.bin/indent/indent.1 index ad2dcef9cd8..333b16ff522 100644 --- a/usr.bin/indent/indent.1 +++ b/usr.bin/indent/indent.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: indent.1,v 1.13 2003/06/12 01:07:27 deraadt Exp $ +.\" $OpenBSD: indent.1,v 1.14 2003/11/28 22:04:00 jmc Exp $ .\" .\" Copyright (c) 1980, 1990, 1993 .\" The Regents of the University of California. @@ -40,43 +40,39 @@ .Nd indent and format C program source .Sh SYNOPSIS .Nm indent -.Op Ar input-file Op Ar output-file -.Op Fl bad | Fl nbad -.Op Fl bap | Fl nbap .Bk -words -.Op Fl bbb | Fl nbbb -.Ek -.Op Fl \&bc | Fl nbc -.Op Fl \&bl -.Op Fl \&br +.Op Ar input-file Op Ar output-file +.Op Fl bad | nbad +.Op Fl bap | nbap +.Op Fl bbb | nbbb +.Op Fl \&bc | nbc +.Op Fl \&bl | \&br .Op Fl c Ns Ar n .Op Fl \&cd Ns Ar n -.Bk -words -.Op Fl cdb | Fl ncdb -.Ek -.Op Fl \&ce | Fl nce +.Op Fl cdb | ncdb +.Op Fl \&ce | nce .Op Fl \&ci Ns Ar n .Op Fl cli Ns Ar n .Op Fl d Ns Ar n .Op Fl \&di Ns Ar n -.Bk -words -.Op Fl fc1 | Fl nfc1 -.Ek +.Op Fl \&dj | ndj +.Op Fl \&ei | nei +.Op Fl fc1 | nfc1 .Op Fl i Ns Ar n -.Op Fl \&ip | Fl nip +.Op Fl \&ip | nip .Op Fl l Ns Ar n .Op Fl \&lc Ns Ar n -.Op Fl \&lp | Fl nlp +.Op Fl \&lp | nlp .Op Fl npro -.Op Fl pcs | Fl npcs -.Op Fl psl | Fl npsl -.Op Fl \&sc | Fl nsc -.Bk -words -.Op Fl sob | Fl nsob -.Ek +.Op Fl pcs | npcs +.Op Fl psl | npsl +.Op Fl \&sc | nsc +.Op Fl sob | nsob .Op Fl \&st +.Op Fl T Ns Ar typename .Op Fl troff -.Op Fl v | Fl \&nv +.Op Fl v | \&nv +.Ek .Sh DESCRIPTION .Nm is a @@ -119,7 +115,7 @@ checks to make sure it is different from .Ar input-file . .Pp The options listed below control the formatting style imposed by -.Nm indent . +.Nm . .Bl -tag -width Op .It Fl bad , nbad If @@ -134,6 +130,8 @@ If is specified, a blank line is forced after every procedure body. Default: .Fl nbap . +.Sy Note : +This option currently has no effect. .It Fl bbb , nbbb If .Fl bbb @@ -147,12 +145,11 @@ is specified, then a newline is forced after each comma in a declaration. .Fl nbc turns off this option. The default is -.Fl \&nbc . -.It Fl \&br , \&bl +.Fl nbc . +.It Fl \&bl , \&br Specifying .Fl \&bl lines up compound statements like this: -.ne 4 .Bd -literal -offset indent if (...) { @@ -163,7 +160,6 @@ if (...) Specifying .Fl \&br (the default) makes them look like this: -.ne 3 .Bd -literal -offset indent if (...) { code @@ -181,15 +177,14 @@ is for these comments to start in the same column as those on code. Enables (disables) the placement of comment delimiters on blank lines. With this option enabled, comments look like this: .Bd -literal -offset indent -.ne 3 - /* - * this is a comment - */ +/* + * this is a comment + */ .Ed .Pp Rather than like this: .Bd -literal -offset indent - /* this is a comment */ +/* this is a comment */ .Ed .Pp This only affects block comments, not comments to the right of @@ -229,12 +224,12 @@ The default is .It Fl d Ns Ar n Controls the placement of comments which are not to the right of code. -The default -.Fl \&d\&1 +Specifying +.Fl d1 means that such comments are placed one indentation level to the left of code. -Specifying -.Fl \&d\&0 +The default, +.Fl d0 , lines up these comments with the code. See the section on comment indentation below. .It Fl \&di Ns Ar n @@ -260,11 +255,13 @@ following an will have the same indentation as the preceding .Ic \&if statement. +The default is +.Fl ei . .It Fl fc1 , nfc1 Enables (disables) the formatting of comments that start in column 1. Often, comments whose leading .Ql / -is in column 1 have been carefully have formatted by the programmer. +is in column 1 have been carefully formatted by the programmer. In such cases, .Fl nfc1 should be @@ -279,41 +276,46 @@ Enables (disables) the indentation of parameter declarations from the left margin. The default is .Fl \&ip . +.Sy Note : +This option currently has no effect. .It Fl l Ns Ar n Maximum length of an output line. The default is 75. +.Sy Note : +This option currently has no effect. +.It Fl \&lc Ns Ar n +Specify a column width for comments. .It Fl \&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. +Lines up code surrounded by parentheses in continuation lines. +If 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. For example, here is how a piece of continued code looks with .Fl nlp in effect: -.ne 2 .Bd -literal -offset indent p1 = first_procedure(second_procedure(p2, p3), -\ \ third_procedure(p4,p5)); + third_procedure(p4,p5)); .Ed .Pp -.ne 5 With .Fl lp in effect (the default) the code looks somewhat clearer: .Bd -literal -offset indent -p1\ =\ first_procedure(second_procedure(p2,\ p3), -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ third_procedure(p4,p5)); +p1 = first_procedure(second_procedure(p2, p3), + third_procedure(p4,p5)); .Ed .Pp -.ne 5 Inserting two more newlines we get: .Bd -literal -offset indent -p1\ =\ first_procedure(second_procedure(p2, -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ p3), -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ third_procedure(p4, -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ p5)); +p1 = first_procedure(second_procedure(p2, + p3), + third_procedure(p4, + p5)); .Ed +.Pp +The default is +.Fl lp . .It Fl npro Causes the profile files, .Pa ./.indent.pro @@ -339,6 +341,8 @@ The default is Enables (disables) the placement of asterisks .Pq Ql * at the left edge of all comments. +The default is +.Fl sc . .It Fl sob , nsob If .Fl sob @@ -346,6 +350,8 @@ is specified, indent will swallow optional blank lines. You can use this to get rid of blank lines after declarations. Default: .Fl nsob . +.Sy Note : +This option currently has no effect. .It Fl \&st Causes .Nm @@ -406,7 +412,7 @@ by creating a file called in your login directory and/or the current directory and including whatever switches you like. An -.Pa \&.indent.pro +.Pa .indent.pro file in the current directory takes precedence over the one in your login directory. If @@ -443,14 +449,14 @@ Blank lines break paragraphs. If a comment is on a line with code it is started in the .Dq comment column , which is set by the -.Fl c Ns Ns Ar n +.Fl c Ns Ar n command line parameter. Otherwise, the comment is started at .Ar n indentation levels less than where code is currently being placed, where .Ar n is specified by the -.Fl d Ns Ns Ar n +.Fl d Ns Ar n command line parameter. If the code on a line extends past the comment column, the comment starts further to the right, and the right margin may be @@ -504,12 +510,9 @@ command appeared in has even more switches than .Xr ls 1 . .Pp -.ne 5 A common mistake that often causes grief is typing: .Pp .Dl indent *.c .Pp -to the shell in an attempt to indent all the -.Nm C -programs in a directory. +to the shell in an attempt to indent all the C programs in a directory. This is probably a bug, not a feature. |