INDENT(1) General Commands Manual INDENT(1) indent - C . indent [] [-] indent [] [--] [-o -] indent --version indent.texinfo. " indent" Indent . indent . C . indent C . 1.2 GNU . -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 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 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 . . COMMON STYLES. -gts --gettext-strings gettext _("...") N_("...") . 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 . 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 gettext _("...") N_("...") . . 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 . COMMENTS. -nut --no-tabs . INDENTATION. -nv --no-verbosity . MISCELLANEOUS OPTIONS. -orig --original . 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 `{' `}' (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 indent . DECLARATIONS. -tsn --tab-sizen n . INDENTATION. -ut --use-tabs . . INDENTATION. -v --verbose . MISCELLANEOUS OPTIONS. -version indent. MISCELLANEOUS OPTIONS. INDENT 1.3 indent : indent [] [-] indent [] [--] [-o -] 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.] . OPTION SUMMARY . : 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'. indent . INDENT_PROFILE. . indent `.indent.pro' . indent `.indent.pro' . indent . `.indent.pro' ( ). `.indent.pro' C C++ . Command line switches are handled after processing ` ?.indent.pro'. Options specified later override arguments specified earlier, with one exception: Explicitly specified options always override background options (See COMMON STYLES). You can prevent indent from reading an `.indent.pro' file by specifying the `-npro' option. 1.3 GNU indent GNU GNU Emacs. . . `~' (). `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' . SIMPLE_BACKUP_SUFFIX `.BAK'. indent GNU indent . C GNU Kernighan & Ritchie Berkeley . . . 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 GNU. C GNU Emacs C GNU Emacs. ( GNU " GNU" ). Kernighan & Ritchie "The C Programming Language". `-kr'. Kernighan & Ritchie : -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 Kernighan & Ritchie ( ) 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 Linux Linux . Linux . : -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 -sai -saw -ncs -nsc -sob -nfca -cp33 -ss -ts8 -il1 . indent . `-bad' indent . `-nbad' 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; 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"); } 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. indent C C++. C `/*' `*/' . C++ `//' . indent . indent ( 1). indent . . . indent . ``'' . `/*' `*' `=' `_' `-' (`/*') `*' . : /********************** * Comment in a box!! * **********************/ /* * A different kind of scent, * for a different kind of comment. */ indent . . . `-bbb' . . ( ) . `-fca'. `-fc1'. . 78 `-lc'. . . `-fnc' `/*' `*' . ( ) . ( ). `-d' . `-d2' . --- `-fc1'. 33. . `-c' `-cd' `-cp' #else #endif. `-dj' `-cd0' . `-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 (cuddle) . `-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++ = ' '; } 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' indent typedef. `-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 } }; . indent . (tabs) `-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) indent . 8 ( 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 } 8 . 4 : 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 `#' . 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; } `-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. indent `--ignore-newlines'. `-gts' gettext _() N_(). ( `-ngts') indent . if (mask) { warning (_ ("This is a long string that stays together.")); } `-gts' gettext . _(" ") . if (mask) { warning (_("This is a long string that stays together.")); } C . /* *INDENT-OFF* */ . . /* *INDENT-ON* */ . . indent (*/) C . C++ // *INDENT-OFF* // *INDENT-ON*. indent . . . indent *INDENT**. indent . GNU indent. indent indent -version. indent . `-v' . indent . `-pmt' indent . indent make . POSIX utime(2). bug-indent@gnu.org. indent . indent . indent C. . indent indent (`.indent.pro'). indent C++ C++ . indent `--line-length' . . indent . indent ( `-v') indent /* *INDENT-OFF* */. /*UPPERCASE*/ . . indent. `indent.texinfo' `indent.info' `indent.1'. (c) 2015 Tim Hentenaar. (c) 2001 David Ingamells. (c) 1999 Carlo Wood. (c) 1995, 1996 Joseph Arceneaux. (c) 1989, 1992, 1993, 1994, 1995, 1996, 2014 (c) 1985 Sun Microsystems, Inc. (c) 1980 . (c) 1976 . . . . "AS IS" . . --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 o 0 . o 2 ( ). o 3 . indent . o 4 indent . o 64 ( ) . $HOME/.indent.pro indent. "indent" UCB. (C) 1989 1992 1993 1994 1995 1996 2014 2015 . (C) 1995 1996 . (C) 1999 . (C) 2001 . (C) 2013 . (C) 2015 . . 3 . . : . INDENT(1)