Debian Codegraph @

upstream/debian-unstable/man1/indent.1

raw
1 .TH INDENT 1
2 .SH "NAME"
3 indent \- changes the appearance of a C program by inserting or deleting whitespace.
4 .SH "SYNOPSIS"
5 .B "indent "
6 [options] [input\-files]
7 .sp
8 .B "indent "
9 [options] [single\-input\-file] [\-o output\-file]
10 .sp
11 .B "indent "
12 \-\-version
13 .SH "DESCRIPTION"
14 This man page is generated from the file \fIindent.texinfo\fR.
15 This is Edition of "The \fBindent\fR Manual",
16 for Indent Version , last updated .
17
18 The \fBindent\fR program
19 can be used to make code easier to read. It can also convert from one
20 style of writing C to another.
21
22 .B indent\fR understands a substantial amount about the syntax of C,
23 but it also attempts to cope with incomplete and misformed syntax.
24
25 In version 1.2 and more recent versions, the GNU style of indenting is
26 the default.
27 .SH "OPTIONS"
28
29 .TP 4
30 .B -as\fR, \fB--align-with-spaces\fR
31 If using tabs for indentation, use spaces for alignment.
32 .br
33 See \fB\ INDENTATION\fR.
34 .TP
35 .B -bad\fR, \fB--blank-lines-after-declarations\fR
36 Force blank lines after the declarations.
37 .br
38 See \fB\ BLANK\ LINES\fR.
39 .TP
40 .B -bap\fR, \fB--blank-lines-after-procedures\fR
41 Force blank lines after procedure bodies.
42 .br
43 See \fB\ BLANK\ LINES\fR.
44 .TP
45 .B -bbb\fR, \fB--blank-lines-before-block-comments\fR
46 Force blank lines before block comments.
47 .br
48 See \fB\ BLANK\ LINES\fR.
49 .TP
50 .B -bbo\fR, \fB--break-before-boolean-operator\fR
51 Prefer to break long lines before boolean operators.
52 .br
53 See \fB\ BREAKING\ LONG\ LINES\fR.
54 .TP
55 .B -bc\fR, \fB--blank-lines-after-commas\fR
56 Force newline after comma in declaration.
57 .br
58 See \fB\ DECLARATIONS\fR.
59 .TP
60 .B -bl\fR, \fB--braces-after-if-line\fR
61 Put braces on line after \fBif\fR, etc.
62 .br
63 See \fB\ STATEMENTS\fR.
64 .TP
65 .B -blf\fR, \fB--braces-after-func-def-line\fR
66 Put braces on line following function definition line.
67 .br
68 See \fB\ DECLARATIONS\fR.
69 .TP
70 .B -bli\fIn\fB\fR, \fB--brace-indent\fIn\fB\fR
71 Indent braces \fIn\fR spaces.
72 .br
73 See \fB\ STATEMENTS\fR.
74 .TP
75 .B -bls\fR, \fB--braces-after-struct-decl-line\fR
76 Put braces on the line after \fBstruct\fR declaration lines.
77 .br
78 See \fB\ DECLARATIONS\fR.
79 .TP
80 .B -br\fR, \fB--braces-on-if-line\fR
81 Put braces on line with \fBif\fR, etc.
82 .br
83 See \fB\ STATEMENTS\fR.
84 .TP
85 .B -brf\fR, \fB--braces-on-func-def-line\fR
86 Put braces on function definition line.
87 .br
88 See \fB\ DECLARATIONS\fR.
89 .TP
90 .B -brs\fR, \fB--braces-on-struct-decl-line\fR
91 Put braces on \fBstruct\fR declaration line.
92 .br
93 See \fB\ DECLARATIONS\fR.
94 .TP
95 .B -bs\fR, \fB--Bill-Shannon\fR, \fB--blank-before-sizeof\fR
96 Put a space between \fBsizeof\fR and its argument.
97 .br
98 See \fB\ STATEMENTS\fR.
99 .TP
100 .B -c\fIn\fB\fR, \fB--comment-indentation\fIn\fB\fR
101 Put comments to the right of code in column \fIn\fR.
102 .br
103 See \fB\ COMMENTS\fR.
104 .TP
105 .B -cbi\fIn\fB\fR, \fB--case-brace-indentation\fIn\fB\fR
106 Indent braces after a case label N spaces.
107 .br
108 See \fB\ STATEMENTS\fR.
109 .TP
110 .B -cd\fIn\fB\fR, \fB--declaration-comment-column\fIn\fB\fR
111 Put comments to the right of the declarations in column \fIn\fR.
112 .br
113 See \fB\ COMMENTS\fR.
114 .TP
115 .B -cdb\fR, \fB--comment-delimiters-on-blank-lines\fR
116 Put comment delimiters on blank lines.
117 .br
118 See \fB\ COMMENTS\fR.
119 .TP
120 .B -cdw\fR, \fB--cuddle-do-while\fR
121 Cuddle while of \fBdo {} while;\fR and preceding \(oq}\(cq.
122 .br
123 See \fB\ COMMENTS\fR.
124 .TP
125 .B -ce\fR, \fB--cuddle-else\fR
126 Cuddle else and preceding \(oq}\(cq.
127 .br
128 See \fB\ COMMENTS\fR.
129 .TP
130 .B -ci\fIn\fB\fR, \fB--continuation-indentation\fIn\fB\fR
131 Continuation indent of \fIn\fR spaces.
132 .br
133 See \fB\ STATEMENTS\fR.
134 .TP
135 .B -cli\fIn\fB\fR, \fB--case-indentation\fIn\fB\fR
136 Case label indent of \fIn\fR spaces.
137 .br
138 See \fB\ STATEMENTS\fR.
139 .TP
140 .B -cp\fIn\fB\fR, \fB--else-endif-column\fIn\fB\fR
141 Put comments to the right of \fB#else\fR and \fB
142 #endif\fR statements in column \fIn\fR.
143 .br
144 See \fB\ COMMENTS\fR.
145 .TP
146 .B -cs\fR, \fB--space-after-cast\fR
147 Put a space after a cast operator.
148 .br
149 See \fB\ STATEMENTS\fR.
150 .TP
151 .B -d\fIn\fB\fR, \fB--line-comments-indentation\fIn\fB\fR
152 Set indentation of comments not to the right
153 of code to \fIn\fR spaces.
154 .br
155 See \fB\ COMMENTS\fR.
156 .TP
157 .B -bfda\fR, \fB--break-function-decl-args\fR
158 Break the line before all arguments in a declaration.
159 .br
160 See \fB\ DECLARATIONS\fR.
161 .TP
162 .B -bfde\fR, \fB--break-function-decl-args-end\fR
163 Break the line after the last argument in a declaration.
164 .br
165 See \fB\ DECLARATIONS\fR.
166 .TP
167 .B -dj\fR, \fB--left-justify-declarations\fR
168 If -cd 0 is used then comments after declarations are left justified
169 behind the declaration.
170 .br
171 See \fB\ DECLARATIONS\fR.
172 .TP
173 .B -di\fIn\fB\fR, \fB--declaration-indentation\fIn\fB\fR
174 Put variables in column \fIn\fR.
175 .br
176 See \fB\ DECLARATIONS\fR.
177 .TP
178 .B -fc1\fR, \fB--format-first-column-comments\fR
179 Format comments in the first column.
180 .br
181 See \fB\ COMMENTS\fR.
182 .TP
183 .B -fca\fR, \fB--format-all-comments\fR
184 Do not disable all formatting of comments.
185 .br
186 See \fB\ COMMENTS\fR.
187 .TP
188 .B -fnc\fR, \fB--fix-nested-comments\fR
189 Fix nested comments.
190 .br
191 See \fB\ COMMENTS\fR.
192 .TP
193 .B -gnu\fR, \fB--gnu-style\fR
194 Use GNU coding style. This is the default.
195 .br
196 See \fB\ COMMON\ STYLES\fR.
197 .TP
198 .B -gts\fR, \fB--gettext-strings\fR
199 Treat gettext \fB_("...")\fR and \fBN_("...")\fR as strings rather than as functions.
200 .br
201 See \fB\ BREAKING\ LONG\ LINES\fR.
202 .TP
203 .B -hnl\fR, \fB--honour-newlines\fR
204 Prefer to break long lines at the position of newlines in the input.
205 .br
206 See \fB\ BREAKING\ LONG\ LINES\fR.
207 .TP
208 .B -i\fIn\fB\fR, \fB--indent-level\fIn\fB\fR
209 Set indentation level to \fIn\fR spaces.
210 .br
211 See \fB\ INDENTATION\fR.
212 .TP
213 .B -il\fIn\fB\fR, \fB--indent-label\fIn\fB\fR
214 Set offset for labels to column \fIn\fR.
215 .br
216 See \fB\ INDENTATION\fR.
217 .TP
218 .B -ip\fIn\fB\fR, \fB--parameter-indentation\fIn\fB\fR
219 Indent parameter types in old-style function
220 definitions by \fIn\fR spaces.
221 .br
222 See \fB\ INDENTATION\fR.
223 .TP
224 .B -kr\fR, \fB--k-and-r-style\fR
225 Use Kernighan & Ritchie coding style.
226 .br
227 See \fB\ COMMON\ STYLES\fR.
228 .TP
229 .B -l\fIn\fB\fR, \fB--line-length\fIn\fB\fR
230 Set maximum line length for non-comment lines to \fIn\fR.
231 .br
232 See \fB\ BREAKING\ LONG\ LINES\fR.
233 .TP
234 .B -lc\fIn\fB\fR, \fB--comment-line-length\fIn\fB\fR
235 Set maximum line length for comment formatting to \fIn\fR.
236 .br
237 See \fB\ COMMENTS\fR.
238 .TP
239 .B -linux\fR, \fB--linux-style\fR
240 Use Linux coding style.
241 .br
242 See \fB\ COMMON\ STYLES\fR.
243 .TP
244 .B -lp\fR, \fB--continue-at-parentheses\fR
245 Line up continued lines at parentheses.
246 .br
247 See \fB\ INDENTATION\fR.
248 .TP
249 .B -lps\fR, \fB--leave-preprocessor-space\fR
250 Leave space between \(oq#\(cq and preprocessor directive.
251 .br
252 See \fB\ INDENTATION\fR.
253 .TP
254 .B -nlps\fR, \fB--remove-preprocessor-space\fR
255 Remove space between \(oq#\(cq and preprocessor directive.
256 .br
257 See \fB\ INDENTATION\fR.
258 .TP
259 .B -nbad\fR, \fB--no-blank-lines-after-declarations\fR
260 Do not force blank lines after declarations.
261 .br
262 See \fB\ BLANK\ LINES\fR.
263 .TP
264 .B -nbap\fR, \fB--no-blank-lines-after-procedures\fR
265 Do not force blank lines after procedure bodies.
266 .br
267 See \fB\ BLANK\ LINES\fR.
268 .TP
269 .B -nbbo\fR, \fB--break-after-boolean-operator\fR
270 Do not prefer to break long lines before boolean operators.
271 .br
272 See \fB\ BREAKING\ LONG\ LINES\fR.
273 .TP
274 .B -nbc\fR, \fB--no-blank-lines-after-commas\fR
275 Do not force newlines after commas in declarations.
276 .br
277 See \fB\ DECLARATIONS\fR.
278 .TP
279 .B -nbfda\fR, \fB--dont-break-function-decl-args\fR
280 Don\(cqt put each argument in a function declaration on a separate line.
281 .br
282 See \fB\ DECLARATIONS\fR.
283 .TP
284 .B -ncdb\fR, \fB--no-comment-delimiters-on-blank-lines\fR
285 Do not put comment delimiters on blank lines.
286 .br
287 See \fB\ COMMENTS\fR.
288 .TP
289 .B -ncdw\fR, \fB--dont-cuddle-do-while\fR
290 Do not cuddle \fB}\fR and the \fBwhile\fR of a \fBdo {} while;\fR.
291 .br
292 See \fB\ STATEMENTS\fR.
293 .TP
294 .B -nce\fR, \fB--dont-cuddle-else\fR
295 Do not cuddle \fB}\fR and \fBelse\fR.
296 .br
297 See \fB\ STATEMENTS\fR.
298 .TP
299 .B -ncs\fR, \fB--no-space-after-casts\fR
300 Do not put a space after cast operators.
301 .br
302 See \fB\ STATEMENTS\fR.
303 .TP
304 .B -ndj\fIn\fB\fR, \fB--dont-left-justify-declarations\fR
305 Comments after declarations are treated the same as
306 comments after other statements.
307 .br
308 See \fB\ DECLARATIONS\fR.
309 .TP
310 .B -nfc1\fR, \fB--dont-format-first-column-comments\fR
311 Do not format comments in the first column as normal.
312 .br
313 See \fB\ COMMENTS\fR.
314 .TP
315 .B -nfca\fR, \fB--dont-format-comments\fR
316 Do not format any comments.
317 .br
318 See \fB\ COMMENTS\fR.
319 .TP
320 .B -ngts\fR, \fB--no-gettext-strings\fR
321 Treat gettext \fB_("...")\fR and \fBN_("...")\fR as normal functions. This is the default.
322 .br
323 See \fB\ BREAKING\ LONG\ LINES\fR.
324 .TP
325 .B -nhnl\fR, \fB--ignore-newlines\fR
326 Do not prefer to break long lines at the position of newlines in the input.
327 .br
328 See \fB\ BREAKING\ LONG\ LINES\fR.
329 .TP
330 .B -nip\fR, \fB--no-parameter-indentation\fR
331 Zero width indentation for parameters.
332 .br
333 See \fB\ INDENTATION\fR.
334 .TP
335 .B -nlp\fR, \fB--dont-line-up-parentheses\fR
336 Do not line up parentheses.
337 .br
338 See \fB\ STATEMENTS\fR.
339 .TP
340 .B -npcs\fR, \fB--no-space-after-function-call-names\fR
341 Do not put space after the function in function calls.
342 .br
343 See \fB\ STATEMENTS\fR.
344 .TP
345 .B -nprs\fR, \fB--no-space-after-parentheses\fR
346 Do not put a space after every \(cq(\(cq and before every \(cq)\(cq.
347 .br
348 See \fB\ STATEMENTS\fR.
349 .TP
350 .B -npsl\fR, \fB--dont-break-procedure-type\fR
351 Put the type of a procedure on the same line as its name.
352 .br
353 See \fB\ DECLARATIONS\fR.
354 .TP
355 .B -nsaf\fR, \fB--no-space-after-for\fR
356 Do not put a space after every \fBfor\fR.
357 .br
358 See \fB\ STATEMENTS\fR.
359 .TP
360 .B -nsai\fR, \fB--no-space-after-if\fR
361 Do not put a space after every \fBif\fR.
362 .br
363 See \fB\ STATEMENTS\fR.
364 .TP
365 .B -nsaw\fR, \fB--no-space-after-while\fR
366 Do not put a space after every \fBwhile\fR.
367 .br
368 See \fB\ STATEMENTS\fR.
369 .TP
370 .B -nsc\fR, \fB--dont-star-comments\fR
371 Do not put the \(oq*\(cq character at the left of comments.
372 .br
373 See \fB\ COMMENTS\fR.
374 .TP
375 .B -nsob\fR, \fB--leave-optional-blank-lines\fR
376 Do not swallow optional blank lines.
377 .br
378 See \fB\ BLANK\ LINES\fR.
379 .TP
380 .B -nss\fR, \fB--dont-space-special-semicolon\fR
381 Do not force a space before the semicolon after certain statements.
382 Disables \(oq-ss\(cq.
383 .br
384 See \fB\ STATEMENTS\fR.
385 .TP
386 .B -ntac\fR, \fB--dont-tab-align-comments\fR
387 Do not pad comments out to the nearest tabstop.
388 .br
389 See \fB\ COMMENTS\fR.
390 .TP
391 .B -nut\fR, \fB--no-tabs\fR
392 Use spaces instead of tabs.
393 .br
394 See \fB\ INDENTATION\fR.
395 .TP
396 .B -nv\fR, \fB--no-verbosity\fR
397 Disable verbose mode.
398 .br
399 See \fB\ MISCELLANEOUS\ OPTIONS\fR.
400 .TP
401 .B -orig\fR, \fB--original\fR
402 Use the original Berkeley coding style.
403 .br
404 See \fB\ COMMON\ STYLES\fR.
405 .TP
406 .B -npro\fR, \fB--ignore-profile\fR
407 Do not read \(oq.indent.pro\(cq files.
408 .br
409 See \fB\ INVOKING\ INDENT\fR.
410 .TP
411 .B -pal\fR, \fB--pointer-align-left\fR
412 Put asterisks in pointer declarations on the left of spaces, next to
413 types: \(oq\(oqchar* p\(cq\(cq.
414 .TP
415 .B -par\fR, \fB--pointer-align-right\fR
416 Put asterisks in pointer declarations on the right of spaces, next to
417 variable names: \(oq\(oqchar *p\(cq\(cq. This is the default behavior.
418 .TP
419 .B -pcs\fR, \fB--space-after-procedure-calls\fR
420 Insert a space between the name of the
421 procedure being called and the \(oq(\(cq.
422 .br
423 See \fB\ STATEMENTS\fR.
424 .TP
425 .B -pi\fIn\fB\fR, \fB--paren-indentation\fIn\fB\fR
426 Specify the extra indentation per open parentheses \(cq(\(cq when a
427 statement is broken.See \fB\ STATEMENTS\fR.
428 .TP
429 .B -pmt\fR, \fB--preserve-mtime\fR
430 Preserve access and modification times on output files.See \fB\ MISCELLANEOUS\ OPTIONS\fR.
431 .TP
432 .B -ppi\fIn\fB\fR, \fB--preprocessor-indentation\fIn\fB\fR
433 Specify the indentation for preprocessor conditional statements.See \fB\ INDENTATION\fR.
434 .TP
435 .B -prs\fR, \fB--space-after-parentheses\fR
436 Put a space after every \(cq(\(cq and before every \(cq)\(cq.
437 .br
438 See \fB\ STATEMENTS\fR.
439 .TP
440 .B -psl\fR, \fB--procnames-start-lines\fR
441 Put the type of a procedure on the line before its name.
442 .br
443 See \fB\ DECLARATIONS\fR.
444 .TP
445 .B -saf\fR, \fB--space-after-for\fR
446 Put a space after each \fBfor\fR.
447 .br
448 See \fB\ STATEMENTS\fR.
449 .TP
450 .B -sai\fR, \fB--space-after-if\fR
451 Put a space after each \fBif\fR.
452 .br
453 See \fB\ STATEMENTS\fR.
454 .TP
455 .B -sar\fR, \fB--spaces-around-initializers\fR
456 Put a space after the \(oq{\(cq and before the \(oq}\(cq in initializers.
457 .br
458 See \fB\ DECLARATIONS\fR.
459 .TP
460 .B -saw\fR, \fB--space-after-while\fR
461 Put a space after each \fBwhile\fR.
462 .br
463 See \fB\ STATEMENTS\fR.
464 .TP
465 .B -sbi\fIn\fB\fR, \fB--struct-brace-indentation\fIn\fB\fR
466 Indent braces of a struct, union or enum N spaces.
467 .br
468 See \fB\ STATEMENTS\fR.
469 .TP
470 .B -sc\fR, \fB--start-left-side-of-comments\fR
471 Put the \(oq*\(cq character at the left of comments.
472 .br
473 See \fB\ COMMENTS\fR.
474 .TP
475 .B -slc\fR, \fB--single-line-conditionals\fR
476 Allow for unbraced conditionals (\fBif\fR, \fBelse\fR, etc.) to have
477 their inner statement on the same line.
478 .br
479 See \fB\ STATEMENTS\fR.
480 .TP
481 .B -sob\fR, \fB--swallow-optional-blank-lines\fR
482 Swallow optional blank lines.
483 .br
484 See \fB\ BLANK\ LINES\fR.
485 .TP
486 .B -ss\fR, \fB--space-special-semicolon\fR
487 On one-line \fBfor\fR and \fBwhile\fR statements,
488 force a blank before the semicolon.
489 .br
490 See \fB\ STATEMENTS\fR.
491 .TP
492 .B -st\fR, \fB--standard-output\fR
493 Write to standard output.
494 .br
495 See \fB\ INVOKING\ INDENT\fR.
496 .TP
497 .B -T\fR
498 Tell \fBindent\fR the name of typenames.
499 .br
500 See \fB\ DECLARATIONS\fR.
501 .TP
502 .B -ts\fIn\fB\fR, \fB--tab-size\fIn\fB\fR
503 Set tab size to \fIn\fR spaces.
504 .br
505 See \fB\ INDENTATION\fR.
506 .TP
507 .B -ut\fR, \fB--use-tabs\fR
508 Use tabs. This is the default.
509 .br
510 See \fB\ INDENTATION\fR.
511 .TP
512 .B -v\fR, \fB--verbose\fR
513 Enable verbose mode.
514 .br
515 See \fB\ MISCELLANEOUS\ OPTIONS\fR.
516 .TP
517 .B -version\fR
518 Output the version number of \fBindent\fR.
519 .br
520 See \fB\ MISCELLANEOUS\ OPTIONS\fR.
521
522 .SH "INVOKING INDENT"
523
524 As of version 1.3, the format of the \fBindent\fR command is:
525
526 .in +5
527 .nf
528 .na
529
530 indent [\fIoptions\fR] [\fIinput-files\fR]
531
532 indent [\fIoptions\fR] [\fIsingle-input-file\fR] [-o \fIoutput-file\fR]
533
534 .in -5
535 .ad
536 .fi
537
538 This format is different from earlier versions and other versions of
539 .B indent\fR.
540
541 In the first form, one or more input files are specified. \fBindent\fR
542 makes a backup copy of each file, and the original file is replaced with
543 its indented version. See \fBBACKUP\ FILES\fR, for an explanation of how
544 backups are made.
545
546 In the second form, only one input file is specified. In this case, or
547 when the standard input is used, you may specify an output file after
548 the \(oq-o\(cq option.
549
550 To cause \fBindent\fR to write to standard output, use the \(oq-st\(cq
551 option. This is only allowed when there is only one input file, or when
552 the standard input is used.
553
554 If no input files are named, the standard input is read for input.
555 Also, if a filename named \(oq-\(cq is specified, then the standard input
556 is read.
557
558 As an example, each of the following commands will input the program
559 \(oqslithy_toves.c\(cq and write its indented text to
560 \(oqslithy_toves.out\(cq:
561
562 .in +5
563 .nf
564 .na
565
566 indent slithy_toves.c -o slithy_toves.out
567
568 indent -st slithy_toves.c > slithy_toves.out
569
570 cat slithy_toves.c | indent -o slithy_toves.out
571
572 .in -5
573 .ad
574 .fi
575
576 Most other options to \fBindent\fR control how programs are formatted.
577 As of version 1.2, \fBindent\fR also recognizes a long name for each
578 option name. Long options are prefixed by either \(oq--\(cq or
579 \(oq+\(cq.
580 [ \(oq+\(cq is being superseded by \(oq--\(cq to
581 maintain consistency with the POSIX standard.]
582 In most of this document,
583 the traditional, short names are used for the sake of brevity.
584 See \fBOPTION\ SUMMARY\fR, for a list of options, including both long and
585 short names.
586
587 Here is another example:
588
589 .in +5
590 .nf
591 .na
592 indent -br test/metabolism.c -l85
593 .in -5
594 .ad
595 .fi
596
597 This will indent the program \(oqtest/metabolism.c\(cq using the
598 \(oq-br\(cq and \(oq-l85\(cq options, write the output back to
599 \(oqtest/metabolism.c\(cq, and write the original contents of
600 \(oqtest/metabolism.c\(cq to a backup file in the directory \(oqtest\(cq.
601
602 Equivalent invocations using long option names for this example would
603 be:
604
605 .in +5
606 .nf
607 .na
608
609 indent --braces-on-if-line --line-length185 test/metabolism.c
610
611 indent +braces-on-if-line +line-length185 test/metabolism.c
612
613 .in -5
614 .ad
615 .fi
616
617 If you find that you often use \fBindent\fR with the same options, you
618 may put those options into a file named \(oq.indent.pro\(cq.
619 .B indent\fR will look for a profile file in three places. First it will check
620 the environment variable \fBINDENT_PROFILE\fR. If that exists its value
621 is expected to name the file that is to be used. If the environment variable does
622 not exist, indent looks for \(oq.indent.pro\(cq in the current directory
623 and use that if found. Finally \fBindent\fR will search
624 your home directory for \(oq.indent.pro\(cq and use that file if it is
625 found. This behaviour is different from that of other versions of
626 .B indent\fR, which load both files if they both exist.
627
628 The format of \(oq.indent.pro\(cq is simply a list of options, just as
629 they would appear on the command line, separated by white space (tabs,
630 spaces, and newlines). Options in \(oq.indent.pro\(cq may be surrounded by C
631 or C++ comments, in which case they are ignored.
632
633 Command line switches are handled \fIafter\fR processing
634 \(oq .indent.pro\(cq. Options specified later override arguments
635 specified earlier, with one exception: Explicitly specified options
636 always override background options (See \fBCOMMON\ STYLES\fR). You can
637 prevent \fBindent\fR from reading an \(oq.indent.pro\(cq file by
638 specifying the \(oq-npro\(cq option.
639
640 .SH "BACKUP FILES"
641
642 As of version 1.3, GNU \fBindent\fR makes GNU-style backup files, the
643 same way GNU Emacs does. This means that either \fIsimple\fR or
644 .I numbered\fR backup filenames may be made.
645
646 Simple backup file names are generated by appending a suffix to the
647 original file name. The default for this suffix is the
648 one-character string \(oq~\(cq (tilde). Thus, the backup file for
649 \(oqpython.c\(cq would be \(oqpython.c~\(cq.
650
651 Instead of the default, you may specify any string as a suffix by
652 setting the environment variable \fBSIMPLE_BACKUP_SUFFIX\fR to
653 your preferred suffix.
654
655 Numbered backup versions of a file \(oqmomeraths.c\(cq look like
656 \(oqmomeraths.c.~23~\(cq, where 23 is the version of this particular
657 backup. When making a numbered backup of the file \(oqsrc/momeraths.c\(cq,
658 the backup file will be named \(oqsrc/momeraths.c.~\fIV\fR~\(cq, where
659 .I V\fR is one greater than the highest version currently existing in
660 the directory \(oqsrc\(cq. The environment variable \fBVERSION_WIDTH\fR
661 controls the number of digits, using left zero padding when necessary.
662 For instance, setting this variable to "2" will lead to the backup
663 file being named \(oqmomeraths.c.~04~\(cq.
664
665 The type of backup file made is controlled by the value of the
666 environment variable \fBVERSION_CONTROL\fR. If it is the string
667 \(oqsimple\(cq, then only simple backups will be made. If its value is
668 the string \(oqnumbered\(cq, then numbered backups will be made. If its
669 value is \(oqnumbered-existing\(cq, then numbered backups will be made if
670 there \fIalready exist\fR numbered backups for the file being indented;
671 otherwise, a simple backup is made. If \fBVERSION_CONTROL\fR is not
672 set, then \fBindent\fR assumes the behaviour of
673 \(oqnumbered-existing\(cq.
674
675 Other versions of \fBindent\fR use the suffix \(oq.BAK\(cq in naming
676 backup files. This behaviour can be emulated by setting
677 .B SIMPLE_BACKUP_SUFFIX\fR to \(oq.BAK\(cq.
678
679 Note also that other versions of \fBindent\fR make backups in the
680 current directory, rather than in the directory of the source file as
681 GNU \fBindent\fR now does.
682
683 .SH "COMMON STYLES"
684
685 There are several common styles of C code, including the GNU style, the
686 Kernighan & Ritchie style, and the original Berkeley style. A style may
687 be selected with a single \fIbackground\fR option, which specifies a set
688 of values for all other options. However, explicitly specified options
689 always override options implied by a background option.
690
691 As of version 1.2, the default style of GNU \fBindent\fR is the GNU
692 style. Thus, it is no longer necessary to specify the option
693 \(oq-gnu\(cq to obtain this format, although doing so will not cause an
694 error. Option settings which correspond to the GNU style are:
695
696 .in +5
697 .nf
698 .na
699 -nbad -bap -nbc -bbo -bl -bli2 -bls -ncdb -nce -cp1 -cs -di2
700 -ndj -nfc1 -nfca -hnl -i2 -ip5 -lp -pcs -nprs -psl -saf -sai
701 -saw -nsc -nsob
702 .in -5
703 .ad
704 .fi
705
706 The GNU coding style is that preferred by the GNU project. It is the
707 style that the GNU Emacs C mode encourages and which is used in the C
708 portions of GNU Emacs. (People interested in writing programs for
709 Project GNU should get a copy of "The GNU Coding Standards", which
710 also covers semantic and portability issues such as memory usage, the
711 size of integers, etc.)
712
713 The Kernighan & Ritchie style is used throughout their well-known book
714 "The C Programming Language". It is enabled with the \(oq-kr\(cq
715 option. The Kernighan & Ritchie style corresponds to the following set
716 of options:
717
718 .in +5
719 .nf
720 .na
721 -nbad -bap -bbo -nbc -br -brs -c33 -cd33 -ncdb -ce -ci4 -cli0
722 -cp33 -cs -d0 -di1 -nfc1 -nfca -hnl -i4 -ip0 -l75 -lp -npcs
723 -nprs -npsl -saf -sai -saw -nsc -nsob -nss -par
724 .in -5
725 .ad
726 .fi
727
728 Kernighan & Ritchie style does not put comments to the right of code in
729 the same column at all times (nor does it use only one space to the
730 right of the code), so for this style \fBindent\fR has arbitrarily
731 chosen column 33.
732
733 The style of the original Berkeley \fBindent\fR may be obtained by
734 specifying \(oq-orig\(cq (or by specifying \(oq--original\(cq, using the
735 long option name). This style is equivalent to the following settings:
736
737 .in +5
738 .nf
739 .na
740 -nbad -nbap -bbo -bc -br -brs -c33 -cd33 -cdb -ce -ci4 -cli0
741 -cp33 -di16 -fc1 -fca -hnl -i4 -ip4 -l75 -lp -npcs -nprs -psl
742 -saf -sai -saw -sc -nsob -nss -ts8
743 .in -5
744 .ad
745 .fi
746
747 The Linux style is used in the linux kernel code and drivers. Code
748 generally has to follow the Linux coding style to be accepted.
749 This style is equivalent to the following settings:
750
751 .in +5
752 .nf
753 .na
754 -nbad -bap -nbc -bbo -hnl -br -brs -c33 -cd33 -ncdb -ce -ci4
755 -cli0 -d0 -di1 -nfc1 -i8 -ip0 -l80 -lp -npcs -nprs -npsl -sai
756 -saf -saw -ncs -nsc -sob -nfca -cp33 -ss -ts8 -il1
757 .in -5
758 .ad
759 .fi
760
761 .SH "BLANK LINES"
762
763 Various programming styles use blank lines in different places.
764 .B indent\fR has a number of options to insert or delete blank lines in
765 specific places.
766
767 The \(oq-bad\(cq option causes \fBindent\fR to force a blank line after
768 every block of declarations. The \(oq-nbad\(cq option causes
769 .B indent\fR not to force such blank lines.
770
771 The \(oq-bap\(cq option forces a blank line after every procedure body.
772 The \(oq-nbap\(cq option forces no such blank line.
773
774 The \(oq-bbb\(cq option forces a blank line before every boxed comment
775 (See \fBCOMMENTS\fR.)
776 The \(oq-nbbb\(cq option does not force such blank lines.
777
778 The \(oq-sob\(cq option causes \fBindent\fR to swallow optional blank
779 lines (that is, any optional blank lines present in the input will be
780 removed from the output). If the \(oq-nsob\(cq is specified, any blank
781 lines present in the input file will be copied to the output file.
782
783
784 .SH "--blank-lines-after-declarations"
785
786 The \(oq-bad\(cq option forces a blank line after every block of
787 declarations. The \(oq-nbad\(cq option does not add any such blank
788 lines.
789
790 For example, given the input
791 .in +5
792 .nf
793 .na
794 char *foo;
795 char *bar;
796 /* This separates blocks of declarations. */
797 int baz;
798 .in -5
799 .ad
800 .fi
801
802 .B indent -bad\fR produces
803
804 .in +5
805 .nf
806 .na
807 char *foo;
808 char *bar;
809
810 /* This separates blocks of declarations. */
811 int baz;
812 .in -5
813 .ad
814 .fi
815
816 and \fBindent -nbad\fR produces
817
818 .in +5
819 .nf
820 .na
821 char *foo;
822 char *bar;
823 /* This separates blocks of declarations. */
824 int baz;
825 .in -5
826 .ad
827 .fi
828
829 .SH "--blank-lines-after-procedures"
830
831 The \(oq-bap\(cq option forces a blank line after every procedure body.
832
833 For example, given the input
834
835 .in +5
836 .nf
837 .na
838 int
839 foo ()
840 {
841 puts("Hi");
842 }
843 /* The procedure bar is even less interesting. */
844 char *
845 bar ()
846 {
847 puts("Hello");
848 }
849 .in -5
850 .ad
851 .fi
852
853 .B indent -bap\fR produces
854
855 .in +5
856 .nf
857 .na
858 int
859 foo ()
860 {
861 puts ("Hi");
862 }
863
864 /* The procedure bar is even less interesting. */
865 char *
866 bar ()
867 {
868 puts ("Hello");
869 }
870 .in -5
871 .ad
872 .fi
873
874 and \fBindent -nbap\fR produces
875
876 .in +5
877 .nf
878 .na
879 int
880 foo ()
881 {
882 puts ("Hi");
883 }
884 /* The procedure bar is even less interesting. */
885 char *
886 bar ()
887 {
888 puts ("Hello");
889 }
890 .in -5
891 .ad
892 .fi
893
894 No blank line will be added after the procedure \fBfoo\fR.
895
896 .SH "COMMENTS"
897
898 .B indent\fR formats both C and C++ comments. C comments are begun with
899 \(oq/*\(cq, terminated with \(oq*/\(cq and may contain newline characters.
900 C++ comments begin with the delimiter \(oq//\(cq and end at the newline.
901
902 .B indent\fR handles comments differently depending upon their context.
903 .B indent\fR attempts to distinguish between comments which follow
904 statements, comments which follow declarations, comments following
905 preprocessor directives, and comments which are not preceded by code of
906 any sort, i.e., they begin the text of the line (although not
907 necessarily in column 1).
908
909 .B indent\fR further distinguishes between comments found outside of
910 procedures and aggregates, and those found within them. In particular,
911 comments beginning a line found within a procedure will be indented to
912 the column at which code is currently indented. The exception to this
913 is a comment beginning in the leftmost column; such a comment is output
914 at that column.
915
916 .B indent\fR attempts to leave \fIboxed comments\fR unmodified. The
917 general idea of such a comment is that it is enclosed in a rectangle or
918 \(oq\(oqbox\(cq\(cq of stars or dashes to visually set it apart. More precisely,
919 boxed comments are defined as those in which the initial \(oq/*\(cq is
920 followed immediately by the character \(oq*\(cq, \(oq=\(cq, \(oq_\(cq, or
921 \(oq-\(cq, or those in which the beginning comment delimiter (\(oq/*\(cq)
922 is on a line by itself, and the following line begins with a \(oq*\(cq in
923 the same column as the star of the opening delimiter.
924
925 Examples of boxed comments are:
926
927 .in +5
928 .nf
929 .na
930 /**********************
931 * Comment in a box!! *
932 **********************/
933
934 /*
935 * A different kind of scent,
936 * for a different kind of comment.
937 */
938 .in -5
939 .ad
940 .fi
941
942 .B indent\fR attempts to leave boxed comments exactly as they are found
943 in the source file. Thus the indentation of the comment is unchanged,
944 and its length is not checked in any way. The only alteration made is
945 that an embedded tab character may be converted into the appropriate
946 number of spaces.
947
948 If the \(oq-bbb\(cq option is specified, all such boxed comments will be
949 preceded by a blank line, unless such a comment is preceded by code.
950
951 Comments which are not boxed comments may be formatted, which means that
952 the line is broken to fit within a right margin and left-filled with
953 whitespace. Single newlines are equivalent to a space, but blank lines
954 (two or more newlines in a row) are taken to mean a paragraph break.
955 Formatting of comments which begin after the first column is enabled
956 with the \(oq-fca\(cq option. To format those beginning in column one,
957 specify \(oq-fc1\(cq. Such formatting is disabled by default.
958
959 The right margin for formatting defaults to 78, but may be changed with
960 the \(oq-lc\(cq option. If the margin specified does not allow the
961 comment to be printed, the margin will be automatically extended for the
962 duration of that comment. The margin is not respected if the comment is
963 not being formatted.
964
965 If the \(oq-fnc\(cq option is specified, all comments with \(oq/*\(cq
966 embedded will have that character sequence replaced by a space followed
967 by the character \(oq*\(cq thus eliminating nesting.
968
969 If the comment begins a line (i.e., there is no program text to its
970 left), it will be indented to the column it was found in unless the
971 comment is within a block of code. In that case, such a comment will be
972 aligned with the indented code of that block (unless the comment began
973 in the first column). This alignment may be affected by the \(oq-d\(cq
974 option, which specifies an amount by which such comments are moved to
975 the \fIleft\fR, or unindented. For example, \(oq-d2\(cq places comments
976 two spaces to the left of code. By default, comments are aligned with
977 code, unless they begin in the first column, in which case they are left
978 there by default --- to get them aligned with the code, specify \(oq-fc1\(cq.
979
980 Comments to the right of code will appear by default in column 33.
981 This may be changed with one of three options. \(oq-c\(cq will specify
982 the column for comments following code, \(oq-cd\(cq specifies the
983 column for comments following declarations, and \(oq-cp\(cq specifies
984 the column for comments following preprocessor directives \fB#else\fR
985 and \fB#endif\fR. \(oq-dj\(cq together with \(oq-cd0\(cq can be used
986 to suppress alignment of comments to the right of declarations, causing the
987 comment to follow one tabstop from the end of the declaration. Normally \(oq-cd0\(cq
988 causes \(oq-c\(cq to become effective.
989
990 If the code to the left of the comment exceeds the beginning column,
991 the comment column will be extended to the next tabstop column past
992 the end of the code, unless the \(oq-ntac\(cq option is specified.
993 In the case of preprocessor directives,comments are extended to to one
994 space past the end of the directive. This extension lasts only for
995 the output of that particular comment.
996
997 The \(oq-cdb\(cq option places the comment delimiters on blank lines.
998 Thus, a single line comment like \fB/* Loving hug */\fR can be
999 transformed into:
1000
1001 .in +5
1002 .nf
1003 .na
1004 /*
1005 Loving hug
1006 */
1007 .in -5
1008 .ad
1009 .fi
1010
1011 Stars can be placed at the beginning of multi-line comments with the
1012 \(oq-sc\(cq option. Thus, the single-line comment above can be
1013 transformed (with \(oq-cdb -sc\(cq) into:
1014
1015 .in +5
1016 .nf
1017 .na
1018 /*
1019 * Loving hug
1020 */
1021 .in -5
1022 .ad
1023 .fi
1024
1025 .SH "STATEMENTS"
1026
1027 The \(oq-br\(cq or \(oq-bl\(cq option specifies how to format braces.
1028
1029 The \(oq-br\(cq option formats statement braces like this:
1030
1031 .in +5
1032 .nf
1033 .na
1034 if (x > 0) {
1035 x--;
1036 }
1037 .in -5
1038 .ad
1039 .fi
1040
1041 The \(oq-bl\(cq option formats them like this:
1042
1043 .in +5
1044 .nf
1045 .na
1046 if (x > 0)
1047 {
1048 x--;
1049 }
1050 .in -5
1051 .ad
1052 .fi
1053
1054 If you use the \(oq-bl\(cq option, you may also want to specify the
1055 \(oq-bli\(cq option. This option specifies the number of spaces by
1056 which braces are indented. \(oq-bli2\(cq, the default, gives the
1057 result shown above. \(oq-bli0\(cq results in the following:
1058
1059 .in +5
1060 .nf
1061 .na
1062 if (x > 0)
1063 {
1064 x--;
1065 }
1066 .in -5
1067 .ad
1068 .fi
1069
1070 If you are using the \(oq-br\(cq option, you probably want to also use
1071 the \(oq-ce\(cq option. This causes the \fBelse\fR in an if-then-else
1072 construct to cuddle up to the immediately preceding \(oq}\(cq. For
1073 example, with \(oq-br -ce\(cq you get the following:
1074
1075 .in +5
1076 .nf
1077 .na
1078 if (x > 0) {
1079 x--;
1080 } else {
1081 fprintf (stderr, "...something wrong?\\n");
1082 }
1083 .in -5
1084 .ad
1085 .fi
1086
1087 With \(oq-br -nce\(cq that code would appear as
1088
1089 .in +5
1090 .nf
1091 .na
1092 if (x > 0) {
1093 x--;
1094 }
1095 else {
1096 fprintf (stderr, "...something wrong?\\n");
1097 }
1098 .in -5
1099 .ad
1100 .fi
1101
1102 An exception to the behavior occurs when there is a comment between the
1103 right brace and the subsequent else statement. While the \(oq-br\(cq
1104 option will cause a left brace to jump over the comment, the else does
1105 not jump over the comment to cuddle because it has a strong likelihood
1106 of changing the meaning of the comment.
1107
1108 The \(oq-cdw\(cq option causes the \fBwhile\fR in a do-while
1109 loop to cuddle up to the immediately preceding \(oq}\(cq. For
1110 example, with \(oq-cdw\(cq you get the following:
1111
1112 .in +5
1113 .nf
1114 .na
1115 do {
1116 x--;
1117 } while (x);
1118 .in -5
1119 .ad
1120 .fi
1121
1122 With \(oq-ncdw\(cq that code would appear as
1123
1124 .in +5
1125 .nf
1126 .na
1127 do {
1128 x--;
1129 }
1130 while (x);
1131 .in -5
1132 .ad
1133 .fi
1134
1135 The \(oq-slc\(cq option allows for an unbraced conditional and its inner
1136 statement to appear on the same line. For example:
1137
1138 .in +5
1139 .nf
1140 .na
1141 if (x) x--;
1142 else x++;
1143 .in -5
1144 .ad
1145 .fi
1146
1147 Without \(oq-slc\(cq that code would appear as
1148
1149 .in +5
1150 .nf
1151 .na
1152 if (x)
1153 x--;
1154 else
1155 x++;
1156 .in -5
1157 .ad
1158 .fi
1159
1160 The \(oq-cli\(cq option specifies the number of spaces that case labels
1161 should be indented to the right of the containing \fBswitch\fR
1162 statement.
1163
1164 The default gives code like:
1165
1166 .in +5
1167 .nf
1168 .na
1169 switch (i)
1170 {
1171 case 0:
1172 break;
1173 case 1:
1174 {
1175 ++i;
1176 }
1177 default:
1178 break;
1179 }
1180 .in -5
1181 .ad
1182 .fi
1183
1184 Using the \(oq-cli2\(cq that would become:
1185
1186 .in +5
1187 .nf
1188 .na
1189 switch (i)
1190 {
1191 case 0:
1192 break;
1193 case 1:
1194 {
1195 ++i;
1196 }
1197 default:
1198 break;
1199 }
1200 .in -5
1201 .ad
1202 .fi
1203
1204 The indentation of the braces below a case statement can be
1205 controlled with the \(oq-cbi\fIn\fR\(cq option. For example,
1206 using \(oq-cli2 -cbi0\(cq results in:
1207
1208 .in +5
1209 .nf
1210 .na
1211 switch (i)
1212 {
1213 case 0:
1214 break;
1215 case 1:
1216 {
1217 ++i;
1218 }
1219 default:
1220 break;
1221 }
1222 .in -5
1223 .ad
1224 .fi
1225
1226 If a semicolon is on the same line as a \fBfor\fR or \fBwhile\fR
1227 statement, the \(oq-ss\(cq option will cause a space to be placed before
1228 the semicolon. This emphasizes the semicolon, making it clear that the
1229 body of the \fBfor\fR or \fBwhile\fR statement is an empty statement.
1230 \(oq-nss\(cq disables this feature.
1231
1232 The \(oq-pcs\(cq option causes a space to be placed between the name of
1233 the procedure being called and the \(oq(\(cq (for example, \fBputs\ ("Hi");\fR. The \(oq-npcs\(cq option would give \fBputs("Hi");\fR).
1234
1235
1236 If the \(oq-cs\(cq option is specified, \fBindent\fR puts a space between
1237 a cast operator and the object to be cast. The \(oq-ncs\(cq ensures that there
1238 is no space between the cast operator and the object. Remember that \fBindent\fR
1239 only knows about the standard C data types and so cannot recognise user-defined types
1240 in casts. Thus \fB(mytype)thing\fR is not treated as a cast.
1241
1242 The \(oq-bs\(cq option ensures that there is a space between the
1243 keyword \fBsizeof\fR and its argument. In some versions, this is
1244 known as the \(oqBill_Shannon\(cq option.
1245
1246 The \(oq-saf\(cq option forces a space between a \fBfor\fR
1247 and the following parenthesis. This is the default.
1248
1249 The \(oq-sai\(cq option forces a space between a \fBif\fR
1250 and the following parenthesis. This is the default.
1251
1252 The \(oq-saw\(cq option forces a space between a \fBwhile\fR
1253 and the following parenthesis. This is the default.
1254
1255 The \(oq-prs\(cq option causes all parentheses to be separated with
1256 a space from whatever is between them. For example, using \(oq-prs\(cq
1257 results in code like:
1258
1259 .in +5
1260 .nf
1261 .na
1262 while ( ( e_code - s_code ) < ( dec_ind - 1 ) )
1263 {
1264 set_buf_break ( bb_dec_ind );
1265 *e_code++ = \(cq \(cq;
1266 }
1267 .in -5
1268 .ad
1269 .fi
1270
1271 .SH "DECLARATIONS"
1272
1273 By default \fBindent\fR will line up identifiers, in the column
1274 specified by the \(oq-di\(cq option. For example, \(oq-di16\(cq makes
1275 things look like:
1276
1277 .in +5
1278 .nf
1279 .na
1280 int foo;
1281 char *bar;
1282 .in -5
1283 .ad
1284 .fi
1285
1286 Using a small value (such as one or two) for the \(oq-di\(cq option can
1287 be used to cause the identifiers to be placed in the first available
1288 position; for example:
1289
1290 .in +5
1291 .nf
1292 .na
1293 int foo;
1294 char *bar;
1295 .in -5
1296 .ad
1297 .fi
1298
1299 The value given to the \(oq-di\(cq option will still affect variables
1300 which are put on separate lines from their types, for example
1301 \(oq-di2\(cq will lead to:
1302
1303 .in +5
1304 .nf
1305 .na
1306 int
1307 foo;
1308 .in -5
1309 .ad
1310 .fi
1311
1312 If the \(oq-bc\(cq option is specified, a newline is forced after each
1313 comma in a declaration. For example,
1314
1315 .in +5
1316 .nf
1317 .na
1318 int a,
1319 b,
1320 c;
1321 .in -5
1322 .ad
1323 .fi
1324
1325 With the \(oq-nbc\(cq option this would look like
1326
1327 .in +5
1328 .nf
1329 .na
1330 int a, b, c;
1331 .in -5
1332 .ad
1333 .fi
1334
1335 The \(oq-bfda\(cq option causes a newline to be forced after the comma
1336 separating the arguments of a function declaration. The arguments will
1337 appear at one indention level deeper than the function declaration. This
1338 is particularly helpful for functions with long argument lists.
1339 The option \(oq-bfde\(cq causes a newline to be forced before the closing
1340 bracket of the function declaration. For both options the \(cqn\(cq setting is the default:
1341 -nbfda and -nbfde.
1342
1343
1344 For
1345 example,
1346
1347 .in +5
1348 .nf
1349 .na
1350 void foo (int arg1, char arg2, int *arg3, long arg4, char arg5);
1351 .in -5
1352 .ad
1353 .fi
1354 With the \(oq-bfda\(cq option this would look like
1355
1356 .in +5
1357 .nf
1358 .na
1359 void foo (
1360 int arg1,
1361 char arg2,
1362 int *arg3,
1363 long arg4,
1364 char arg5);
1365 .in -5
1366 .ad
1367 .fi
1368
1369 With, in addition, the \(oq-bfde\(cq option this would look like
1370
1371 .in +5
1372 .nf
1373 .na
1374 void foo (
1375 int arg1,
1376 char arg2,
1377 int *arg3,
1378 long arg4,
1379 char arg5
1380 );
1381 .in -5
1382 .ad
1383 .fi
1384
1385 The \(oq-psl\(cq option causes the type of a procedure being defined to
1386 be placed on the line before the name of the procedure. This style is
1387 required for the \fBetags\fR program to work correctly, as well as some
1388 of the \fBc-mode\fR functions of Emacs.
1389
1390 You must use the \(oq-T\(cq
1391 option to tell \fBindent\fR the name of all the typenames in your
1392 program that are defined by \fBtypedef\fR. \(oq-T\(cq can be specified
1393 more than once, and all names specified are used. For example, if your
1394 program contains
1395
1396 .in +5
1397 .nf
1398 .na
1399 typedef unsigned long CODE_ADDR;
1400 typedef enum {red, blue, green} COLOR;
1401 .in -5
1402 .ad
1403 .fi
1404
1405 you would use the options \(oq-T CODE_ADDR -T COLOR\(cq.
1406
1407
1408 The \(oq-brs\(cq or \(oq-bls\(cq option specifies how to format braces
1409 in struct declarations. The \(oq-brs\(cq option formats braces like
1410 this:
1411
1412 .in +5
1413 .nf
1414 .na
1415 struct foo {
1416 int x;
1417 };
1418 .in -5
1419 .ad
1420 .fi
1421
1422 The \(oq-bls\(cq option formats them like this:
1423
1424 .in +5
1425 .nf
1426 .na
1427 struct foo
1428 {
1429 int x;
1430 };
1431 .in -5
1432 .ad
1433 .fi
1434
1435
1436 Similarly to the structure brace \(oq-brs\(cq and \(oq-bls\(cq options,
1437 the function brace options \(oq-brf\(cq or \(oq-blf\(cq specify how to format the braces
1438 in function definitions. The \(oq-brf\(cq option formats braces like
1439 this:
1440
1441 .in +5
1442 .nf
1443 .na
1444 int one(void) {
1445 return 1;
1446 };
1447 .in -5
1448 .ad
1449 .fi
1450
1451 The \(oq-blf\(cq option formats them like this:
1452
1453 .in +5
1454 .nf
1455 .na
1456 int one(void)
1457 {
1458 return 1;
1459 };
1460 .in -5
1461 .ad
1462 .fi
1463
1464
1465 The \(oq-sar\(cq option affects how \fBindent\fR will render initializer
1466 lists. Without \(oq-sar\(cq they are formatted like this:
1467
1468 .in +5
1469 .nf
1470 .na
1471 int a[] = {1, 2, 3, 4};
1472
1473 struct s {
1474 const char *name;
1475 int x;
1476 } a[] = {
1477 {"name", 0},
1478 {"a", 1}
1479 };
1480 .in -5
1481 .ad
1482 .fi
1483
1484 With \(oq-sar\(cq they are formatted like this, with spaces inside the
1485 braces:
1486
1487 .in +5
1488 .nf
1489 .na
1490 int a[] = { 1, 2, 3, 4 };
1491
1492 struct s {
1493 const char *name;
1494 int x;
1495 } a[] = {
1496 { "name", 0 },
1497 { "a", 1 }
1498 };
1499 .in -5
1500 .ad
1501 .fi
1502
1503 .SH "INDENTATION"
1504
1505 The most basic, and most controversial issues with regard to code
1506 formatting is precisely how indentation should be acoomplished.
1507 Fortunately, \fBindent\fR supports several different styles of
1508 identation. The default is to use tabs for indentation, which is
1509 specified by the \(oq-ut\(cq option. Assuming the default tab size of
1510 8, the code would look like this:
1511
1512 .in +5
1513 .nf
1514 .na
1515 int a(int b)
1516 {
1517 return b;
1518 |------|
1519 1 tab
1520 }
1521 .in -5
1522 .ad
1523 .fi
1524
1525 For those that prefer spaces to tabs, \(oqindent\(cq provides the
1526 \(oq-nut\(cq option. The same code would look like this:
1527
1528 .in +5
1529 .nf
1530 .na
1531 int a(int b)
1532 {
1533 return b;
1534 |------|
1535 8 spaces
1536 }
1537 .in -5
1538 .ad
1539 .fi
1540
1541 Another issue in the formatting of code is how far each line should be
1542 indented from the left margin. When the beginning of a statement such
1543 as \fBif\fR or \fBfor\fR is encountered, the indentation level is
1544 increased by the value specified by the \(oq-i\(cq option. For example,
1545 use \(oq-i8\(cq to specify an eight character indentation for each
1546 level. When a statement is broken across two lines, the second line is
1547 indented by a number of additional spaces specified by the \(oq-ci\(cq
1548 option. \(oq-ci\(cq defaults to 0. However, if the \(oq-lp\(cq option is
1549 specified, and a line has a left parenthesis which is not closed on that
1550 line, then continuation lines will be lined up to start at the character
1551 position just after the left parenthesis. This processing also applies
1552 to \(oq[\(cq and applies to \(oq{\(cq when it occurs in initialization
1553 lists. For example, a piece of continued code might look like this with
1554 \(oq-nlp -ci3\(cq in effect:
1555
1556 .in +5
1557 .nf
1558 .na
1559 p1 = first_procedure (second_procedure (p2, p3),
1560 third_procedure (p4, p5));
1561 .in -5
1562 .ad
1563 .fi
1564
1565 With \(oq-lp\(cq in effect the code looks somewhat clearer:
1566
1567 .in +5
1568 .nf
1569 .na
1570 p1 = first_procedure (second_procedure (p2, p3),
1571 third_procedure (p4, p5));
1572 .in -5
1573 .ad
1574 .fi
1575
1576 When a statement is broken in between two or more paren pairs (...),
1577 each extra pair causes the indentation level extra indentation:
1578
1579 .in +5
1580 .nf
1581 .na
1582 if ((((i < 2 &&
1583 k > 0) || p == 0) &&
1584 q == 1) ||
1585 n = 0)
1586 .in -5
1587 .ad
1588 .fi
1589
1590 The option \(oq-ip\fIN\fR\(cq can be used to set the extra offset per paren.
1591 For instance, \(oq-ip0\(cq would format the above as:
1592
1593 .in +5
1594 .nf
1595 .na
1596 if ((((i < 2 &&
1597 k > 0) || p == 0) &&
1598 q == 1) ||
1599 n = 0)
1600 .in -5
1601 .ad
1602 .fi
1603
1604 .B indent\fR assumes that tabs are placed at regular intervals of both
1605 input and output character streams. These intervals are by default 8
1606 columns wide, but (as of version 1.2) may be changed by the \(oq-ts\(cq
1607 option. Tabs are treated as the equivalent number of spaces.
1608
1609 By default, \fBindent\fR will use tabs to indent as far as possible,
1610 and then pad with spaces until the desired position is reached. However,
1611 with the \(oq-as\(cq option, spaces will be used for alignment beyond
1612 the current indentation level. By default, assuming \(oq-lp\(cq is
1613 enabled, the code would be indented like so (\(oqt\(cq represents tabs,
1614 \(oqs\(cq represents spaces):
1615
1616 .in +5
1617 .nf
1618 .na
1619 unsigned long really_long_proc_name(unsigned long x, unsigned long y,
1620 int a)
1621 |------||-------||------||-------|__
1622 t t t t ss
1623 {
1624 p1 = first_procedure (second_procedure (p2, p3),
1625 third_procedure (p4, p5));
1626 |------||------||------|_____
1627 t t t sssss
1628 }
1629 .in -5
1630 .ad
1631 .fi
1632
1633 This is fine, if you assume that whoever is reading the code will honor
1634 your assumption of 8-space tabs. If the reader was using 4-space tabs,
1635 it would look like this:
1636
1637 .in +5
1638 .nf
1639 .na
1640 unsigned long really_long_proc_name(unsigned long x, unsigned long y,
1641 int a)
1642 |---||---||---||---|__
1643 t t t t ss
1644 {
1645 p1 = first_procedure (second_procedure (p2, p3),
1646 third_procedure (p4, p5));
1647 |---||---||---|______
1648 t t t ssssss
1649 }
1650 .in -5
1651 .ad
1652 .fi
1653
1654 The \(oq-as\(cq option fixes this so that the code will appear consistent
1655 regardless of what tab size the user users to read the code. This looks
1656 like:
1657
1658 .in +5
1659 .nf
1660 .na
1661 unsigned long really_long_proc_name(unsigned long x, unsigned long y,
1662 int a)
1663 ____________________________________
1664 ssssssssssssssssssssssssssssssssssss
1665 {
1666 p1 = first_procedure (second_procedure (p2, p3),
1667 third_procedure (p4, p5));
1668 |------|______________________
1669 t ssssssssssssssssssssss
1670 }
1671 .in -5
1672 .ad
1673 .fi
1674
1675 The indentation of type declarations in old-style function definitions
1676 is controlled by the \(oq-ip\(cq parameter. This is a numeric parameter
1677 specifying how many spaces to indent type declarations. For example,
1678 the default \(oq-ip5\(cq makes definitions look like this:
1679
1680 .in +5
1681 .nf
1682 .na
1683 char *
1684 create_world (x, y, scale)
1685 int x;
1686 int y;
1687 float scale;
1688 {
1689 . . .
1690 }
1691 .in -5
1692 .ad
1693 .fi
1694
1695 For compatibility with other versions of indent, the option \(oq-nip\(cq
1696 is provided, which is equivalent to \(oq-ip0\(cq.
1697
1698 ANSI C allows white space to be placed on preprocessor command lines
1699 between the character \(oq#\(cq and the command name. By default,
1700 .B indent\fR removes this space, but specifying the \(oq-lps\(cq option
1701 directs \fBindent\fR to leave this space unmodified. The option \(oq-ppi\(cq
1702 overrides \(oq-nlps\(cq and \(oq-lps\(cq.
1703
1704 This option can be used to request that preprocessor conditional statements can
1705 be indented by to given number of spaces, for example with the option \(oq-ppi 3\(cq
1706
1707 .in +5
1708 .nf
1709 .na
1710 #if X
1711 #if Y
1712 #define Z 1
1713 #else
1714 #define Z 0
1715 #endif
1716 #endif
1717 .in -5
1718 .ad
1719 .fi
1720 becomes
1721 .in +5
1722 .nf
1723 .na
1724 #if X
1725 # if Y
1726 # define Z 1
1727 # else
1728 # define Z 0
1729 # endif
1730 #endif
1731 .in -5
1732 .ad
1733 .fi
1734
1735 This option sets the offset at which a label (except case labels)
1736 will be positioned. If it is set to zero or a positive number, this indicates how
1737 far from the left margin to indent a label. If it is set to a negative number,
1738 this indicates how far back from the current indent level to place the label.
1739 The default setting is -2 which matches the behaviour of earlier versions of indent.
1740 Note that this parameter does not affect the placing of case labels; see the
1741 \(oq-cli\(cq parameter for that. For example with the option \(oq-il 1\(cq
1742
1743 .in +5
1744 .nf
1745 .na
1746 group
1747 function()
1748 {
1749 if (do_stuff1() == ERROR)
1750 goto cleanup1;
1751
1752 if (do_stuff2() == ERROR)
1753 goto cleanup2;
1754
1755 return SUCCESS;
1756
1757 cleanup2:
1758 do_cleanup2();
1759
1760 cleanup1:
1761 do_cleanup1();
1762
1763 return ERROR;
1764 }
1765 .in -5
1766 .ad
1767 .fi
1768 becomes
1769 .in +5
1770 .nf
1771 .na
1772 group
1773 function()
1774 {
1775 if (do_stuff1() == ERROR)
1776 goto cleanup1;
1777
1778 if (do_stuff2() == ERROR)
1779 goto cleanup2;
1780
1781 return SUCCESS;
1782
1783 cleanup2:
1784 do_cleanup2();
1785
1786 cleanup1:
1787 do_cleanup1();
1788
1789 return ERROR;
1790 }
1791 .in -5
1792 .ad
1793 .fi
1794
1795 .SH "BREAKING LONG LINES"
1796
1797 With the option \(oq-l\fIn\fR\(cq, or \(oq--line-length\fIn\fR\(cq, it is
1798 possible to specify the maximum length of a line of C code, not including
1799 possible comments that follow it.
1800
1801 When lines become longer than the specified line length, GNU \fBindent\fR
1802 tries to break the line at a logical place. This is new as of version 2.1
1803 however and not very intelligent or flexible yet.
1804
1805 Currently there are three options that allow one to interfere with the
1806 algorithm that determines where to break a line.
1807
1808 The \(oq-bbo\(cq option causes GNU \fBindent\fR to prefer to break
1809 long lines before the boolean operators \fB&&\fR and \fB||\fR. The
1810 \(oq-nbbo\(cq option causes GNU \fBindent\fR not have that
1811 preference. For example, the default option \(oq-bbo\(cq (together
1812 with \(oq--line-length60\(cq and \(oq--ignore-newlines\(cq) makes code
1813 look like this:
1814
1815 .in +5
1816 .nf
1817 .na
1818 if (mask
1819 && ((mask[0] == \(cq\\0\(cq)
1820 || (mask[1] == \(cq\\0\(cq
1821 && ((mask[0] == \(cq0\(cq) || (mask[0] == \(cq*\(cq)))))
1822 .in -5
1823 .ad
1824 .fi
1825
1826 Using the option \(oq-nbbo\(cq will make it look like this:
1827
1828 .in +5
1829 .nf
1830 .na
1831 if (mask &&
1832 ((mask[0] == \(cq\\0\(cq) ||
1833 (mask[1] == \(cq\\0\(cq &&
1834 ((mask[0] == \(cq0\(cq) || (mask[0] == \(cq*\(cq)))))
1835 .in -5
1836 .ad
1837 .fi
1838
1839 The default \(oq-hnl\(cq, however, honours newlines in the input file by
1840 giving them the highest possible priority to break lines at. For example,
1841 when the input file looks like this:
1842
1843 .in +5
1844 .nf
1845 .na
1846 if (mask
1847 && ((mask[0] == \(cq\\0\(cq)
1848 || (mask[1] == \(cq\\0\(cq && ((mask[0] == \(cq0\(cq) || (mask[0] == \(cq*\(cq)))))
1849 .in -5
1850 .ad
1851 .fi
1852
1853 then using the option \(oq-hnl\(cq, or \(oq--honour-newlines\(cq,
1854 together with the previously mentioned \(oq-nbbo\(cq and
1855 \(oq--line-length60\(cq, will cause the output not to be what is given
1856 in the last example but instead will prefer to break at the positions
1857 where the code was broken in the input file:
1858
1859 .in +5
1860 .nf
1861 .na
1862 if (mask
1863 && ((mask[0] == \(cq\\0\(cq)
1864 || (mask[1] == \(cq\\0\(cq &&
1865 ((mask[0] == \(cq0\(cq) || (mask[0] == \(cq*\(cq)))))
1866 .in -5
1867 .ad
1868 .fi
1869
1870 The idea behind this option is that lines which are too long, but are already
1871 broken up, will not be touched by GNU \fBindent\fR. Really messy code
1872 should be run through \fBindent\fR at least once using the
1873 \(oq--ignore-newlines\(cq option though.
1874
1875 The \(oq-gts\(cq option affects how the gettext standard macros \fB_()\fR and \fBN_()\fR
1876 are treated. The default behavior (or the use of \(oq-ngts\(cq) causes indent to
1877 treat them as it does other functions, so that a long string is broken like the following
1878 example.
1879
1880 .in +5
1881 .nf
1882 .na
1883 if (mask)
1884 {
1885 warning (_
1886 ("This is a long string that stays together."));
1887 }
1888 .in -5
1889 .ad
1890 .fi
1891
1892 With the \(oq-gts\(cq option, the underscore is treated as a part of the string, keeping
1893 it tied to the string, and respecting the fact that gettext is unobtrusively providing
1894 a localized string. This only works if \fB_("\fR is together as a unit at the beginning
1895 of the string and \fB")\fR is together as a unit at the end.
1896
1897 .in +5
1898 .nf
1899 .na
1900 if (mask)
1901 {
1902 warning
1903 (_("This is a long string that stays together."));
1904 }
1905 .in -5
1906 .ad
1907 .fi
1908
1909 .SH "DISABLING FORMATTING"
1910
1911 Formatting of C code may be disabled for portions of a program by
1912 embedding special \fIcontrol comments\fR in the program. To turn off
1913 formatting for a section of a program, place the disabling control
1914 comment \fB/* *INDENT-OFF* */\fR on a line by itself just before that
1915 section. Program text scanned after this control comment is output
1916 precisely as input with no modifications until the corresponding
1917 enabling comment is scanned on a line by itself. The enabling control
1918 comment is \fB/* *INDENT-ON* */\fR, and any text following the comment
1919 on the line is also output unformatted. Formatting begins again with
1920 the input line following the enabling control comment.
1921
1922 More precisely, \fBindent\fR does not attempt to verify the closing
1923 delimiter (\fB*/\fR) for these C comments, and any whitespace on the
1924 line is totally transparent.
1925
1926 These control comments also function in their C++ formats, namely
1927 .B // *INDENT-OFF*\fR and \fB// *INDENT-ON*\fR.
1928
1929 It should be noted that the internal state of \fBindent\fR remains
1930 unchanged over the course of the unformatted section. Thus, for
1931 example, turning off formatting in the middle of a function and
1932 continuing it after the end of the function may lead to bizarre
1933 results. It is therefore wise to be somewhat modular in selecting code
1934 to be left unformatted.
1935
1936 As a historical note, some earlier versions of \fBindent\fR produced
1937 error messages beginning with \fB*INDENT**\fR. These versions of
1938 .B indent\fR were written to ignore any input text lines which began
1939 with such error messages. I have removed this incestuous feature from
1940 GNU \fBindent\fR.
1941
1942 .SH "MISCELLANEOUS OPTIONS"
1943
1944 To find out what version of \fBindent\fR you have, use the command
1945 .B indent -version\fR. This will report the version number of
1946 .B indent\fR, without doing any of the normal processing.
1947
1948 The \(oq-v\(cq option can be used to turn on verbose mode. When in
1949 verbose mode, \fBindent\fR reports when it splits one line of input
1950 into two more more lines of output, and gives some size statistics at
1951 completion.
1952
1953 The \(oq-pmt\(cq option causes \fBindent\fR to preserve the access
1954 and modification times on the output files. Using this option
1955 has the advantage that running indent on all source and header
1956 files in a project won\(cqt cause \fBmake\fR to rebuild all targets.
1957 This option is only available on Operating Systems that have the
1958 POSIX \fButime(2)\fR function.
1959
1960 .SH "BUGS"
1961
1962 Please report any bugs to [email protected].
1963
1964 When \fBindent\fR is run twice on a file, with the same profile,
1965 it should \fInever\fR change that file the second time. With the
1966 current design of \fBindent\fR, this can not be guaranteed,
1967 and it has not been extensively tested.
1968
1969 .B indent\fR does not understand C. In some cases this leads to
1970 the inability to join lines. The result is that running a file
1971 through \fBindent\fR is \fIirreversible\fR, even if the used input
1972 file was the result of running \fBindent\fR with a given profile
1973 (\(oq.indent.pro\(cq).
1974
1975 While an attempt was made to get \fBindent\fR working for C++, it
1976 will not do a good job on any C++ source except the very simplest.
1977
1978 .B indent\fR does not look at the given \(oq--line-length\(cq option
1979 when writing comments to the output file. This results often in comments
1980 being put far to the right. In order to prohibit \fBindent\fR from
1981 joining a broken line that has a comment at the end, make sure that the
1982 comments start on the first line of the break.
1983
1984 .B indent\fR does not count lines and comments (see the \(oq-v\(cq
1985 option) when \fBindent\fR is turned off with
1986 .B /* *INDENT-OFF* */\fR.
1987
1988 Comments of the form \fB/*UPPERCASE*/\fR are not treated as comment but as an
1989 identifier, causing them to be joined with the next line. This renders
1990 comments of this type useless, unless they are embedded in the code to
1991 begin with.
1992
1993 .SH "COPYRIGHT"
1994
1995 The following copyright notice applies to the \fBindent\fR program.
1996 The copyright and copying permissions for this manual appear near the
1997 beginning of \(oqindent.texinfo\(cq and \(oqindent.info\(cq, and near the
1998 end of \(oqindent.1\(cq.
1999
2000 .nf
2001 .na
2002 Copyright (c) 2015 Tim Hentenaar.
2003 Copyright (c) 2001 David Ingamells.
2004 Copyright (c) 1999 Carlo Wood.
2005 Copyright (c) 1995, 1996 Joseph Arceneaux.
2006 Copyright (c) 1989, 1992, 1993, 1994, 1995, 1996, 2014 Free Software Foundation
2007 Copyright (c) 1985 Sun Microsystems, Inc.
2008 Copyright (c) 1980 The Regents of the University of California.
2009 Copyright (c) 1976 Board of Trustees of the University of Illinois.
2010 All rights reserved.
2011
2012 Redistribution and use in source and binary forms are permitted
2013 provided that the above copyright notice and this paragraph are
2014 duplicated in all such forms and that any documentation,
2015 advertising materials, and other materials related to such
2016 distribution and use acknowledge that the software was developed
2017 by the University of California, Berkeley, the University of Illinois,
2018 Urbana, and Sun Microsystems, Inc. The name of either University
2019 or Sun Microsystems may not be used to endorse or promote products
2020 derived from this software without specific prior written permission.
2021 THIS SOFTWARE IS PROVIDED \(oq\(oqAS IS\(cq\(cq AND WITHOUT ANY EXPRESS OR
2022 IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
2023 WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
2024 PURPOSE.
2025 .ad
2026 .fi
2027
2028 .SH "Options\(cq Cross Key"
2029
2030 Here is a list of options alphabetized by long option, to help you find
2031 the corresponding short option.
2032
2033
2034 .in +5
2035 .nf
2036 .na
2037 --align-with-spaces -as
2038 --blank-lines-after-commas -bc
2039 --blank-lines-after-declarations -bad
2040 --blank-lines-after-procedures -bap
2041 --blank-lines-before-block-comments -bbb
2042 --braces-after-if-line -bl
2043 --braces-after-func-def-line -blf
2044 --brace-indent -bli
2045 --braces-after-struct-decl-line -bls
2046 --braces-on-if-line -br
2047 --braces-on-func-def-line -brf
2048 --braces-on-struct-decl-line -brs
2049 --break-after-boolean-operator -nbbo
2050 --break-before-boolean-operator -bbo
2051 --break-function-decl-args -bfda
2052 --break-function-decl-args-end -bfde
2053 --case-indentation -cli\fIn\fR
2054 --case-brace-indentation -cbi\fIn\fR
2055 --comment-delimiters-on-blank-lines -cdb
2056 --comment-indentation -c\fIn\fR
2057 --continuation-indentation -ci\fIn\fR
2058 --continue-at-parentheses -lp
2059 --cuddle-do-while -cdw
2060 --cuddle-else -ce
2061 --declaration-comment-column -cd\fIn\fR
2062 --declaration-indentation -di\fIn\fR
2063 --dont-break-function-decl-args -nbfda
2064 --dont-break-function-decl-args-end -nbfde
2065 --dont-break-procedure-type -npsl
2066 --dont-cuddle-do-while -ncdw
2067 --dont-cuddle-else -nce
2068 --dont-format-comments -nfca
2069 --dont-format-first-column-comments -nfc1
2070 --dont-line-up-parentheses -nlp
2071 --dont-left-justify-declarations -ndj
2072 --dont-space-special-semicolon -nss
2073 --dont-star-comments -nsc
2074 --dont-tab-align-comments -ntac
2075 --else-endif-column -cp\fIn\fR
2076 --format-all-comments -fca
2077 --format-first-column-comments -fc1
2078 --gnu-style -gnu
2079 --honour-newlines -hnl
2080 --ignore-newlines -nhnl
2081 --ignore-profile -npro
2082 --indent-label -il\fIn\fR
2083 --indent-level -i\fIn\fR
2084 --k-and-r-style -kr
2085 --leave-optional-blank-lines -nsob
2086 --leave-preprocessor-space -lps
2087 --left-justify-declarations -dj
2088 --line-comments-indentation -d\fIn\fR
2089 --line-length -l\fIn\fR
2090 --linux-style -linux
2091 --no-blank-lines-after-commas -nbc
2092 --no-blank-lines-after-declarations -nbad
2093 --no-blank-lines-after-procedures -nbap
2094 --no-blank-lines-before-block-comments -nbbb
2095 --no-comment-delimiters-on-blank-lines -ncdb
2096 --no-space-after-casts -ncs
2097 --no-parameter-indentation -nip
2098 --no-space-after-for -nsaf
2099 --no-space-after-function-call-names -npcs
2100 --no-space-after-if -nsai
2101 --no-space-after-parentheses -nprs
2102 --no-space-after-while -nsaw
2103 --no-tabs -nut
2104 --no-verbosity -nv
2105 --original -orig
2106 --parameter-indentation -ip\fIn\fR
2107 --paren-indentation -pi\fIn\fR
2108 --preserve-mtime -pmt
2109 --preprocessor-indentation -ppi\fIn\fR
2110 --procnames-start-lines -psl
2111 --remove-preprocessor-space -nlps
2112 --single-line-conditionals -slc
2113 --space-after-cast -cs
2114 --space-after-for -saf
2115 --space-after-if -sai
2116 --space-after-parentheses -prs
2117 --space-after-procedure-calls -pcs
2118 --space-after-while -saw
2119 --space-special-semicolon -ss
2120 --spaces-around-initializers -sar
2121 --standard-output -st
2122 --start-left-side-of-comments -sc
2123 --struct-brace-indentation -sbi\fIn\fR
2124 --swallow-optional-blank-lines -sob
2125 --tab-size -ts\fIn\fR
2126 --use-tabs -ut
2127 --verbose -v
2128 .in -5
2129 .ad
2130 .fi
2131
2132 .SH "RETURN VALUE"
2133 .IP \(bu 2
2134 0 means no errors or warnings were found during a successful invocation of
2135 the program.
2136 .br
2137 .IP \(bu 2
2138 2 is returned if errors occur during formatting which do not prevent completion
2139 of the formatting, but which appear to be manifested by incorrect code (i.e. code
2140 which wouldn't compile).
2141 .br
2142 .IP \(bu 2
2143 3 is returned if formatting of a file is halted because of an error with the file
2144 which prevents completion of formatting. If more than one input file was specified,
2145 indent continues to the next file.
2146 .br
2147 .IP \(bu 2
2148 4 is returned if a serious internal problem occurs and the entire indent process
2149 is terminated, even if all specified files have not been processed.
2150 .br
2151 .IP \(bu 2
2152 64 is returned if an invocation problem (like an incorrect option) prevents
2153 any formatting to occur.
2154 .SH FILES
2155 .br
2156 .nf
2157 .\" set tabstop to longest possible filename, plus a wee bit
2158 .ta \w'$HOME/.indent.pro 'u
2159 \fI$HOME/.indent.pro\fR holds default options for indent.
2160 .SH "AUTHORS"
2161 .br
2162 Tim Hentenaar
2163 .br
2164 Carlo Wood
2165 .br
2166 Joseph Arceneaux
2167 .br
2168 Jim Kingdon
2169 .br
2170 David Ingamells
2171 .SH "HISTORY"
2172 Derived from the UCB program "indent".
2173 .SH "COPYING"
2174 Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 2014, 2015 Free Software Foundation, Inc.
2175 Copyright (C) 1995, 1996 Joseph Arceneaux.
2176 Copyright (C) 1999 Carlo Wood.
2177 Copyright (C) 2001 David Ingamells.
2178 Copyright (C) 2013 Ɓukasz Stelmach.
2179 Copyright (C) 2015 Tim Hentenaar.
2180
2181 Permission is granted to make and distribute verbatim copies of
2182 this manual provided the copyright notice and this permission notice
2183 are preserved on all copies.
2184
2185