indent.1 (131491) | indent.1 (131507) |
---|---|
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 131491 2004-07-02 22:22:35Z ru $ | 35.\" $FreeBSD: head/usr.bin/indent/indent.1 131507 2004-07-03 00:24:45Z ru $ |
36.\" 37.Dd June 29, 2004 38.Dt INDENT 1 39.Os 40.Sh NAME 41.Nm indent 42.Nd indent and format C program source 43.Sh SYNOPSIS --- 50 unchanged lines hidden (view full) --- 94program in the 95.Ar input-file 96according to the switches. 97The switches which can be 98specified are described below. 99They may appear before or after the file 100names. 101.Pp | 36.\" 37.Dd June 29, 2004 38.Dt INDENT 1 39.Os 40.Sh NAME 41.Nm indent 42.Nd indent and format C program source 43.Sh SYNOPSIS --- 50 unchanged lines hidden (view full) --- 94program in the 95.Ar input-file 96according to the switches. 97The switches which can be 98specified are described below. 99They may appear before or after the file 100names. 101.Pp |
102.Sy NOTE : | 102.Sy NOTE : |
103If you only specify an | 103If you only specify an |
104.Ar input-file , | 104.Ar input-file , |
105the formatting is 106done `in-place', that is, the formatted file is written back into 107.Ar input-file 108and a backup copy of 109.Ar input-file 110is written in the current directory. 111If 112.Ar input-file 113is named 114.Sq Pa /blah/blah/file , 115the backup file is named 116.Pa file.BAK . 117.Pp 118If 119.Ar output-file 120is specified, 121.Nm 122checks to make sure it is different from | 105the formatting is 106done `in-place', that is, the formatted file is written back into 107.Ar input-file 108and a backup copy of 109.Ar input-file 110is written in the current directory. 111If 112.Ar input-file 113is named 114.Sq Pa /blah/blah/file , 115the backup file is named 116.Pa file.BAK . 117.Pp 118If 119.Ar output-file 120is specified, 121.Nm 122checks to make sure it is different from |
123.Ar input-file . | 123.Ar input-file . |
124.Pp 125The options listed below control the formatting style imposed by 126.Nm . 127.Bl -tag -width Op 128.It Fl bad , nbad 129If 130.Fl bad 131is specified, a blank line is forced after every block of 132declarations. 133Default: | 124.Pp 125The options listed below control the formatting style imposed by 126.Nm . 127.Bl -tag -width Op 128.It Fl bad , nbad 129If 130.Fl bad 131is specified, a blank line is forced after every block of 132declarations. 133Default: |
134.Fl nbad . | 134.Fl nbad . |
135.It Fl bap , nbap 136If 137.Fl bap 138is specified, a blank line is forced after every procedure body. 139Default: 140.Fl nbap . 141.It Fl bbb , nbbb 142If 143.Fl bbb 144is specified, a blank line is forced before every block comment. 145Default: 146.Fl nbbb . 147.It Fl \&bc , nbc 148If 149.Fl \&bc 150is specified, then a newline is forced after each comma in a declaration. 151.Fl nbc 152turns off this option. 153Default: | 135.It Fl bap , nbap 136If 137.Fl bap 138is specified, a blank line is forced after every procedure body. 139Default: 140.Fl nbap . 141.It Fl bbb , nbbb 142If 143.Fl bbb 144is specified, a blank line is forced before every block comment. 145Default: 146.Fl nbbb . 147.It Fl \&bc , nbc 148If 149.Fl \&bc 150is specified, then a newline is forced after each comma in a declaration. 151.Fl nbc 152turns off this option. 153Default: |
154.Fl \&nbc . | 154.Fl \&nbc . |
155.It Fl \&br , \&bl 156Specifying 157.Fl \&bl 158lines-up compound statements like this: 159.Bd -literal -offset indent 160if (...) 161{ 162 code --- 29 unchanged lines hidden (view full) --- 192Rather than like this: 193.Bd -literal -offset indent 194 /* this is a comment */ 195.Ed 196.Pp 197This only affects block comments, not comments to the right of 198code. 199The default is | 155.It Fl \&br , \&bl 156Specifying 157.Fl \&bl 158lines-up compound statements like this: 159.Bd -literal -offset indent 160if (...) 161{ 162 code --- 29 unchanged lines hidden (view full) --- 192Rather than like this: 193.Bd -literal -offset indent 194 /* this is a comment */ 195.Ed 196.Pp 197This only affects block comments, not comments to the right of 198code. 199The default is |
200.Fl cdb . | 200.Fl cdb . |
201.It Fl ce , nce 202Enables (disables) forcing of `else's to cuddle up to the immediately preceding 203`}'. 204The default is | 201.It Fl ce , nce 202Enables (disables) forcing of `else's to cuddle up to the immediately preceding 203`}'. 204The default is |
205.Fl \&ce . | 205.Fl \&ce . |
206.It Fl \&ci Ns Ar n 207Sets the continuation indent to be | 206.It Fl \&ci Ns Ar n 207Sets the continuation indent to be |
208.Ar n . | 208.Ar n . |
209Continuation 210lines will be indented that far from the beginning of the first line of the 211statement. 212Parenthesized expressions have extra indentation added to 213indicate the nesting, unless 214.Fl \&lp 215is in effect 216or the contination indent is exactly half of the main indent. 217.Fl \&ci 218defaults to the same value as | 209Continuation 210lines will be indented that far from the beginning of the first line of the 211statement. 212Parenthesized expressions have extra indentation added to 213indicate the nesting, unless 214.Fl \&lp 215is in effect 216or the contination indent is exactly half of the main indent. 217.Fl \&ci 218defaults to the same value as |
219.Fl i . | 219.Fl i . |
220.It Fl cli Ns Ar n 221Causes case labels to be indented 222.Ar n 223tab stops to the right of the containing 224.Ic switch 225statement. 226.Fl cli0.5 227causes case labels to be indented half a tab stop. 228The 229default is | 220.It Fl cli Ns Ar n 221Causes case labels to be indented 222.Ar n 223tab stops to the right of the containing 224.Ic switch 225statement. 226.Fl cli0.5 227causes case labels to be indented half a tab stop. 228The 229default is |
230.Fl cli0 . | 230.Fl cli0 . |
231.It Fl d Ns Ar n 232Controls the placement of comments which are not to the 233right of code. 234For example, 235.Fl \&d\&1 236means that such comments are placed one indentation level to the 237left of code. 238Specifying the default 239.Fl \&d\&0 240lines-up these comments with the code. 241See the section on comment 242indentation below. 243.It Fl \&di Ns Ar n 244Specifies the indentation, in character positions, 245of global variable names and all struct/union member names 246relative to the beginning of their type declaration. 247The default is | 231.It Fl d Ns Ar n 232Controls the placement of comments which are not to the 233right of code. 234For example, 235.Fl \&d\&1 236means that such comments are placed one indentation level to the 237left of code. 238Specifying the default 239.Fl \&d\&0 240lines-up these comments with the code. 241See the section on comment 242indentation below. 243.It Fl \&di Ns Ar n 244Specifies the indentation, in character positions, 245of global variable names and all struct/union member names 246relative to the beginning of their type declaration. 247The default is |
248.Fl di16 . | 248.Fl di16 . |
249.It Fl dj , ndj 250.Fl \&dj 251left justifies declarations. 252.Fl ndj 253indents declarations the same as code. 254The default is | 249.It Fl dj , ndj 250.Fl \&dj 251left justifies declarations. 252.Fl ndj 253indents declarations the same as code. 254The default is |
255.Fl ndj . | 255.Fl ndj . |
256.It Fl \&ei , nei 257Enables (disables) special 258.Ic else-if 259processing. 260If it's enabled, an 261.Ic if 262following an 263.Ic else 264will have the same indentation as the preceding 265.Ic \&if 266statement. 267The default is | 256.It Fl \&ei , nei 257Enables (disables) special 258.Ic else-if 259processing. 260If it's enabled, an 261.Ic if 262following an 263.Ic else 264will have the same indentation as the preceding 265.Ic \&if 266statement. 267The default is |
268.Fl ei . | 268.Fl ei . |
269.It Fl fbs , nfbs 270Enables (disables) splitting the function declaration and opening brace 271across two lines. 272The default is | 269.It Fl fbs , nfbs 270Enables (disables) splitting the function declaration and opening brace 271across two lines. 272The default is |
273.Fl fbs . | 273.Fl fbs . |
274.It Fl fc1 , nfc1 275Enables (disables) the formatting of comments that start in column 1. 276Often, comments whose leading `/' is in column 1 have been carefully 277hand formatted by the programmer. 278In such cases, 279.Fl nfc1 280should be 281used. 282The default is | 274.It Fl fc1 , nfc1 275Enables (disables) the formatting of comments that start in column 1. 276Often, comments whose leading `/' is in column 1 have been carefully 277hand formatted by the programmer. 278In such cases, 279.Fl nfc1 280should be 281used. 282The default is |
283.Fl fc1 . | 283.Fl fc1 . |
284.It Fl fcb , nfcb 285Enables (disables) the formatting of block comments (ones that begin 286with `/*\\n'). 287Often, block comments have been not so carefully hand formatted by the 288programmer, but reformatting that would just change the line breaks is not 289wanted. 290In such cases, 291.Fl nfcb 292should be used. 293Block comments are then handled like box comments. 294The default is | 284.It Fl fcb , nfcb 285Enables (disables) the formatting of block comments (ones that begin 286with `/*\\n'). 287Often, block comments have been not so carefully hand formatted by the 288programmer, but reformatting that would just change the line breaks is not 289wanted. 290In such cases, 291.Fl nfcb 292should be used. 293Block comments are then handled like box comments. 294The default is |
295.Fl fcb . | 295.Fl fcb . |
296.It Fl i Ns Ar n 297The number of spaces for one indentation level. 298The default is 8. 299.It Fl \&ip , nip 300Enables (disables) the indentation of parameter declarations from the left 301margin. 302The default is | 296.It Fl i Ns Ar n 297The number of spaces for one indentation level. 298The default is 8. 299.It Fl \&ip , nip 300Enables (disables) the indentation of parameter declarations from the left 301margin. 302The default is |
303.Fl \&ip . | 303.Fl \&ip . |
304.It Fl l Ns Ar n 305Maximum length of an output line. 306The default is 78. 307.It Fl \&ldi Ns Ar n 308Specifies the indentation, in character positions, 309of local variable names 310relative to the beginning of their type declaration. 311The default is for local variable names to be indented --- 34 unchanged lines hidden (view full) --- 346.Sq Pa ~/.indent.pro , 347to be ignored. 348.It Fl pcs , npcs 349If true 350.Pq Fl pcs 351all procedure calls will have a space inserted between 352the name and the `('. 353The default is | 304.It Fl l Ns Ar n 305Maximum length of an output line. 306The default is 78. 307.It Fl \&ldi Ns Ar n 308Specifies the indentation, in character positions, 309of local variable names 310relative to the beginning of their type declaration. 311The default is for local variable names to be indented --- 34 unchanged lines hidden (view full) --- 346.Sq Pa ~/.indent.pro , 347to be ignored. 348.It Fl pcs , npcs 349If true 350.Pq Fl pcs 351all procedure calls will have a space inserted between 352the name and the `('. 353The default is |
354.Fl npcs . | 354.Fl npcs . |
355.It Fl psl , npsl 356If true 357.Pq Fl psl 358the names of procedures being defined are placed in 359column 1 \- their types, if any, will be left on the previous lines. 360The 361default is | 355.It Fl psl , npsl 356If true 357.Pq Fl psl 358the names of procedures being defined are placed in 359column 1 \- their types, if any, will be left on the previous lines. 360The 361default is |
362.Fl psl . | 362.Fl psl . |
363.It Fl \&sc , nsc 364Enables (disables) the placement of asterisks (`*'s) at the left edge of all 365comments. 366The default is | 363.It Fl \&sc , nsc 364Enables (disables) the placement of asterisks (`*'s) at the left edge of all 365comments. 366The default is |
367.Fl sc . | 367.Fl sc . |
368.It Fl sob , nsob 369If 370.Fl sob 371is specified, indent will swallow optional blank lines. 372You can use this to 373get rid of blank lines after declarations. 374Default: | 368.It Fl sob , nsob 369If 370.Fl sob 371is specified, indent will swallow optional blank lines. 372You can use this to 373get rid of blank lines after declarations. 374Default: |
375.Fl nsob . | 375.Fl nsob . |
376.It Fl \&st 377Causes 378.Nm 379to take its input from stdin and put its output to stdout. 380.It Fl T Ns Ar typename 381Adds 382.Ar typename 383to the list of type keywords. --- 24 unchanged lines hidden (view full) --- 408listing in much the same spirit as 409.Xr vgrind 1 . 410If the output file is not specified, the default is standard output, 411rather than formatting in place. 412.It Fl ut , nut 413Enables (disables) the use of tab characters in the output. 414Tabs are assumed to be aligned on columns divisble by 8. 415The default is | 376.It Fl \&st 377Causes 378.Nm 379to take its input from stdin and put its output to stdout. 380.It Fl T Ns Ar typename 381Adds 382.Ar typename 383to the list of type keywords. --- 24 unchanged lines hidden (view full) --- 408listing in much the same spirit as 409.Xr vgrind 1 . 410If the output file is not specified, the default is standard output, 411rather than formatting in place. 412.It Fl ut , nut 413Enables (disables) the use of tab characters in the output. 414Tabs are assumed to be aligned on columns divisble by 8. 415The default is |
416.Fl ut . | 416.Fl ut . |
417.It Fl v , \&nv 418.Fl v 419turns on `verbose' mode; 420.Fl \&nv 421turns it off. 422When in verbose mode, 423.Nm 424reports when it splits one line of input into two or more lines of output, 425and gives some size statistics at completion. 426The default is | 417.It Fl v , \&nv 418.Fl v 419turns on `verbose' mode; 420.Fl \&nv 421turns it off. 422When in verbose mode, 423.Nm 424reports when it splits one line of input into two or more lines of output, 425and gives some size statistics at completion. 426The default is |
427.Fl \&nv . | 427.Fl \&nv . |
428.El 429.Pp 430You may set up your own `profile' of defaults to 431.Nm 432by creating a file called 433.Pa .indent.pro 434in your login directory and/or the current directory and including 435whatever switches you like. --- 105 unchanged lines hidden --- | 428.El 429.Pp 430You may set up your own `profile' of defaults to 431.Nm 432by creating a file called 433.Pa .indent.pro 434in your login directory and/or the current directory and including 435whatever switches you like. --- 105 unchanged lines hidden --- |