INDENT(1) General Commands Manual INDENT(1) (NAME) indent - C (SYNOPSIS) indent [options] [input-files] indent [options] [single-input-file] [-o output-file] indent --version (DESCRIPTION) indent.texinfo . " indent" Indent . indent . C . .B indent (syntax) C . 1.2 (GNU) . (OPTIONS) -as, --align-with-spaces . INDENTATION . -bad, --blank-lines-after-declarations . BLANK LINES . -bap, --blank-lines-after-procedures . BLANK LINES . -bbb, --blank-lines-before-block-comments . BLANK LINES . -bbo, --break-before-boolean-operator . BREAKING LONG LINES . -bc, --blank-lines-after-commas . DECLARATIONS . -bl, --braces-after-if-line if . STATEMENTS . -blf, --braces-after-func-def-line . DECLARATIONS . -blin, --brace-indentn n . STATEMENTS . -bls, --braces-after-struct-decl-line struct. DECLARATIONS . -br, --braces-on-if-line if . STATEMENTS . -brf, --braces-on-func-def-line . DECLARATIONS . -brs, --braces-on-struct-decl-line struct. DECLARATIONS . -bs, --Bill-Shannon, --blank-before-sizeof sizeof . STATEMENTS . -cn, --comment-indentationn n. COMMENTS . -cbin, --case-brace-indentationn case N . STATEMENTS . -cdn, --declaration-comment-columnn n. COMMENTS . -cdb, --comment-delimiters-on-blank-lines . COMMENTS . -cdw, --cuddle-do-while while do {} while; `}' . COMMENTS . -ce, --cuddle-else else `}' . COMMENTS . -cin, --continuation-indentationn n . STATEMENTS . -clin, --case-indentationn case n . STATEMENTS . -cpn, --else-endif-columnn #else #endif n. COMMENTS . -cs, --space-after-cast (cast). STATEMENTS . -dn, --line-comments-indentationn n . COMMENTS . -bfda, --break-function-decl-args . DECLARATIONS . -bfde, --break-function-decl-args-end . DECLARATIONS . -dj, --left-justify-declarations -cd 0 . DECLARATIONS . -din, --declaration-indentationn n. DECLARATIONS . -fc1, --format-first-column-comments . COMMENTS . -fca, --format-all-comments . COMMENTS . -fnc, --fix-nested-comments . COMMENTS . -gnu, --gnu-style (GNU). . COMMON STYLES . -gts, --gettext-strings _("...") N_("...") gettext . BREAKING LONG LINES . -hnl, --honour-newlines . BREAKING LONG LINES . -in, --indent-leveln n . INDENTATION . -iln, --indent-labeln n. INDENTATION . -ipn, --parameter-indentationn n . INDENTATION . -kr, --k-and-r-style (K&R). COMMON STYLES . -ln, --line-lengthn n. BREAKING LONG LINES . -lcn, --comment-line-lengthn n. COMMENTS . -linux, --linux-style . COMMON STYLES . -lp, --continue-at-parentheses . INDENTATION . -lps, --leave-preprocessor-space `#' . INDENTATION . -nlps, --remove-preprocessor-space `#' . INDENTATION . -nbad, --no-blank-lines-after-declarations . BLANK LINES . -nbap, --no-blank-lines-after-procedures . BLANK LINES . -nbbo, --break-after-boolean-operator . BREAKING LONG LINES . -nbc, --no-blank-lines-after-commas . DECLARATIONS . -nbfda, --dont-break-function-decl-args . DECLARATIONS . -ncdb, --no-comment-delimiters-on-blank-lines . COMMENTS . -ncdw, --dont-cuddle-do-while } while do {} while; . STATEMENTS . -nce, --dont-cuddle-else } else . STATEMENTS . -ncs, --no-space-after-casts (cast). STATEMENTS . -ndjn, --dont-left-justify-declarations . DECLARATIONS . -nfc1, --dont-format-first-column-comments . COMMENTS . -nfca, --dont-format-comments . COMMENTS . -ngts, --no-gettext-strings _("...") N_("...") gettext . . BREAKING LONG LINES . -nhnl, --ignore-newlines . BREAKING LONG LINES . -nip, --no-parameter-indentation . INDENTATION . -nlp, --dont-line-up-parentheses . STATEMENTS . -npcs, --no-space-after-function-call-names . STATEMENTS . -nprs, --no-space-after-parentheses '(' ')'. STATEMENTS . -npsl, --dont-break-procedure-type . DECLARATIONS . -nsaf, --no-space-after-for for. STATEMENTS . -nsai, --no-space-after-if if. STATEMENTS . -nsaw, --no-space-after-while while. STATEMENTS . -nsc, --dont-star-comments `*' . COMMENTS . -nsob, --leave-optional-blank-lines . BLANK LINES . -nss, --dont-space-special-semicolon . `-ss'. STATEMENTS . -ntac, --dont-tab-align-comments (tabstop). COMMENTS . -nut, --no-tabs . INDENTATION . -nv, --no-verbosity (verbose). MISCELLANEOUS OPTIONS . -orig, --original (Berkeley). COMMON STYLES . -npro, --ignore-profile `.indent.pro'. INVOKING INDENT . -pal, --pointer-align-left : ``char* p''. -par, --pointer-align-right : ``char *p''. . -pcs, --space-after-procedure-calls `('. STATEMENTS . -pin, --paren-indentationn '(' . STATEMENTS . -pmt, --preserve-mtime . MISCELLANEOUS OPTIONS . -ppin, --preprocessor-indentationn . INDENTATION . -prs, --space-after-parentheses '(' ')'. STATEMENTS . -psl, --procnames-start-lines . DECLARATIONS . -saf, --space-after-for for. STATEMENTS . -sai, --space-after-if if. STATEMENTS . -sar, --spaces-around-initializers `{' `}' . DECLARATIONS . -saw, --space-after-while while. STATEMENTS . -sbin, --struct-brace-indentationn struct union enum N . STATEMENTS . -sc, --start-left-side-of-comments `*' . COMMENTS . -slc, --single-line-conditionals (if else ). STATEMENTS . -sob, --swallow-optional-blank-lines () . BLANK LINES . -ss, --space-special-semicolon for while . STATEMENTS . -st, --standard-output . INVOKING INDENT . -T (typenames) indent. DECLARATIONS . -tsn, --tab-sizen n . INDENTATION . -ut, --use-tabs . . INDENTATION . -v, --verbose (verbose). MISCELLANEOUS OPTIONS . -version indent. MISCELLANEOUS OPTIONS . INDENT (INVOKING INDENT) 1.3 indent : indent [options] [input-files] indent [options] [single-input-file] [-o output-file] indent . . indent . (BACKUP FILES) . . `-o' . indent `-st' . . . `-' . `slithy_toves.c' `slithy_toves.out' : indent slithy_toves.c -o slithy_toves.out indent -st slithy_toves.c > slithy_toves.out cat slithy_toves.c | indent -o slithy_toves.out indent . 1.2 indent . `--' `+' . [`+' POSIX `--' .] . (OPTIONS) . : indent -br test/metabolism.c -l85 `test/metabolism.c' `-br' `-l85' `test/metabolism.c' `test/metabolism.c' `test' . : indent --braces-on-if-line --line-length185 test/metabolism.c indent +braces-on-if-line +line-length185 test/metabolism.c indent `.indent.pro' . .B indent : INDENT_PROFILE . . indent `.indent.pro' . indent `.indent.pro' . indent . `.indent.pro' ( ) . `.indent.pro' C ++C . `.indent.pro' . : ( (COMMON STYLES) ). `-npro' `.indent.pro' indent . (BACKUP FILES) 1.3 GNU indent GNU Emacs . simple () .I numbered () . . `~' () . `python.c' `python.c~' . SIMPLE_BACKUP_SUFFIX . `momeraths.c' `momeraths.c.~23~' 23 . `src/momeraths.c' `src/momeraths.c.~V~' V `src' . VERSION_WIDTH . "2" `momeraths.c.~04~' . VERSION_CONTROL . `simple' . `numbered' . `numbered- existing' . VERSION_CONTROL indent `numbered-existing' . indent `.BAK' . .B SIMPLE_BACKUP_SUFFIX `.BAK' . indent GNU indent . (COMMON STYLES) C (GNU) (Kernighan & Ritchie) (Berkeley). (background) . . 1.2 GNU indent GNU . `-gnu' . GNU : -nbad -bap -nbc -bbo -bl -bli2 -bls -ncdb -nce -cp1 -cs -di2 -ndj -nfc1 -nfca -hnl -i2 -ip5 -lp -pcs -nprs -psl -saf -sai -saw -nsc -nsob GNU . C GNU Emacs C GNU Emacs . ( " " .) "The C Programming Language" . `-kr' . : -nbad -bap -bbo -nbc -br -brs -c33 -cd33 -ncdb -ce -ci4 -cli0 -cp33 -cs -d0 -di1 -nfc1 -nfca -hnl -i4 -ip0 -l75 -lp -npcs -nprs -npsl -saf -sai -saw -nsc -nsob -nss -par ( ) indent 33 . Berkeley indent `-orig' ( `--original') . : -nbad -nbap -bbo -bc -br -brs -c33 -cd33 -cdb -ce -ci4 -cli0 -cp33 -di16 -fc1 -fca -hnl -i4 -ip4 -l75 -lp -npcs -nprs -psl -saf -sai -saw -sc -nsob -nss -ts8 . . : -nbad -bap -nbc -bbo -hnl -br -brs -c33 -cd33 -ncdb -ce -ci4 -cli0 -d0 -di1 -nfc1 -i8 -ip0 -l80 -lp -npcs -nprs -npsl -sai -saf -saw -ncs -nsc -sob -nfca -cp33 -ss -ts8 -il1 (BLANK LINES) . .B indent . `-bad' indent . `-nbad' .B indent . `-bap' () . `-nbap' . `-bbb' ( (COMMENTS) ). `-nbbb' . `-sob' indent ( ). `-nsob' . --blank-lines-after-declarations `-bad' . `-nbad' . : char *foo; char *bar; /* This separates blocks of declarations. */ int baz; .B indent -bad : char *foo; char *bar; /* This separates blocks of declarations. */ int baz; indent -nbad : char *foo; char *bar; /* This separates blocks of declarations. */ int baz; --blank-lines-after-procedures `-bap' . : int foo () { puts("Hi"); } /* The procedure bar is even less interesting. */ char * bar () { puts("Hello"); } .B indent -bap : int foo () { puts ("Hi"); } /* The procedure bar is even less interesting. */ char * bar () { puts ("Hello"); } indent -nbap : int foo () { puts ("Hi"); } /* The procedure bar is even less interesting. */ char * bar () { puts ("Hello"); } foo . (COMMENTS) .B indent C ++C . C `/*' `*/' . ++C `//' . .B indent (context) . .B indent ( ) . .B indent . . ( ) . .B indent (boxed comments) . ``'' . `/*' `*' `=' `_' `-' (`/*') `*' . : /********************** * Comment in a box!! * **********************/ /* * A different kind of scent, * for a different kind of comment. */ .B indent . . . `-bbb' . . ( ) . `-fca' . `-fc1' . . 78 `-lc' . . . `-fnc' `/*' `*' . ( ) . ( ). `-d' . `-d2' . --- `-fc1' . 33 . : `-c' `-cd' `-cp' #else #endif . `-dj' `-cd0' (tabstop) . `-cd0' `-c' . `-ntac' . . . `-cdb' . /* Loving hug */ : /* Loving hug */ `-sc' . ( `-cdb -sc') : /* * Loving hug */ (STATEMENTS) `-br' `-bl' . `-br' : if (x > 0) { x--; } `-bl' : if (x > 0) { x--; } `-bl' `-bli' . . `-bli2' . `-bli0' : if (x > 0) { x--; } `-br' `-ce' . else if-then-else `}' . `-br -ce' : if (x > 0) { x--; } else { fprintf (stderr, "...something wrong?\n"); } `-br -nce' : if (x > 0) { x--; } else { fprintf (stderr, "...something wrong?\n"); } else . `-br' else . `-cdw' while do-while `}' . `-cdw' : do { x--; } while (x); `-ncdw' : do { x--; } while (x); `-slc' . : if (x) x--; else x++; `-slc' : if (x) x--; else x++; `-cli' case switch . : switch (i) { case 0: break; case 1: { ++i; } default: break; } `-cli2' : switch (i) { case 0: break; case 1: { ++i; } default: break; } case `-cbin' . `-cli2 -cbi0' : switch (i) { case 0: break; case 1: { ++i; } default: break; } for while `-ss' . for while . `-nss' . `-pcs' `(' ( puts ("Hi"); `-npcs' puts("Hi"); ). `-cs' indent (cast) . `-ncs' . indent C . (mytype)thing . `-bs' sizeof . `Bill_Shannon' . `-saf' for . . `-sai' if . . `-saw' while . . `-prs' . `-prs' : while ( ( e_code - s_code ) < ( dec_ind - 1 ) ) { set_buf_break ( bb_dec_ind ); *e_code++ = ' '; } (DECLARATIONS) indent `-di' . `-di16' : int foo; char *bar; ( ) `-di' : int foo; char *bar; `-di' `-di2' : int foo; `-bc' . : int a, b, c; `-nbc' : int a, b, c; `-bfda' . . . `-bfde' . 'n' : -nbfda -nbfde. : void foo (int arg1, char arg2, int *arg3, long arg4, char arg5); `-bfda' : void foo ( int arg1, char arg2, int *arg3, long arg4, char arg5); `-bfde' : void foo ( int arg1, char arg2, int *arg3, long arg4, char arg5 ); `-psl' . etags c-mode Emacs . `-T' (typenames) typedef indent . `-T' . : typedef unsigned long CODE_ADDR; typedef enum {red, blue, green} COLOR; `-T CODE_ADDR -T COLOR' . `-brs' `-bls' struct . `-brs' : struct foo { int x; }; `-bls' : struct foo { int x; }; `-brs' `-bls' `-brf' `-blf' . `-brf' : int one(void) { return 1; }; `-blf' : int one(void) { return 1; }; `-sar' indent . `-sar' : int a[] = {1, 2, 3, 4}; struct s { const char *name; int x; } a[] = { {"name", 0}, {"a", 1} }; `-sar' : int a[] = { 1, 2, 3, 4 }; struct s { const char *name; int x; } a[] = { { "name", 0 }, { "a", 1 } }; (INDENTATION) (indentation) . indent . `-ut' . 8 : int a(int b) { return b; |------| 1 tab } `indent' `-nut' . : int a(int b) { return b; |------| 8 spaces } . if for `-i' . `-i8' . `-ci' . `-ci' 0 . `-lp' . `[' `{' . `-nlp -ci3' : p1 = first_procedure (second_procedure (p2, p3), third_procedure (p4, p5)); `-lp' : p1 = first_procedure (second_procedure (p2, p3), third_procedure (p4, p5)); (...) : if ((((i < 2 && k > 0) || p == 0) && q == 1) || n = 0) `-ipN' . `-ip0' : if ((((i < 2 && k > 0) || p == 0) && q == 1) || n = 0) .B indent . ( 1.2 ) `-ts' . . indent . `-as' . `-lp' (`t' `s' ): unsigned long really_long_proc_name(unsigned long x, unsigned long y, int a) |------||-------||------||-------|__ t t t t ss { p1 = first_procedure (second_procedure (p2, p3), third_procedure (p4, p5)); |------||------||------|_____ t t t sssss } . : unsigned long really_long_proc_name(unsigned long x, unsigned long y, int a) |---||---||---||---|__ t t t t ss { p1 = first_procedure (second_procedure (p2, p3), third_procedure (p4, p5)); |---||---||---|______ t t t ssssss } `-as' . : unsigned long really_long_proc_name(unsigned long x, unsigned long y, int a) ____________________________________ ssssssssssssssssssssssssssssssssssss { p1 = first_procedure (second_procedure (p2, p3), third_procedure (p4, p5)); |------|______________________ t ssssssssssssssssssssss } `-ip' . . `-ip5' : char * create_world (x, y, scale) int x; int y; float scale; { . . . } indent `-nip' `-ip0' . ANSI C `#' . .B indent `-lps' indent . `-ppi' `-nlps' `-lps' . `-ppi 3': #if X #if Y #define Z 1 #else #define Z 0 #endif #endif : #if X # if Y # define Z 1 # else # define Z 0 # endif #endif ( case) . . . -2 indent . case `-cli' . `-il 1': group function() { if (do_stuff1() == ERROR) goto cleanup1; if (do_stuff2() == ERROR) goto cleanup2; return SUCCESS; cleanup2: do_cleanup2(); cleanup1: do_cleanup1(); return ERROR; } : group function() { if (do_stuff1() == ERROR) goto cleanup1; if (do_stuff2() == ERROR) goto cleanup2; return SUCCESS; cleanup2: do_cleanup2(); cleanup1: do_cleanup1(); return ERROR; } (BREAKING LONG LINES) `-ln' `--line-lengthn' C . GNU indent . 2.1 . . `-bbo' GNU indent && || . `-nbbo' GNU indent . `-bbo' ( `--line-length60' `--ignore-newlines') : if (mask && ((mask[0] == '\0') || (mask[1] == '\0' && ((mask[0] == '0') || (mask[0] == '*'))))) `-nbbo' : if (mask && ((mask[0] == '\0') || (mask[1] == '\0' && ((mask[0] == '0') || (mask[0] == '*'))))) `-hnl' . : if (mask && ((mask[0] == '\0') || (mask[1] == '\0' && ((mask[0] == '0') || (mask[0] == '*'))))) `-hnl' `--honour-newlines' `-nbbo' `--line-length60' : if (mask && ((mask[0] == '\0') || (mask[1] == '\0' && ((mask[0] == '0') || (mask[0] == '*'))))) GNU indent . `--ignore-newlines' indent . `-gts' gettext _() N_() . ( `-ngts') indent : if (mask) { warning (_ ("This is a long string that stays together.")); } `-gts' (underscore) gettext . _(" ") . if (mask) { warning (_("This is a long string that stays together.")); } (DISABLING FORMATTING) C . /* *INDENT- OFF* */ . . /* *INDENT-ON* */ . . indent (*/) C . ++C // *INDENT-OFF* // *INDENT-ON*. indent . . . indent *INDENT** . .B indent . GNU indent . (MISCELLANEOUS OPTIONS) indent .B indent -version . .B indent . `-v' (verbose) . indent . `-pmt' indent . indent make . utime(2) . (BUGS) bug- indent@gnu.org . indent . indent . .B indent C . . indent indent (`.indent.pro') . indent ++C ++C . .B indent `--line-length' . . indent . indent .B /* *INDENT-OFF* */ ( `-v' ). /*UPPERCASE*/ . . (COPYRIGHT) indent . `indent.texinfo' `indent.info' `indent.1' . Copyright (c) 2015 Tim Hentenaar. Copyright (c) 2001 David Ingamells. Copyright (c) 1999 Carlo Wood. Copyright (c) 1995, 1996 Joseph Arceneaux. Copyright (c) 1989, 1992, 1993, 1994, 1995, 1996, 2014 Free Software Foundation Copyright (c) 1985 Sun Microsystems, Inc. Copyright (c) 1980 The Regents of the University of California. Copyright (c) 1976 Board of Trustees of the University of Illinois. All rights reserved. Redistribution and use in source and binary forms are permitted provided that the above copyright notice and this paragraph are duplicated in all such forms and that any documentation, advertising materials, and other materials related to such distribution and use acknowledge that the software was developed by the University of California, Berkeley, the University of Illinois, Urbana, and Sun Microsystems, Inc. The name of either University or Sun Microsystems may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. (Options' Cross Key) . --align-with-spaces -as --blank-lines-after-commas -bc --blank-lines-after-declarations -bad --blank-lines-after-procedures -bap --blank-lines-before-block-comments -bbb --braces-after-if-line -bl --braces-after-func-def-line -blf --brace-indent -bli --braces-after-struct-decl-line -bls --braces-on-if-line -br --braces-on-func-def-line -brf --braces-on-struct-decl-line -brs --break-after-boolean-operator -nbbo --break-before-boolean-operator -bbo --break-function-decl-args -bfda --break-function-decl-args-end -bfde --case-indentation -clin --case-brace-indentation -cbin --comment-delimiters-on-blank-lines -cdb --comment-indentation -cn --continuation-indentation -cin --continue-at-parentheses -lp --cuddle-do-while -cdw --cuddle-else -ce --declaration-comment-column -cdn --declaration-indentation -din --dont-break-function-decl-args -nbfda --dont-break-function-decl-args-end -nbfde --dont-break-procedure-type -npsl --dont-cuddle-do-while -ncdw --dont-cuddle-else -nce --dont-format-comments -nfca --dont-format-first-column-comments -nfc1 --dont-line-up-parentheses -nlp --dont-left-justify-declarations -ndj --dont-space-special-semicolon -nss --dont-star-comments -nsc --dont-tab-align-comments -ntac --else-endif-column -cpn --format-all-comments -fca --format-first-column-comments -fc1 --gnu-style -gnu --honour-newlines -hnl --ignore-newlines -nhnl --ignore-profile -npro --indent-label -iln --indent-level -in --k-and-r-style -kr --leave-optional-blank-lines -nsob --leave-preprocessor-space -lps --left-justify-declarations -dj --line-comments-indentation -dn --line-length -ln --linux-style -linux --no-blank-lines-after-commas -nbc --no-blank-lines-after-declarations -nbad --no-blank-lines-after-procedures -nbap --no-blank-lines-before-block-comments -nbbb --no-comment-delimiters-on-blank-lines -ncdb --no-space-after-casts -ncs --no-parameter-indentation -nip --no-space-after-for -nsaf --no-space-after-function-call-names -npcs --no-space-after-if -nsai --no-space-after-parentheses -nprs --no-space-after-while -nsaw --no-tabs -nut --no-verbosity -nv --original -orig --parameter-indentation -ipn --paren-indentation -pin --preserve-mtime -pmt --preprocessor-indentation -ppin --procnames-start-lines -psl --remove-preprocessor-space -nlps --single-line-conditionals -slc --space-after-cast -cs --space-after-for -saf --space-after-if -sai --space-after-parentheses -prs --space-after-procedure-calls -pcs --space-after-while -saw --space-special-semicolon -ss --spaces-around-initializers -sar --standard-output -st --start-left-side-of-comments -sc --struct-brace-indentation -sbin --swallow-optional-blank-lines -sob --tab-size -tsn --use-tabs -ut --verbose -v (RETURN VALUE) o 0 . o 2 ( ) . o 3 . indent . o 4 indent . o 64 ( ) . (FILES) $HOME/.indent.pro indent . (AUTHORS) Tim Hentenaar Carlo Wood Joseph Arceneaux Jim Kingdon David Ingamells (HISTORY) "indent" (UCB). (COPYING) Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 2014, 2015 Free Software Foundation, Inc. Copyright (C) 1995, 1996 Joseph Arceneaux. Copyright (C) 1999 Carlo Wood. Copyright (C) 2001 David Ingamells. Copyright (C) 2013 Lukasz Stelmach. Copyright (C) 2015 Tim Hentenaar. . INDENT(1)