1INDENT(1)                   General Commands Manual                  INDENT(1)
2
3
4

NAME

6       indent - changes the appearance of a C program by inserting or deleting
7       whitespace.
8

SYNOPSIS

10       indent [options] [input-files]
11
12       indent [options] [single-input-file] [-o output-file]
13
14       indent --version
15

DESCRIPTION

17       This man page is generated from the file indent.texinfo.  This is  Edi‐
18       tion  of "The indent Manual", for Indent Version , last updated .
19
20       The  indent  program  can  be used to make code easier to read.  It can
21       also convert from one style of writing C to another.
22
23       indent understands a substantial amount about the syntax of C,  but  it
24       also attempts to cope with incomplete and misformed syntax.
25
26       In  version 1.2 and more recent versions, the GNU style of indenting is
27       the default.
28

OPTIONS

30       -as, --align-with-spaces
31           If using tabs for indentation, use spaces for alignment.
32           See  INDENTATION.
33
34       -bad, --blank-lines-after-declarations
35           Force blank lines after the declarations.
36           See  BLANK LINES.
37
38       -bap, --blank-lines-after-procedures
39           Force blank lines after procedure bodies.
40           See  BLANK LINES.
41
42       -bbb, --blank-lines-before-block-comments
43           Force blank lines before block comments.
44           See  BLANK LINES.
45
46       -bbo, --break-before-boolean-operator
47           Prefer to break long lines before boolean operators.
48           See  BREAKING LONG LINES.
49
50       -bc, --blank-lines-after-commas
51           Force newline after comma in declaration.
52           See  DECLARATIONS.
53
54       -bl, --braces-after-if-line
55           Put braces on line after if, etc.
56           See  STATEMENTS.
57
58       -blf, --braces-after-func-def-line
59           Put braces on line following function definition line.
60           See  DECLARATIONS.
61
62       -blin, --brace-indentn
63           Indent braces n spaces.
64           See  STATEMENTS.
65
66       -bls, --braces-after-struct-decl-line
67           Put braces on the line after struct declaration lines.
68           See  DECLARATIONS.
69
70       -br, --braces-on-if-line
71           Put braces on line with if, etc.
72           See  STATEMENTS.
73
74       -brf, --braces-on-func-def-line
75           Put braces on function definition line.
76           See  DECLARATIONS.
77
78       -brs, --braces-on-struct-decl-line
79           Put braces on struct declaration line.
80           See  DECLARATIONS.
81
82       -bs, --Bill-Shannon, --blank-before-sizeof
83           Put a space between sizeof and its argument.
84           See  STATEMENTS.
85
86       -cn, --comment-indentationn
87           Put comments to the right of code in column n.
88           See  COMMENTS.
89
90       -cbin, --case-brace-indentationn
91           Indent braces after a case label N spaces.
92           See  STATEMENTS.
93
94       -cdn, --declaration-comment-columnn
95           Put comments to the right of the declarations in column n.
96           See  COMMENTS.
97
98       -cdb, --comment-delimiters-on-blank-lines
99           Put comment delimiters on blank lines.
100           See  COMMENTS.
101
102       -cdw, --cuddle-do-while
103           Cuddle while of do {} while; and preceding ‘}’.
104           See  COMMENTS.
105
106       -ce, --cuddle-else
107           Cuddle else and preceding ‘}’.
108           See  COMMENTS.
109
110       -cin, --continuation-indentationn
111           Continuation indent of n spaces.
112           See  STATEMENTS.
113
114       -clin, --case-indentationn
115           Case label indent of n spaces.
116           See  STATEMENTS.
117
118       -cpn, --else-endif-columnn
119           Put comments to the right of #else and #endif statements in  column
120           n.
121           See  COMMENTS.
122
123       -cs, --space-after-cast
124           Put a space after a cast operator.
125           See  STATEMENTS.
126
127       -dn, --line-comments-indentationn
128           Set indentation of comments not to the right of code to n spaces.
129           See  COMMENTS.
130
131       -bfda, --break-function-decl-args
132           Break the line before all arguments in a declaration.
133           See  DECLARATIONS.
134
135       -bfde, --break-function-decl-args-end
136           Break the line after the last argument in a declaration.
137           See  DECLARATIONS.
138
139       -dj, --left-justify-declarations
140           If  -cd  0 is used then comments after declarations are left justi‐
141           fied behind the declaration.
142           See  DECLARATIONS.
143
144       -din, --declaration-indentationn
145           Put variables in column n.
146           See  DECLARATIONS.
147
148       -fc1, --format-first-column-comments
149           Format comments in the first column.
150           See  COMMENTS.
151
152       -fca, --format-all-comments
153           Do not disable all formatting of comments.
154           See  COMMENTS.
155
156       -fnc, --fix-nested-comments
157           Fix nested comments.
158           See  COMMENTS.
159
160       -gnu, --gnu-style
161           Use GNU coding style.  This is the default.
162           See  COMMON STYLES.
163
164       -gts, --gettext-strings
165           Treat gettext _("...") and N_("...")  as  strings  rather  than  as
166           functions.
167           See  BREAKING LONG LINES.
168
169       -hnl, --honour-newlines
170           Prefer  to  break long lines at the position of newlines in the in‐
171           put.
172           See  BREAKING LONG LINES.
173
174       -in, --indent-leveln
175           Set indentation level to n spaces.
176           See  INDENTATION.
177
178       -iln, --indent-labeln
179           Set offset for labels to column n.
180           See  INDENTATION.
181
182       -ipn, --parameter-indentationn
183           Indent parameter types in old-style function definitions by n  spa‐
184           ces.
185           See  INDENTATION.
186
187       -kr, --k-and-r-style
188           Use Kernighan & Ritchie coding style.
189           See  COMMON STYLES.
190
191       -ln, --line-lengthn
192           Set maximum line length for non-comment lines to n.
193           See  BREAKING LONG LINES.
194
195       -lcn, --comment-line-lengthn
196           Set maximum line length for comment formatting to n.
197           See  COMMENTS.
198
199       -linux, --linux-style
200           Use Linux coding style.
201           See  COMMON STYLES.
202
203       -lp, --continue-at-parentheses
204           Line up continued lines at parentheses.
205           See  INDENTATION.
206
207       -lps, --leave-preprocessor-space
208           Leave space between ‘#’ and preprocessor directive.
209           See  INDENTATION.
210
211       -nlps, --remove-preprocessor-space
212           Remove space between ‘#’ and preprocessor directive.
213           See  INDENTATION.
214
215       -nbad, --no-blank-lines-after-declarations
216           Do not force blank lines after declarations.
217           See  BLANK LINES.
218
219       -nbap, --no-blank-lines-after-procedures
220           Do not force blank lines after procedure bodies.
221           See  BLANK LINES.
222
223       -nbbo, --break-after-boolean-operator
224           Do not prefer to break long lines before boolean operators.
225           See  BREAKING LONG LINES.
226
227       -nbc, --no-blank-lines-after-commas
228           Do not force newlines after commas in declarations.
229           See  DECLARATIONS.
230
231       -nbfda, --dont-break-function-decl-args
232           Don’t  put  each  argument  in a function declaration on a separate
233           line.
234           See  DECLARATIONS.
235
236       -ncdb, --no-comment-delimiters-on-blank-lines
237           Do not put comment delimiters on blank lines.
238           See  COMMENTS.
239
240       -ncdw, --dont-cuddle-do-while
241           Do not cuddle } and the while of a do {} while;.
242           See  STATEMENTS.
243
244       -nce, --dont-cuddle-else
245           Do not cuddle } and else.
246           See  STATEMENTS.
247
248       -ncs, --no-space-after-casts
249           Do not put a space after cast operators.
250           See  STATEMENTS.
251
252       -ndjn, --dont-left-justify-declarations
253           Comments after declarations are treated the same as comments  after
254           other statements.
255           See  DECLARATIONS.
256
257       -nfc1, --dont-format-first-column-comments
258           Do not format comments in the first column as normal.
259           See  COMMENTS.
260
261       -nfca, --dont-format-comments
262           Do not format any comments.
263           See  COMMENTS.
264
265       -ngts, --no-gettext-strings
266           Treat  gettext _("...") and N_("...") as normal functions.  This is
267           the default.
268           See  BREAKING LONG LINES.
269
270       -nhnl, --ignore-newlines
271           Do not prefer to break long lines at the position  of  newlines  in
272           the input.
273           See  BREAKING LONG LINES.
274
275       -nip, --no-parameter-indentation
276           Zero width indentation for parameters.
277           See  INDENTATION.
278
279       -nlp, --dont-line-up-parentheses
280           Do not line up parentheses.
281           See  STATEMENTS.
282
283       -npcs, --no-space-after-function-call-names
284           Do not put space after the function in function calls.
285           See  STATEMENTS.
286
287       -nprs, --no-space-after-parentheses
288           Do not put a space after every ’(’ and before every ’)’.
289           See  STATEMENTS.
290
291       -npsl, --dont-break-procedure-type
292           Put the type of a procedure on the same line as its name.
293           See  DECLARATIONS.
294
295       -nsaf, --no-space-after-for
296           Do not put a space after every for.
297           See  STATEMENTS.
298
299       -nsai, --no-space-after-if
300           Do not put a space after every if.
301           See  STATEMENTS.
302
303       -nsaw, --no-space-after-while
304           Do not put a space after every while.
305           See  STATEMENTS.
306
307       -nsc, --dont-star-comments
308           Do not put the ‘*’ character at the left of comments.
309           See  COMMENTS.
310
311       -nsob, --leave-optional-blank-lines
312           Do not swallow optional blank lines.
313           See  BLANK LINES.
314
315       -nss, --dont-space-special-semicolon
316           Do not force a space before the semicolon after certain statements.
317           Disables ‘-ss’.
318           See  STATEMENTS.
319
320       -ntac, --dont-tab-align-comments
321           Do not pad comments out to the nearest tabstop.
322           See  COMMENTS.
323
324       -nut, --no-tabs
325           Use spaces instead of tabs.
326           See  INDENTATION.
327
328       -nv, --no-verbosity
329           Disable verbose mode.
330           See  MISCELLANEOUS OPTIONS.
331
332       -orig, --original
333           Use the original Berkeley coding style.
334           See  COMMON STYLES.
335
336       -npro, --ignore-profile
337           Do not read ‘.indent.pro’ files.
338           See  INVOKING INDENT.
339
340       -pal, --pointer-align-left
341           Put asterisks in pointer declarations on the left of  spaces,  next
342           to types: ‘‘char* p’’.
343
344       -par, --pointer-align-right
345           Put  asterisks in pointer declarations on the right of spaces, next
346           to variable names: ‘‘char *p’’. This is the default behavior.
347
348       -pcs, --space-after-procedure-calls
349           Insert a space between the name of the procedure being  called  and
350           the ‘(’.
351           See  STATEMENTS.
352
353       -pin, --paren-indentationn
354           Specify  the  extra  indentation  per  open  parentheses ’(’ when a
355           statement is broken.See  STATEMENTS.
356
357       -pmt, --preserve-mtime
358           Preserve access and modification times on output files.See  MISCEL‐
359           LANEOUS OPTIONS.
360
361       -ppin, --preprocessor-indentationn
362           Specify the indentation for preprocessor conditional statements.See
363            INDENTATION.
364
365       -prs, --space-after-parentheses
366           Put a space after every ’(’ and before every ’)’.
367           See  STATEMENTS.
368
369       -psl, --procnames-start-lines
370           Put the type of a procedure on the line before its name.
371           See  DECLARATIONS.
372
373       -saf, --space-after-for
374           Put a space after each for.
375           See  STATEMENTS.
376
377       -sai, --space-after-if
378           Put a space after each if.
379           See  STATEMENTS.
380
381       -sar, --spaces-around-initializers
382           Put a space after the ‘{’ and before the ‘}’ in initializers.
383           See  DECLARATIONS.
384
385       -saw, --space-after-while
386           Put a space after each while.
387           See  STATEMENTS.
388
389       -sbin, --struct-brace-indentationn
390           Indent braces of a struct, union or enum N spaces.
391           See  STATEMENTS.
392
393       -sc, --start-left-side-of-comments
394           Put the ‘*’ character at the left of comments.
395           See  COMMENTS.
396
397       -slc, --single-line-conditionals
398           Allow for unbraced conditionals (if, else, etc.) to have their  in‐
399           ner statement on the same line.
400           See  STATEMENTS.
401
402       -sob, --swallow-optional-blank-lines
403           Swallow optional blank lines.
404           See  BLANK LINES.
405
406       -ss, --space-special-semicolon
407           On  one-line  for  and  while  statements, force a blank before the
408           semicolon.
409           See  STATEMENTS.
410
411       -st, --standard-output
412           Write to standard output.
413           See  INVOKING INDENT.
414
415       -T  Tell indent the name of typenames.
416           See  DECLARATIONS.
417
418       -tsn, --tab-sizen
419           Set tab size to n spaces.
420           See  INDENTATION.
421
422       -ut, --use-tabs
423           Use tabs. This is the default.
424           See  INDENTATION.
425
426       -v, --verbose
427           Enable verbose mode.
428           See  MISCELLANEOUS OPTIONS.
429
430       -version
431           Output the version number of indent.
432           See  MISCELLANEOUS OPTIONS.
433
434

INVOKING INDENT

436       As of version 1.3, the format of the indent command is:
437
438
439            indent [options] [input-files]
440
441            indent [options] [single-input-file] [-o output-file]
442
443
444       This format is different from earlier versions and  other  versions  of
445       indent.
446
447       In the first form, one or more input files are specified.  indent makes
448       a backup copy of each file, and the original file is replaced with  its
449       indented  version.  See BACKUP FILES, for an explanation of how backups
450       are made.
451
452       In the second form, only one input file is specified.  In this case, or
453       when  the  standard input is used, you may specify an output file after
454       the ‘-o’ option.
455
456       To cause indent to write to standard  output,  use  the  ‘-st’  option.
457       This  is  only  allowed  when there is only one input file, or when the
458       standard input is used.
459
460       If no input files are named, the standard  input  is  read  for  input.
461       Also,  if a filename named ‘-’ is specified, then the standard input is
462       read.
463
464       As an example, each of the following commands will  input  the  program
465       ‘slithy_toves.c’ and write its indented text to ‘slithy_toves.out’:
466
467
468            indent slithy_toves.c -o slithy_toves.out
469
470            indent -st slithy_toves.c > slithy_toves.out
471
472            cat slithy_toves.c | indent -o slithy_toves.out
473
474
475       Most other options to indent control how programs are formatted.  As of
476       version 1.2, indent also recognizes a long name for each  option  name.
477       Long options are prefixed by either ‘--’ or ‘+’.  [ ‘+’ is being super‐
478       seded by ‘--’ to maintain consistency with the POSIX standard.]
479        In most of this document, the traditional, short names  are  used  for
480       the  sake  of  brevity.  See OPTION SUMMARY, for a list of options, in‐
481       cluding both long and short names.
482
483       Here is another example:
484
485            indent -br test/metabolism.c -l85
486
487       This will indent the program ‘test/metabolism.c’ using  the  ‘-br’  and
488       ‘-l85’ options, write the output back to ‘test/metabolism.c’, and write
489       the original contents of ‘test/metabolism.c’ to a backup  file  in  the
490       directory ‘test’.
491
492       Equivalent  invocations  using long option names for this example would
493       be:
494
495
496            indent --braces-on-if-line --line-length185 test/metabolism.c
497
498            indent +braces-on-if-line +line-length185 test/metabolism.c
499
500
501       If you find that you often use indent with the same  options,  you  may
502       put  those  options  into a file named ‘.indent.pro’.  indent will look
503       for a profile file in three places. First it will check the environment
504       variable  INDENT_PROFILE.  If that exists its value is expected to name
505       the file that is to be used. If the environment variable does  not  ex‐
506       ist, indent looks for ‘.indent.pro’ in the current directory
507        and use that if found.  Finally indent will search your home directory
508       for ‘.indent.pro’ and use that file if it is found.  This behaviour  is
509       different  from that of other versions of indent, which load both files
510       if they both exist.
511
512       The format of ‘.indent.pro’ is simply a list of options, just  as  they
513       would  appear on the command line, separated by white space (tabs, spa‐
514       ces, and newlines).  Options in ‘.indent.pro’ may be surrounded by C or
515       C++ comments, in which case they are ignored.
516
517       Command  line switches are handled after processing ‘.indent.pro’.  Op‐
518       tions specified later override arguments specified  earlier,  with  one
519       exception:  Explicitly specified options always override background op‐
520       tions (See COMMON STYLES).  You can  prevent  indent  from  reading  an
521       ‘.indent.pro’ file by specifying the ‘-npro’ option.
522
523

BACKUP FILES

525       As  of  version  1.3, GNU indent makes GNU-style backup files, the same
526       way GNU Emacs does.  This means that either simple or  numbered  backup
527       filenames may be made.
528
529       Simple  backup  file  names  are generated by appending a suffix to the
530       original file name.  The default for this suffix is  the  one-character
531       string  ‘~’  (tilde).   Thus,  the  backup file for ‘python.c’ would be
532       ‘python.c~’.
533
534       Instead of the default, you may specify any string as a suffix by  set‐
535       ting  the  environment  variable SIMPLE_BACKUP_SUFFIX to your preferred
536       suffix.
537
538       Numbered backup  versions  of  a  file  ‘momeraths.c’  look  like  ‘mo‐
539       meraths.c.~23~’,  where  23  is  the version of this particular backup.
540       When making a numbered backup of the file ‘src/momeraths.c’, the backup
541       file  will  be named ‘src/momeraths.c.~V~’, where V is one greater than
542       the highest version currently existing in the directory ‘src’.  The en‐
543       vironment  variable  VERSION_WIDTH controls the number of digits, using
544       left zero padding when necessary.  For instance, setting this  variable
545       to "2" will lead to the backup file being named ‘momeraths.c.~04~’.
546
547       The type of backup file made is controlled by the value of the environ‐
548       ment variable VERSION_CONTROL.  If it is the string ‘simple’, then only
549       simple  backups  will  be made.  If its value is the string ‘numbered’,
550       then numbered backups will be made.  If its value  is  ‘numbered-exist‐
551       ing’,  then  numbered  backups will be made if there already exist num‐
552       bered backups for the file being indented; otherwise, a  simple  backup
553       is made.  If VERSION_CONTROL is not set, then indent assumes the behav‐
554       iour of ‘numbered-existing’.
555
556       Other versions of indent use the suffix ‘.BAK’ in naming backup  files.
557       This  behaviour  can  be  emulated  by  setting SIMPLE_BACKUP_SUFFIX to
558       ‘.BAK’.
559
560       Note also that other versions of indent make backups in the current di‐
561       rectory,  rather than in the directory of the source file as GNU indent
562       now does.
563
564

COMMON STYLES

566       There are several common styles of C code, including the GNU style, the
567       Kernighan  &  Ritchie  style, and the original Berkeley style.  A style
568       may be selected with a single background option, which specifies a  set
569       of values for all other options.  However, explicitly specified options
570       always override options implied by a background option.
571
572       As of version 1.2, the default style of GNU indent is  the  GNU  style.
573       Thus,  it is no longer necessary to specify the option ‘-gnu’ to obtain
574       this format, although doing so will not cause an  error.   Option  set‐
575       tings which correspond to the GNU style are:
576
577            -nbad -bap -nbc -bbo -bl -bli2 -bls -ncdb -nce -cp1 -cs -di2
578            -ndj -nfc1 -nfca -hnl -i2 -ip5 -lp -pcs -nprs -psl -saf -sai
579            -saw -nsc -nsob
580
581       The  GNU  coding style is that preferred by the GNU project.  It is the
582       style that the GNU Emacs C mode encourages and which is used in  the  C
583       portions  of  GNU  Emacs.   (People  interested in writing programs for
584       Project GNU should get a copy of "The GNU Coding Standards", which also
585       covers  semantic  and portability issues such as memory usage, the size
586       of integers, etc.)
587
588       The Kernighan & Ritchie style is used throughout their well-known  book
589       "The  C  Programming  Language".   It is enabled with the ‘-kr’ option.
590       The Kernighan & Ritchie style corresponds to the following set  of  op‐
591       tions:
592
593            -nbad -bap -bbo -nbc -br -brs -c33 -cd33 -ncdb -ce -ci4 -cli0
594            -cp33 -cs -d0 -di1 -nfc1 -nfca -hnl -i4 -ip0 -l75 -lp -npcs
595            -nprs -npsl -saf -sai -saw -nsc -nsob -nss -par
596
597       Kernighan & Ritchie style does not put comments to the right of code in
598       the same column at all times (nor does it use only  one  space  to  the
599       right  of  the  code),  so for this style indent has arbitrarily chosen
600       column 33.
601
602       The style of the original Berkeley indent may be obtained by specifying
603       ‘-orig’  (or  by  specifying ‘--original’, using the long option name).
604       This style is equivalent to the following settings:
605
606            -nbad -nbap -bbo -bc -br -brs -c33 -cd33 -cdb -ce -ci4 -cli0
607            -cp33 -di16 -fc1 -fca -hnl -i4 -ip4 -l75 -lp -npcs -nprs -psl
608            -saf -sai -saw -sc -nsob -nss -ts8
609
610       The Linux style is used in the linux kernel code and drivers. Code gen‐
611       erally has to follow the Linux coding style to be accepted.  This style
612       is equivalent to the following settings:
613
614            -nbad -bap -nbc -bbo -hnl -br -brs -c33 -cd33 -ncdb -ce -ci4
615            -cli0 -d0 -di1 -nfc1 -i8 -ip0 -l80 -lp -npcs -nprs -npsl -sai
616            -saf -saw -ncs -nsc -sob -nfca -cp33 -ss -ts8 -il1
617
618

BLANK LINES

620       Various programming styles use blank lines in different places.  indent
621       has  a  number  of  options to insert or delete blank lines in specific
622       places.
623
624       The ‘-bad’ option causes indent to force a blank line after every block
625       of  declarations.   The  ‘-nbad’ option causes indent not to force such
626       blank lines.
627
628       The ‘-bap’ option forces a blank line after every procedure body.   The
629       ‘-nbap’ option forces no such blank line.
630
631       The  ‘-bbb’  option forces a blank line before every boxed comment (See
632       COMMENTS.)  The ‘-nbbb’ option does not force such blank lines.
633
634       The ‘-sob’ option causes indent to swallow optional blank  lines  (that
635       is,  any optional blank lines present in the input will be removed from
636       the output).  If the ‘-nsob’ is specified, any blank lines  present  in
637       the input file will be copied to the output file.
638
639
640

--blank-lines-after-declarations

642       The  ‘-bad’  option  forces  a blank line after every block of declara‐
643       tions.  The ‘-nbad’ option does not add any such blank lines.
644
645       For example, given the input
646            char *foo;
647            char *bar;
648            /* This separates blocks of declarations.  */
649            int baz;
650
651       indent -bad produces
652
653            char *foo;
654            char *bar;
655
656            /* This separates blocks of declarations.  */
657            int baz;
658
659       and indent -nbad produces
660
661            char *foo;
662            char *bar;
663            /* This separates blocks of declarations.  */
664            int baz;
665
666

--blank-lines-after-procedures

668       The ‘-bap’ option forces a blank line after every procedure body.
669
670       For example, given the input
671
672            int
673            foo ()
674            {
675              puts("Hi");
676            }
677            /* The procedure bar is even less interesting.  */
678            char *
679            bar ()
680            {
681              puts("Hello");
682            }
683
684       indent -bap produces
685
686            int
687            foo ()
688            {
689              puts ("Hi");
690            }
691
692            /* The procedure bar is even less interesting.  */
693            char *
694            bar ()
695            {
696              puts ("Hello");
697            }
698
699       and indent -nbap produces
700
701            int
702            foo ()
703            {
704              puts ("Hi");
705            }
706            /* The procedure bar is even less interesting.  */
707            char *
708            bar ()
709            {
710              puts ("Hello");
711            }
712
713       No blank line will be added after the procedure foo.
714
715

COMMENTS

717       indent formats both C and C++ comments. C comments are begun with ‘/*’,
718       terminated  with ‘*/’ and may contain newline characters.  C++ comments
719       begin with the delimiter ‘//’ and end at the newline.
720
721       indent handles comments differently depending upon their context.   in‐
722       dent  attempts to distinguish between comments which follow statements,
723       comments which follow declarations, comments following preprocessor di‐
724       rectives,  and  comments  which  are  not preceded by code of any sort,
725       i.e., they begin the text of the line (although not necessarily in col‐
726       umn 1).
727
728       indent  further  distinguishes between comments found outside of proce‐
729       dures and aggregates, and those found within them.  In particular, com‐
730       ments beginning a line found within a procedure will be indented to the
731       column at which code is currently indented.  The exception to this is a
732       comment  beginning in the leftmost column;  such a comment is output at
733       that column.
734
735       indent attempts to leave boxed comments unmodified. The general idea of
736       such  a  comment  is  that  it is enclosed in a rectangle or ‘‘box’’ of
737       stars or dashes to visually set it apart.  More precisely,  boxed  com‐
738       ments  are defined as those in which the initial ‘/*’ is followed imme‐
739       diately by the character ‘*’, ‘=’, ‘_’, or ‘-’, or those in  which  the
740       beginning comment delimiter (‘/*’) is on a line by itself, and the fol‐
741       lowing line begins with a ‘*’ in the same column as  the  star  of  the
742       opening delimiter.
743
744       Examples of boxed comments are:
745
746            /**********************
747             * Comment in a box!! *
748             **********************/
749
750                   /*
751                    * A different kind of scent,
752                    * for a different kind of comment.
753                    */
754
755       indent  attempts  to  leave boxed comments exactly as they are found in
756       the source file.  Thus the indentation of the comment is unchanged, and
757       its length is not checked in any way.  The only alteration made is that
758       an embedded tab character may be converted into the appropriate  number
759       of spaces.
760
761       If the ‘-bbb’ option is specified, all such boxed comments will be pre‐
762       ceded by a blank line, unless such a comment is preceded by code.
763
764       Comments which are not boxed comments may  be  formatted,  which  means
765       that  the  line  is broken to fit within a right margin and left-filled
766       with whitespace.  Single newlines are equivalent to a space, but  blank
767       lines  (two  or  more  newlines in a row) are taken to mean a paragraph
768       break.  Formatting of comments which begin after the  first  column  is
769       enabled  with  the  ‘-fca’ option.  To format those beginning in column
770       one, specify ‘-fc1’.  Such formatting is disabled by default.
771
772       The right margin for formatting defaults to 78, but may be changed with
773       the  ‘-lc’  option.  If the margin specified does not allow the comment
774       to be printed, the margin will be automatically extended for the  dura‐
775       tion  of  that  comment.  The margin is not respected if the comment is
776       not being formatted.
777
778       If the ‘-fnc’ option is specified, all comments with ‘/*’ embedded will
779       have  that character sequence replaced by a space followed by the char‐
780       acter ‘*’ thus eliminating nesting.
781
782       If the comment begins a line (i.e., there is no  program  text  to  its
783       left),  it  will  be  indented to the column it was found in unless the
784       comment is within a block of code.  In that case, such a  comment  will
785       be aligned with the indented code of that block (unless the comment be‐
786       gan in the first column).  This alignment may be affected by  the  ‘-d’
787       option,  which  specifies an amount by which such comments are moved to
788       the left, or unindented.  For example, ‘-d2’ places comments two spaces
789       to  the  left of code.  By default, comments are aligned with code, un‐
790       less they begin in the first column, in which case they are left  there
791       by default --- to get them aligned with the code, specify ‘-fc1’.
792
793       Comments  to  the  right  of  code will appear by default in column 33.
794       This may be changed with one of three options.  ‘-c’ will  specify  the
795       column for comments following code, ‘-cd’ specifies the column for com‐
796       ments following declarations, and ‘-cp’ specifies the column  for  com‐
797       ments  following  preprocessor  directives  #else and #endif. ‘-dj’ to‐
798       gether with ‘-cd0’ can be used to suppress alignment of comments to the
799       right  of  declarations, causing the comment to follow one tabstop from
800       the end of the declaration. Normally ‘-cd0’ causes ‘-c’ to  become  ef‐
801       fective.
802
803       If  the  code  to the left of the comment exceeds the beginning column,
804       the comment column will be extended to the next tabstop column past the
805       end  of  the code, unless the ‘-ntac’ option is specified.  In the case
806       of preprocessor directives,comments are extended to to one  space  past
807       the  end of the directive.  This extension lasts only for the output of
808       that particular comment.
809
810       The ‘-cdb’ option places the comment delimiters on blank lines.   Thus,
811       a single line comment like /* Loving hug */ can be transformed into:
812
813            /*
814               Loving hug
815             */
816
817       Stars  can  be  placed at the beginning of multi-line comments with the
818       ‘-sc’ option.  Thus, the single-line comment above can  be  transformed
819       (with ‘-cdb -sc’) into:
820
821            /*
822             * Loving hug
823             */
824
825

STATEMENTS

827       The ‘-br’ or ‘-bl’ option specifies how to format braces.
828
829       The ‘-br’ option formats statement braces like this:
830
831            if (x > 0) {
832              x--;
833            }
834
835       The ‘-bl’ option formats them like this:
836
837            if (x > 0)
838              {
839                x--;
840              }
841
842       If  you  use  the ‘-bl’ option, you may also want to specify the ‘-bli’
843       option.  This option specifies the number of spaces by which braces are
844       indented.  ‘-bli2’, the default, gives the result shown above.  ‘-bli0’
845       results in the following:
846
847            if (x > 0)
848            {
849              x--;
850            }
851
852       If you are using the ‘-br’ option, you probably want to  also  use  the
853       ‘-ce’  option.   This  causes  the else in an if-then-else construct to
854       cuddle up to the immediately preceding ‘}’.   For  example,  with  ‘-br
855       -ce’ you get the following:
856
857            if (x > 0) {
858              x--;
859            } else {
860              fprintf (stderr, "...something wrong?\n");
861            }
862
863       With ‘-br -nce’ that code would appear as
864
865            if (x > 0) {
866              x--;
867            }
868            else {
869              fprintf (stderr, "...something wrong?\n");
870            }
871
872       An exception to the behavior occurs when there is a comment between the
873       right brace and the subsequent else statement.  While the ‘-br’  option
874       will  cause  a  left  brace to jump over the comment, the else does not
875       jump over the comment to cuddle because it has a strong  likelihood  of
876       changing the meaning of the comment.
877
878       The  ‘-cdw’  option causes the while in a do-while loop to cuddle up to
879       the immediately preceding ‘}’.  For example, with ‘-cdw’  you  get  the
880       following:
881
882            do {
883              x--;
884            } while (x);
885
886       With ‘-ncdw’ that code would appear as
887
888            do {
889              x--;
890            }
891            while (x);
892
893       The  ‘-slc’  option  allows  for  an unbraced conditional and its inner
894       statement to appear on the same line. For example:
895
896            if (x) x--;
897            else x++;
898
899       Without ‘-slc’ that code would appear as
900
901            if (x)
902              x--;
903            else
904              x++;
905
906       The ‘-cli’ option specifies the  number  of  spaces  that  case  labels
907       should be indented to the right of the containing switch statement.
908
909       The default gives code like:
910
911            switch (i)
912              {
913              case 0:
914                break;
915              case 1:
916                {
917                  ++i;
918                }
919              default:
920                break;
921              }
922
923       Using the ‘-cli2’ that would become:
924
925            switch (i)
926              {
927                case 0:
928                  break;
929                case 1:
930                  {
931                    ++i;
932                  }
933                default:
934                  break;
935              }
936
937       The  indentation of the braces below a case statement can be controlled
938       with the ‘-cbin’ option.  For example, using ‘-cli2 -cbi0’ results in:
939
940            switch (i)
941              {
942                case 0:
943                  break;
944                case 1:
945                {
946                  ++i;
947                }
948                default:
949                  break;
950              }
951
952       If a semicolon is on the same line as a for  or  while  statement,  the
953       ‘-ss’  option  will  cause  a  space to be placed before the semicolon.
954       This emphasizes the semicolon, making it clear that the body of the for
955       or  while  statement  is an empty statement.  ‘-nss’ disables this fea‐
956       ture.
957
958       The ‘-pcs’ option causes a space to be placed between the name  of  the
959       procedure  being  called  and  the ‘(’ (for example, puts ("Hi");.  The
960       ‘-npcs’ option would give puts("Hi");).
961
962
963       If the ‘-cs’ option is specified, indent puts a space  between  a  cast
964       operator and the object to be cast. The ‘-ncs’ ensures that there is no
965       space between the cast operator and the object.  Remember  that  indent
966       only  knows  about  the  standard  C data types and so cannot recognise
967       user-defined types in casts. Thus (mytype)thing is  not  treated  as  a
968       cast.
969
970       The  ‘-bs’  option  ensures  that  there is a space between the keyword
971       sizeof and its argument.  In  some  versions,  this  is  known  as  the
972       ‘Bill_Shannon’ option.
973
974       The ‘-saf’ option forces a space between a for and the following paren‐
975       thesis.  This is the default.
976
977       The ‘-sai’ option forces a space between a if and the following  paren‐
978       thesis.  This is the default.
979
980       The  ‘-saw’  option  forces  a  space between a while and the following
981       parenthesis.  This is the default.
982
983       The ‘-prs’ option causes all parentheses to be separated with  a  space
984       from  whatever  is  between them.  For example, using ‘-prs’ results in
985       code like:
986
987              while ( ( e_code - s_code ) < ( dec_ind - 1 ) )
988                {
989                  set_buf_break ( bb_dec_ind );
990                  *e_code++ = ’ ’;
991                }
992
993

DECLARATIONS

995       By default indent will line up identifiers, in the column specified  by
996       the ‘-di’ option.  For example, ‘-di16’ makes things look like:
997
998            int             foo;
999            char           *bar;
1000
1001       Using  a  small  value (such as one or two) for the ‘-di’ option can be
1002       used to cause the identifiers to be placed in the first available posi‐
1003       tion; for example:
1004
1005            int foo;
1006            char *bar;
1007
1008       The  value  given to the ‘-di’ option will still affect variables which
1009       are put on separate lines from their types,  for  example  ‘-di2’  will
1010       lead to:
1011
1012            int
1013              foo;
1014
1015       If  the ‘-bc’ option is specified, a newline is forced after each comma
1016       in a declaration.  For example,
1017
1018            int a,
1019              b,
1020              c;
1021
1022       With the ‘-nbc’ option this would look like
1023
1024            int a, b, c;
1025
1026       The ‘-bfda’ option causes a newline to be forced after the comma  sepa‐
1027       rating the arguments of a function declaration.  The arguments will ap‐
1028       pear at one indention level deeper than the function declaration.  This
1029       is  particularly  helpful  for functions with long argument lists.  The
1030       option ‘-bfde’ causes a newline to be forced before the closing bracket
1031       of  the  function  declaration. For both options the ’n’ setting is the
1032       default: -nbfda and -nbfde.
1033
1034
1035       For example,
1036
1037            void foo (int arg1, char arg2, int *arg3, long arg4, char arg5);
1038       With the ‘-bfda’ option this would look like
1039
1040            void foo (
1041                int arg1,
1042                char arg2,
1043                int *arg3,
1044                long arg4,
1045                char arg5);
1046
1047       With, in addition, the ‘-bfde’ option this would look like
1048
1049            void foo (
1050                int arg1,
1051                char arg2,
1052                int *arg3,
1053                long arg4,
1054                char arg5
1055                );
1056
1057       The ‘-psl’ option causes the type of a procedure being  defined  to  be
1058       placed on the line before the name of the procedure.  This style is re‐
1059       quired for the etags program to work correctly, as well as some of  the
1060       c-mode functions of Emacs.
1061
1062       You  must  use the ‘-T’ option to tell indent the name of all the type‐
1063       names in your program that are defined by typedef.  ‘-T’ can be  speci‐
1064       fied more than once, and all names specified are used.  For example, if
1065       your program contains
1066
1067            typedef unsigned long CODE_ADDR;
1068            typedef enum {red, blue, green} COLOR;
1069
1070       you would use the options ‘-T CODE_ADDR -T COLOR’.
1071
1072
1073       The ‘-brs’ or ‘-bls’ option specifies how to format  braces  in  struct
1074       declarations.  The ‘-brs’ option formats braces like this:
1075
1076            struct foo {
1077              int x;
1078            };
1079
1080       The ‘-bls’ option formats them like this:
1081
1082            struct foo
1083            {
1084              int x;
1085            };
1086
1087
1088       Similarly to the structure brace ‘-brs’ and ‘-bls’ options,
1089        the  function brace options ‘-brf’ or ‘-blf’ specify how to format the
1090       braces in function definitions.  The ‘-brf’ option formats braces  like
1091       this:
1092
1093            int one(void) {
1094              return 1;
1095            };
1096
1097       The ‘-blf’ option formats them like this:
1098
1099            int one(void)
1100            {
1101              return 1;
1102            };
1103
1104
1105       The  ‘-sar’  option  affects  how indent will render initializer lists.
1106       Without ‘-sar’ they are formatted like this:
1107
1108            int a[] = {1, 2, 3, 4};
1109
1110            struct s {
1111              const char *name;
1112              int x;
1113            } a[] = {
1114              {"name", 0},
1115              {"a", 1}
1116            };
1117
1118       With ‘-sar’ they are  formatted  like  this,  with  spaces  inside  the
1119       braces:
1120
1121            int a[] = { 1, 2, 3, 4 };
1122
1123            struct s {
1124              const char *name;
1125              int x;
1126            } a[] = {
1127              { "name", 0 },
1128              { "a", 1 }
1129            };
1130
1131

INDENTATION

1133       The  most basic, and most controversial issues with regard to code for‐
1134       matting is precisely how indentation should  be  acoomplished.   Fortu‐
1135       nately,  indent  supports  several different styles of identation.  The
1136       default is to use tabs for indentation, which is specified by the ‘-ut’
1137       option.  Assuming  the  default tab size of 8, the code would look like
1138       this:
1139
1140            int a(int b)
1141            {
1142                    return b;
1143            |------|
1144             1 tab
1145            }
1146
1147       For those that prefer spaces to tabs, ‘indent’ provides the ‘-nut’  op‐
1148       tion. The same code would look like this:
1149
1150            int a(int b)
1151            {
1152                    return b;
1153            |------|
1154            8 spaces
1155            }
1156
1157       Another  issue in the formatting of code is how far each line should be
1158       indented from the left margin.  When the beginning of a statement  such
1159       as  if or for is encountered, the indentation level is increased by the
1160       value specified by the ‘-i’ option.  For example, use ‘-i8’ to  specify
1161       an  eight  character  indentation  for each level.  When a statement is
1162       broken across two lines, the second line is indented by a number of ad‐
1163       ditional  spaces  specified  by the ‘-ci’ option.  ‘-ci’ defaults to 0.
1164       However, if the ‘-lp’ option is specified, and a line has a left paren‐
1165       thesis  which  is not closed on that line, then continuation lines will
1166       be lined up to start at the character  position  just  after  the  left
1167       parenthesis.   This  processing  also applies to ‘[’ and applies to ‘{’
1168       when it occurs in initialization lists.  For example, a piece  of  con‐
1169       tinued code might look like this with ‘-nlp -ci3’ in effect:
1170
1171              p1 = first_procedure (second_procedure (p2, p3),
1172                 third_procedure (p4, p5));
1173
1174       With ‘-lp’ in effect the code looks somewhat clearer:
1175
1176              p1 = first_procedure (second_procedure (p2, p3),
1177                                    third_procedure (p4, p5));
1178
1179       When  a  statement  is broken in between two or more paren pairs (...),
1180       each extra pair causes the indentation level extra indentation:
1181
1182            if ((((i < 2 &&
1183                    k > 0) || p == 0) &&
1184                q == 1) ||
1185              n = 0)
1186
1187       The option ‘-ipN’ can be used to set the extra offset per  paren.   For
1188       instance, ‘-ip0’ would format the above as:
1189
1190            if ((((i < 2 &&
1191              k > 0) || p == 0) &&
1192              q == 1) ||
1193              n = 0)
1194
1195       indent  assumes that tabs are placed at regular intervals of both input
1196       and output character streams.  These intervals are by default 8 columns
1197       wide, but (as of version 1.2) may be changed by the ‘-ts’ option.  Tabs
1198       are treated as the equivalent number of spaces.
1199
1200       By default, indent will use tabs to indent as far as possible, and then
1201       pad  with  spaces  until the desired position is reached. However, with
1202       the ‘-as’ option, spaces will be used for alignment beyond the  current
1203       indentation  level.  By  default,  assuming  ‘-lp’ is enabled, the code
1204       would be indented like so (‘t’ represents tabs, ‘s’ represents spaces):
1205
1206            unsigned long really_long_proc_name(unsigned long x, unsigned long y,
1207                                                int a)
1208            |------||-------||------||-------|__
1209               t        t       t       t     ss
1210            {
1211                    p1 = first_procedure (second_procedure (p2, p3),
1212                                          third_procedure (p4, p5));
1213            |------||------||------|_____
1214               t       t       t    sssss
1215            }
1216
1217       This is fine, if you assume that whoever is reading the code will honor
1218       your  assumption of 8-space tabs. If the reader was using 4-space tabs,
1219       it would look like this:
1220
1221            unsigned long really_long_proc_name(unsigned long x, unsigned long y,
1222                                  int a)
1223            |---||---||---||---|__
1224              t    t    t    t  ss
1225            {
1226                    p1 = first_procedure (second_procedure (p2, p3),
1227                                 third_procedure (p4, p5));
1228            |---||---||---|______
1229              t    t    t  ssssss
1230            }
1231
1232       The ‘-as’ option fixes this so that the code will appear consistent re‐
1233       gardless  of  what tab size the user users to read the code. This looks
1234       like:
1235
1236            unsigned long really_long_proc_name(unsigned long x, unsigned long y,
1237                                                int a)
1238            ____________________________________
1239            ssssssssssssssssssssssssssssssssssss
1240            {
1241                    p1 = first_procedure (second_procedure (p2, p3),
1242                                          third_procedure (p4, p5));
1243            |------|______________________
1244               t    ssssssssssssssssssssss
1245            }
1246
1247       The indentation of type declarations in old-style function  definitions
1248       is  controlled  by  the  ‘-ip’  parameter.  This is a numeric parameter
1249       specifying how many spaces to indent type declarations.   For  example,
1250       the default ‘-ip5’ makes definitions look like this:
1251
1252            char *
1253            create_world (x, y, scale)
1254                 int x;
1255                 int y;
1256                 float scale;
1257            {
1258              . . .
1259            }
1260
1261       For  compatibility  with other versions of indent, the option ‘-nip’ is
1262       provided, which is equivalent to ‘-ip0’.
1263
1264       ANSI C allows white space to be placed on  preprocessor  command  lines
1265       between the character ‘#’ and the command name.  By default, indent re‐
1266       moves this space, but specifying the ‘-lps’ option  directs  indent  to
1267       leave  this  space unmodified. The option ‘-ppi’ overrides  ‘-nlps’ and
1268       ‘-lps’.
1269
1270       This option can be used to request that preprocessor conditional state‐
1271       ments  can  be  indented by to given number of spaces, for example with
1272       the option ‘-ppi 3’
1273
1274            #if X
1275            #if Y
1276            #define Z 1
1277            #else
1278            #define Z 0
1279            #endif
1280            #endif
1281       becomes
1282            #if X
1283            #   if Y
1284            #      define Z 1
1285            #   else
1286            #      define Z 0
1287            #   endif
1288            #endif
1289
1290       This option sets the offset at which a label (except case labels)  will
1291       be  positioned.  If  it is set to zero or a positive number, this indi‐
1292       cates how far from the left margin to indent a label.  If it is set  to
1293       a  negative number, this indicates how far back from the current indent
1294       level to place the label.  The default setting is -2 which matches  the
1295       behaviour of earlier versions of indent.  Note that this parameter does
1296       not affect the placing of case labels; see  the  ‘-cli’  parameter  for
1297       that. For example with the option ‘-il 1’
1298
1299            group
1300            function()
1301            {
1302                if (do_stuff1() == ERROR)
1303                    goto cleanup1;
1304
1305                if (do_stuff2() == ERROR)
1306                    goto cleanup2;
1307
1308                return SUCCESS;
1309
1310              cleanup2:
1311                do_cleanup2();
1312
1313              cleanup1:
1314                do_cleanup1();
1315
1316                return ERROR;
1317            }
1318       becomes
1319            group
1320            function()
1321            {
1322                if (do_stuff1() == ERROR)
1323                    goto cleanup1;
1324
1325                if (do_stuff2() == ERROR)
1326                    goto cleanup2;
1327
1328                return SUCCESS;
1329
1330             cleanup2:
1331                do_cleanup2();
1332
1333             cleanup1:
1334                do_cleanup1();
1335
1336                return ERROR;
1337            }
1338
1339

BREAKING LONG LINES

1341       With  the  option ‘-ln’, or ‘--line-lengthn’, it is possible to specify
1342       the maximum length of a line of C code, not including possible comments
1343       that follow it.
1344
1345       When  lines  become  longer  than the specified line length, GNU indent
1346       tries to break the line at a logical place.  This is new as of  version
1347       2.1 however and not very intelligent or flexible yet.
1348
1349       Currently  there are three options that allow one to interfere with the
1350       algorithm that determines where to break a line.
1351
1352       The ‘-bbo’ option causes GNU indent to prefer to break long  lines  be‐
1353       fore  the  boolean  operators && and ||.  The ‘-nbbo’ option causes GNU
1354       indent not have that  preference.   For  example,  the  default  option
1355       ‘-bbo’  (together with ‘--line-length60’ and ‘--ignore-newlines’) makes
1356       code look like this:
1357
1358              if (mask
1359                  && ((mask[0] == ’\0’)
1360                      || (mask[1] == ’\0’
1361                          && ((mask[0] == ’0’) || (mask[0] == ’*’)))))
1362
1363       Using the option ‘-nbbo’ will make it look like this:
1364
1365              if (mask &&
1366                  ((mask[0] == ’\0’) ||
1367                   (mask[1] == ’\0’ &&
1368                    ((mask[0] == ’0’) || (mask[0] == ’*’)))))
1369
1370       The default ‘-hnl’, however, honours newlines in the input file by giv‐
1371       ing them the highest possible priority to break lines at.  For example,
1372       when the input file looks like this:
1373
1374              if (mask
1375                  && ((mask[0] == ’\0’)
1376                  || (mask[1] == ’\0’ && ((mask[0] == ’0’) || (mask[0] == ’*’)))))
1377
1378       then using the option ‘-hnl’, or ‘--honour-newlines’, together with the
1379       previously mentioned ‘-nbbo’ and ‘--line-length60’, will cause the out‐
1380       put not to be what is given in the last example but instead will prefer
1381       to break at the positions where the code was broken in the input file:
1382
1383              if (mask
1384                  && ((mask[0] == ’\0’)
1385                      || (mask[1] == ’\0’ &&
1386                          ((mask[0] == ’0’) || (mask[0] == ’*’)))))
1387
1388       The  idea  behind this option is that lines which are too long, but are
1389       already broken up, will not be touched by  GNU  indent.   Really  messy
1390       code  should  be  run through indent at least once using the ‘--ignore-
1391       newlines’ option though.
1392
1393       The ‘-gts’ option affects how the gettext standard macros _() and  N_()
1394       are  treated.   The default behavior (or the use of ‘-ngts’) causes in‐
1395       dent to treat them as it does other functions, so that a long string is
1396       broken like the following example.
1397
1398              if (mask)
1399                {
1400                  warning (_
1401                           ("This is a long string that stays together."));
1402                }
1403
1404       With  the  ‘-gts’  option,  the  underscore is treated as a part of the
1405       string, keeping it tied to the string, and  respecting  the  fact  that
1406       gettext is unobtrusively providing a localized string.  This only works
1407       if _(" is together as a unit at the beginning of the string and  ")  is
1408       together as a unit at the end.
1409
1410              if (mask)
1411                {
1412                  warning
1413                    (_("This is a long string that stays together."));
1414                }
1415
1416

DISABLING FORMATTING

1418       Formatting  of  C code may be disabled for portions of a program by em‐
1419       bedding special control comments in the program.  To turn  off  format‐
1420       ting for a section of a program, place the disabling control comment /*
1421       *INDENT-OFF* */ on a line by itself just before that section.   Program
1422       text  scanned  after  this control comment is output precisely as input
1423       with no modifications  until  the  corresponding  enabling  comment  is
1424       scanned  on  a line by itself.  The enabling control comment is /* *IN‐
1425       DENT-ON* */, and any text following the comment on  the  line  is  also
1426       output  unformatted.   Formatting begins again with the input line fol‐
1427       lowing the enabling control comment.
1428
1429       More precisely, indent does not attempt to verify the closing delimiter
1430       (*/)  for  these  C comments, and any whitespace on the line is totally
1431       transparent.
1432
1433       These control comments also function in their C++  formats,  namely  //
1434       *INDENT-OFF* and // *INDENT-ON*.
1435
1436       It  should be noted that the internal state of indent remains unchanged
1437       over the course of the unformatted section.  Thus, for example, turning
1438       off  formatting in the middle of a function and continuing it after the
1439       end of the function may lead to bizarre results.  It is therefore  wise
1440       to be somewhat modular in selecting code to be left unformatted.
1441
1442       As  a  historical  note, some earlier versions of indent produced error
1443       messages beginning with *INDENT**.  These versions of indent were writ‐
1444       ten  to  ignore  any  input text lines which began with such error mes‐
1445       sages.  I have removed this incestuous feature from GNU indent.
1446
1447

MISCELLANEOUS OPTIONS

1449       To find out what version of indent you have,  use  the  command  indent
1450       -version.  This will report the version number of indent, without doing
1451       any of the normal processing.
1452
1453       The ‘-v’ option can be used to turn on verbose mode.  When  in  verbose
1454       mode,  indent  reports  when  it splits one line of input into two more
1455       more lines of output, and gives some size statistics at completion.
1456
1457       The ‘-pmt’ option causes indent to preserve the access and modification
1458       times  on  the  output files.  Using this option has the advantage that
1459       running indent on all source and header files in a project won’t  cause
1460       make  to rebuild all targets.  This option is only available on Operat‐
1461       ing Systems that have the POSIX utime(2) function.
1462
1463

BUGS

1465       Please report any bugs to bug-indent@gnu.org.
1466
1467       When indent is run twice on a file, with the same  profile,  it  should
1468       never change that file the second time.  With the current design of in‐
1469       dent, this can not be guaranteed,  and  it  has  not  been  extensively
1470       tested.
1471
1472       indent does not understand C. In some cases this leads to the inability
1473       to join lines.  The result is that running a file through indent is ir‐
1474       reversible,  even  if the used input file was the result of running in‐
1475       dent with a given profile (‘.indent.pro’).
1476
1477       While an attempt was made to get indent working for C++, it will not do
1478       a good job on any C++ source except the very simplest.
1479
1480       indent  does  not look at the given ‘--line-length’ option when writing
1481       comments to the output file.  This results often in comments being  put
1482       far  to  the  right.  In order to prohibit indent from joining a broken
1483       line that has a comment at the end, make sure that the  comments  start
1484       on the first line of the break.
1485
1486       indent does not count lines and comments (see the ‘-v’ option) when in‐
1487       dent is turned off with /* *INDENT-OFF* */.
1488
1489       Comments of the form /*UPPERCASE*/ are not treated as comment but as an
1490       identifier,  causing them to be joined with the next line. This renders
1491       comments of this type useless, unless they are embedded in the code  to
1492       begin with.
1493
1494
1496       The  following  copyright  notice  applies  to the indent program.  The
1497       copyright and copying permissions for this manual appear near  the  be‐
1498       ginning of ‘indent.texinfo’ and ‘indent.info’, and near the end of ‘in‐
1499       dent.1’.
1500
1501       Copyright (c) 2015 Tim Hentenaar.
1502       Copyright (c) 2001 David Ingamells.
1503       Copyright (c) 1999 Carlo Wood.
1504       Copyright (c) 1995, 1996 Joseph Arceneaux.
1505       Copyright (c) 1989, 1992, 1993, 1994, 1995, 1996, 2014 Free Software Foundation
1506       Copyright (c) 1985 Sun Microsystems, Inc.
1507       Copyright (c) 1980 The Regents of the University of California.
1508       Copyright (c) 1976 Board of Trustees of the University of Illinois.
1509       All rights reserved.
1510
1511       Redistribution and use in source and binary forms are permitted
1512       provided that the above copyright notice and this paragraph are
1513       duplicated in all such forms and that any documentation,
1514       advertising materials, and other materials related to such
1515       distribution and use acknowledge that the software was developed
1516       by the University of California, Berkeley, the University of Illinois,
1517       Urbana, and Sun Microsystems, Inc.  The name of either University
1518       or Sun Microsystems may not be used to endorse or promote products
1519       derived from this software without specific prior written permission.
1520       THIS SOFTWARE IS PROVIDED ‘‘AS IS’’ AND WITHOUT ANY EXPRESS OR
1521       IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
1522       WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
1523       PURPOSE.
1524
1525

Options’ Cross Key

1527       Here is a list of options alphabetized by long option, to help you find
1528       the corresponding short option.
1529
1530
1531            --align-with-spaces                             -as
1532            --blank-lines-after-commas                      -bc
1533            --blank-lines-after-declarations                -bad
1534            --blank-lines-after-procedures                  -bap
1535            --blank-lines-before-block-comments             -bbb
1536            --braces-after-if-line                          -bl
1537            --braces-after-func-def-line                    -blf
1538            --brace-indent                                  -bli
1539            --braces-after-struct-decl-line                 -bls
1540            --braces-on-if-line                             -br
1541            --braces-on-func-def-line                       -brf
1542            --braces-on-struct-decl-line                    -brs
1543            --break-after-boolean-operator                  -nbbo
1544            --break-before-boolean-operator                 -bbo
1545            --break-function-decl-args                      -bfda
1546            --break-function-decl-args-end                  -bfde
1547            --case-indentation                              -clin
1548            --case-brace-indentation                        -cbin
1549            --comment-delimiters-on-blank-lines             -cdb
1550            --comment-indentation                           -cn
1551            --continuation-indentation                      -cin
1552            --continue-at-parentheses                       -lp
1553            --cuddle-do-while                               -cdw
1554            --cuddle-else                                   -ce
1555            --declaration-comment-column                    -cdn
1556            --declaration-indentation                       -din
1557            --dont-break-function-decl-args                 -nbfda
1558            --dont-break-function-decl-args-end             -nbfde
1559            --dont-break-procedure-type                     -npsl
1560            --dont-cuddle-do-while                          -ncdw
1561            --dont-cuddle-else                              -nce
1562            --dont-format-comments                          -nfca
1563            --dont-format-first-column-comments             -nfc1
1564            --dont-line-up-parentheses                      -nlp
1565            --dont-left-justify-declarations                -ndj
1566            --dont-space-special-semicolon                  -nss
1567            --dont-star-comments                            -nsc
1568            --dont-tab-align-comments                       -ntac
1569            --else-endif-column                             -cpn
1570            --format-all-comments                           -fca
1571            --format-first-column-comments                  -fc1
1572            --gnu-style                                     -gnu
1573            --honour-newlines                               -hnl
1574            --ignore-newlines                               -nhnl
1575            --ignore-profile                                -npro
1576            --indent-label                                  -iln
1577            --indent-level                                  -in
1578            --k-and-r-style                                 -kr
1579            --leave-optional-blank-lines                    -nsob
1580            --leave-preprocessor-space                      -lps
1581            --left-justify-declarations                     -dj
1582            --line-comments-indentation                     -dn
1583            --line-length                                   -ln
1584            --linux-style                                   -linux
1585            --no-blank-lines-after-commas                   -nbc
1586            --no-blank-lines-after-declarations             -nbad
1587            --no-blank-lines-after-procedures               -nbap
1588            --no-blank-lines-before-block-comments          -nbbb
1589            --no-comment-delimiters-on-blank-lines          -ncdb
1590            --no-space-after-casts                          -ncs
1591            --no-parameter-indentation                      -nip
1592            --no-space-after-for                    -nsaf
1593            --no-space-after-function-call-names            -npcs
1594            --no-space-after-if                -nsai
1595            --no-space-after-parentheses                    -nprs
1596            --no-space-after-while                  -nsaw
1597            --no-tabs                                       -nut
1598            --no-verbosity                                  -nv
1599            --original                                      -orig
1600            --parameter-indentation                         -ipn
1601            --paren-indentation                             -pin
1602            --preserve-mtime                   -pmt
1603            --preprocessor-indentation                      -ppin
1604            --procnames-start-lines                         -psl
1605            --remove-preprocessor-space                     -nlps
1606            --single-line-conditionals                      -slc
1607            --space-after-cast                              -cs
1608            --space-after-for                  -saf
1609            --space-after-if                   -sai
1610            --space-after-parentheses                       -prs
1611            --space-after-procedure-calls                   -pcs
1612            --space-after-while                -saw
1613            --space-special-semicolon                       -ss
1614            --spaces-around-initializers                    -sar
1615            --standard-output                               -st
1616            --start-left-side-of-comments                   -sc
1617            --struct-brace-indentation                      -sbin
1618            --swallow-optional-blank-lines                  -sob
1619            --tab-size                                      -tsn
1620            --use-tabs                                      -ut
1621            --verbose                                       -v
1622
1623

RETURN VALUE

1625       • 0  means no errors or warnings were found during a successful invoca‐
1626         tion of the program.
1627
1628       • 2 is returned if errors occur during formatting which do not  prevent
1629         completion  of  the formatting, but which appear to be  manifested by
1630         incorrect code (i.e. code which wouldn't compile).
1631
1632       • 3 is returned if formatting of a file is halted because of  an  error
1633         with  the  file which prevents completion of formatting. If more than
1634         one input file was specified, indent continues to the next file.
1635
1636       • 4 is returned if a serious internal problem occurs and the entire in‐
1637         dent process is terminated, even if all specified files have not been
1638         processed.
1639
1640       • 64 is returned if an invocation problem (like  an  incorrect  option)
1641         prevents any formatting to occur.
1642

FILES

1644       $HOME/.indent.pro   holds default options for indent.
1645

AUTHORS

1647       Tim Hentenaar
1648       Carlo Wood
1649       Joseph Arceneaux
1650       Jim Kingdon
1651       David Ingamells
1652

HISTORY

1654       Derived from the UCB program "indent".
1655

COPYING

1657       Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 2014, 2015 Free Soft‐
1658       ware Foundation, Inc.   Copyright  (C)  1995,  1996  Joseph  Arceneaux.
1659       Copyright  (C)  1999  Carlo  Wood.  Copyright (C) 2001 David Ingamells.
1660       Copyright (C) 2013 Łukasz Stelmach.  Copyright (C) 2015 Tim Hentenaar.
1661
1662       Permission is granted to make and distribute verbatim  copies  of  this
1663       manual  provided  the  copyright  notice and this permission notice are
1664       preserved on all copies.
1665
1666
1667
1668
1669
1670                                                                     INDENT(1)
Impressum