indent.1 (79755) | indent.1 (95124) |
---|---|
1.\" Copyright (c) 1980, 1990, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" Copyright (c) 1976 Board of Trustees of the University of Illinois. 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: --- 18 unchanged lines hidden (view full) --- 27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32.\" SUCH DAMAGE. 33.\" 34.\" @(#)indent.1 8.1 (Berkeley) 7/1/93 | 1.\" Copyright (c) 1980, 1990, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" Copyright (c) 1976 Board of Trustees of the University of Illinois. 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: --- 18 unchanged lines hidden (view full) --- 27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32.\" SUCH DAMAGE. 33.\" 34.\" @(#)indent.1 8.1 (Berkeley) 7/1/93 |
35.\" $FreeBSD: head/usr.bin/indent/indent.1 79755 2001-07-15 08:06:20Z dd $ | 35.\" $FreeBSD: head/usr.bin/indent/indent.1 95124 2002-04-20 12:18:28Z charnier $ |
36.\" 37.Dd July 1, 1993 38.Dt INDENT 1 39.Os 40.Sh NAME 41.Nm indent 42.Nd indent and format C program source 43.Sh SYNOPSIS --- 32 unchanged lines hidden (view full) --- 76.Op Fl \&sc | Fl nsc 77.Bk -words 78.Op Fl sob | Fl nsob 79.Ek 80.Op Fl \&st 81.Op Fl troff 82.Op Fl v | Fl \&nv 83.Sh DESCRIPTION | 36.\" 37.Dd July 1, 1993 38.Dt INDENT 1 39.Os 40.Sh NAME 41.Nm indent 42.Nd indent and format C program source 43.Sh SYNOPSIS --- 32 unchanged lines hidden (view full) --- 76.Op Fl \&sc | Fl nsc 77.Bk -words 78.Op Fl sob | Fl nsob 79.Ek 80.Op Fl \&st 81.Op Fl troff 82.Op Fl v | Fl \&nv 83.Sh DESCRIPTION |
84.Nm Indent 85is a 86.Ar C | 84The 85.Nm 86utility is a 87.Em C |
87program formatter. It reformats the | 88program formatter. It reformats the |
88.Ar C | 89.Em C |
89program in the 90.Ar input-file 91according to the switches. The switches which can be 92specified are described below. They may appear before or after the file 93names. 94.Pp 95.Sy NOTE : 96If you only specify an --- 279 unchanged lines hidden (view full) --- 376.Nm 377is run and a profile file exists, then it is read to set up the program's 378defaults. Switches on the command line, though, always override profile 379switches. The switches should be separated by spaces, tabs or newlines. 380.Pp 381.Ss Comments 382.Sq Em Box 383.Em comments . | 90program in the 91.Ar input-file 92according to the switches. The switches which can be 93specified are described below. They may appear before or after the file 94names. 95.Pp 96.Sy NOTE : 97If you only specify an --- 279 unchanged lines hidden (view full) --- 377.Nm 378is run and a profile file exists, then it is read to set up the program's 379defaults. Switches on the command line, though, always override profile 380switches. The switches should be separated by spaces, tabs or newlines. 381.Pp 382.Ss Comments 383.Sq Em Box 384.Em comments . |
384.Nm Indent | 385The 386.Nm 387utility |
385assumes that any comment with a dash or star immediately after the start of 386comment (that is, `/*\-' or `/**') is a comment surrounded by a box of stars. 387Each line of such a comment is left unchanged, except that its indentation 388may be adjusted to account for the change in indentation of the first line 389of the comment. 390.Pp 391.Em Straight text . 392All other comments are treated as straight text. | 388assumes that any comment with a dash or star immediately after the start of 389comment (that is, `/*\-' or `/**') is a comment surrounded by a box of stars. 390Each line of such a comment is left unchanged, except that its indentation 391may be adjusted to account for the change in indentation of the first line 392of the comment. 393.Pp 394.Em Straight text . 395All other comments are treated as straight text. |
393.Nm Indent 394fits as many words (separated by blanks, tabs, or newlines) on a | 396The 397.Nm 398utility fits as many words (separated by blanks, tabs, or newlines) on a |
395line as possible. Blank lines break paragraphs. 396.Pp 397.Ss Comment indentation 398If a comment is on a line with code it is started in the `comment column', 399which is set by the 400.Fl c Ns Ns Ar n 401command line parameter. Otherwise, the comment is started at 402.Ar n --- 13 unchanged lines hidden (view full) --- 416leaves embedded comments alone. Conditional compilation 417.Pq Ic #ifdef...#endif 418is recognized and 419.Nm 420attempts to correctly 421compensate for the syntactic peculiarities introduced. 422.Pp 423.Ss C syntax | 399line as possible. Blank lines break paragraphs. 400.Pp 401.Ss Comment indentation 402If a comment is on a line with code it is started in the `comment column', 403which is set by the 404.Fl c Ns Ns Ar n 405command line parameter. Otherwise, the comment is started at 406.Ar n --- 13 unchanged lines hidden (view full) --- 420leaves embedded comments alone. Conditional compilation 421.Pq Ic #ifdef...#endif 422is recognized and 423.Nm 424attempts to correctly 425compensate for the syntactic peculiarities introduced. 426.Pp 427.Ss C syntax |
424.Nm Indent 425understands a substantial amount about the syntax of C, but it | 428The 429.Nm 430utility understands a substantial amount about the syntax of C, but it |
426has a `forgiving' parser. It attempts to cope with the usual sorts of 427incomplete and misformed syntax. In particular, the use of macros like: 428.Pp 429.Dl #define forever for(;;) 430.Pp 431is handled properly. 432.Sh ENVIRONMENT | 431has a `forgiving' parser. It attempts to cope with the usual sorts of 432incomplete and misformed syntax. In particular, the use of macros like: 433.Pp 434.Dl #define forever for(;;) 435.Pp 436is handled properly. 437.Sh ENVIRONMENT |
433.Nm Indent 434uses the | 438The 439.Nm 440utility uses the |
435.Ev HOME 436environment variable. 437.Sh FILES 438.Bl -tag -width "./.indent.pro" -compact 439.It Pa ./.indent.pro 440profile file 441.It Pa ~/.indent.pro 442profile file 443.El 444.Sh HISTORY 445The 446.Nm 447command appeared in 448.Bx 4.2 . 449.Sh BUGS | 441.Ev HOME 442environment variable. 443.Sh FILES 444.Bl -tag -width "./.indent.pro" -compact 445.It Pa ./.indent.pro 446profile file 447.It Pa ~/.indent.pro 448profile file 449.El 450.Sh HISTORY 451The 452.Nm 453command appeared in 454.Bx 4.2 . 455.Sh BUGS |
450.Nm Indent 451has even more switches than | 456The 457.Nm 458utility has even more switches than |
452.Xr ls 1 . 453.Pp 454A common mistake that often causes grief is typing: 455.Pp 456.Dl indent *.c 457.Pp 458to the shell in an attempt to indent all the | 459.Xr ls 1 . 460.Pp 461A common mistake that often causes grief is typing: 462.Pp 463.Dl indent *.c 464.Pp 465to the shell in an attempt to indent all the |
459C programs in a directory. | 466.Em C 467programs in a directory. |
460This is probably a bug, not a feature. | 468This is probably a bug, not a feature. |