Linux indent command
Linux indent command is used to adjust the C source code file format.
indent recognizable C original code file and are formatted to facilitate programmers to read.
grammar
indent [参数][源文件] 或 indent [参数][源文件][-o 目标文件]
Parameters:
- -bad or --blank-lines-after-declarations in the declaration section or add a blank line.
- -bap or --blank-lines-after-procedures in the program or add a blank line.
- -bbb or --blank-lines-after-block-comments in the comments section add a blank line.
- -Bc or - blank-lines-after-commas in the declaration section, if there is a comma ie wrap.
- -bl or --braces-after-if-line if (or else, for, etc.) and "{" in different rows, and "}" after the implementation section of its own line.
- -bli <indent cell number> or --brace-indent <indent cell number> Settings {number of squares} indented.
- -br or --braces-on-if-line if (or else, for, etc.) and later executed lame segment "{" in different rows, and "}" on its own line.
- -bs or --blank-before-sizeof after sizeof a space.
- -c <number of columns> or --comment-indentation <column number> The comments into the program code specified to the right field.
- -cd <number of columns> or --declaration-comment-column <column number> comment into the right side of the statement specified fields.
- -Cdb or - comment-delimiters-on-blank-lines comment symbol on its own line.
- -ce or --cuddle-else will else in the "}" (at the end if the implementation section) after.
- -ci <indent cell number> or --continuation-indentation <indent cell number> narrative is too long and change line, specify the number of cells after wrapping indentation.
- -Cli <indent cell number> or - case-indentation-<indent cell number> Use case when, switch indent of the number of cells.
- -cp <number of columns> or -else-endif-column <column number> annotations placed else and elseif described the right of a given field.
- -Cs or - space-after-cast in a cast after a space.
- -d <indent cell number> or -line-comments-indentation <indent cell number> for not on the right side of the program code comments, set its indent the number of cells.
- -di <column number> or --declaration-indentation <column number> The variable declaration section into the specified field.
- -fc1 or --format-first-column-comments against at the forefront of comments per line, set its format.
- -fca or --format-all-comments set all comments formats.
- -Gnu or - gnu-style Specifies GNU format, this is the default value.
- -i <cell number> or --indent-level <cell number> Set the number of grid indent.
- -ip <cell number> or --parameter-indentation <cell number> setting parameters indent the number of cells.
- -Kr or - k-and-r-style specifies Kernighan & Ritchie format.
- -lp or --continue-at-parentheses narrative too long wrap, and narrative contains parentheses when the parentheses for each line starting field contents vertically on its order.
- -nbad or --no-blank-lines-after-declarations do not add a blank line after the declaration section.
- -nbap or --no-blank-lines-after-procedures do not add a blank line after the program.
- -nbbb or --no-blank-lines-after-block-comments do not add a blank line after the comment section.
- -nbc or --no-blank-lines-after-commas in the declaration section, even if a comma appears, still do not wrap.
- -ncdb or --no-comment-delimiters-on-blank-lines comment symbol do not own line.
- -nce or --dont-cuddle-else do not else placed in the "}" after.
- -ncs or --no-space-after-casts not a space after a cast.
- -nfc1 or --dont-format-first-column-comments Do not format at the forefront of comments per line.
- -Nfca or - dont-format-comments Do not format any comments.
- -Nip or - no-parameter-indentation parameters do not indent.
- -Nlp or - dont-line-up-parentheses narrative too long wrap, and narrative contains parentheses when, without the parentheses for each line of the starting field perpendicular to its order.
- -npcs or --no-space-after-function-call-names after the function name call, do not put spaces.
- -npro or --ignore-profile do not read indent profile .indent.pro.
- -npsl or --dont-break-procedure-type program type and program name on the same line.
- -Nsc or - dont-star-comments comment left side Do not add an asterisk (*).
- -nsob or --leave-optional-semicolon not handle the extra blank line.
- -nss or --dont-space-special-semicolon if for or while zone only one row when not put spaces before the semicolon.
- -nv or --no-verbosity does not display detailed information.
- -orig or --original use Berkeley format.
- -pcs or --space-after-procedure-calls between the name of the function call and "{" plus spaces.
- -psl or --procnames-start-lines program type placed in front of a line of the program name.
- -sc or --start-left-side-of-comments on each line on the left side comment with an asterisk (*).
- -sob or --swallow-optional-blank-lines to remove the extra blank lines.
- -Ss or - space-special-semicolon if for or swile sector now has a line, the semicolon before adding a space.
- -st or --standard-output displays the result on the standard output device.
- -T data type name indent.
- -ts <cell number> or --tab-size <cell number> set the length of tab of.
- Display detailed information about the implementation -v or --verbose.
- -version Display version information.
Indent Code Formatting
Use the indent parameter | value | meaning |
---|---|---|
--blank-lines-after-declarations | bad | Variable sound Ming Houjia empty row |
--blank-lines-after-procedures | bap | After the function add blank lines |
--blank-lines-before-block-comments | bbb | Block comments preceded by a blank line |
--break-before-boolean-operator | bbo | Long lines, the logical operator before branch |
--blank-lines-after-commas | nbc | Variable declaration, a comma-separated variable does not branch |
--braces-after-if-line | bl | "If" and "{" divided to two lines |
--brace-indent 0 | bli0 | "{" Does not continue to indent |
--braces-after-struct-decl-line | bls | Definition of the structure, "struct" and "{" Branches |
--comment-indentationn | c33 | After the statement comment starts at row 33 |
--declaration-comment-columnn | cd33 | After the variable declarations comment starts at row 33 |
--comment-delimiters-on-blank-lines | ncdb | Not to single-line comments into block comments |
--cuddle-do-while | ncdw | "Do --- while" The "while" and its preceding "}" on a new line |
- Cuddle-else | nce | "Else" and its preceding "}" on a new line |
--case-indentation 0 | cli0 | switch in case statements into 0 spaces |
--else-endif-columnn | cp33 | #else, #endif comment following the start of the line 33 |
--space-after-cast | cs | Spaces after the type conversion |
- Line-comments-indentation n | d0 | Single-line comments (not from a beginning), not indented left |
- Break-function-decl-args | nbfda | Off: function parameters a row |
--declaration-indentationn | di2 | Variable declarations, variable starts at line 2, which do not have to align |
--format-first-column-comments | nfc1 | Do not format starting in a comment the first line |
--format-all-comments | nfca | Do not open all the formatting comments switch |
--honour-newlines | hnl | Prefer to break long lines at the position of newlines in the input. |
--indent-leveln | i4 | Set the indent number of characters, if the tab integral multiple use tab to indent, otherwise filled with spaces. |
--parameter-indentationn | ip5 | Old-style function definition Parameter Description indented five spaces |
--line-length 75 | l75 | Non-comment lines up to 75 |
--continue-at-parentheses | lp | Continuation from the brackets on the line appears to start |
--space-after-procedure-calls | pcs | Insert a space between the function and the "(" |
- Space-after-parentheses | nprs | In the "(" after ")," the former do not insert spaces |
- Procnames-start-lines | psl | The function name and return type on two lines define |
- Space-after-for | saf | for rear spaces |
--space-after-if | sai | Later if there are spaces |
--space-after-while | saw | Behind while spaces |
--start-left-side-of-comments | nsc | Block comment is not generated added * |
- Swallow-optional-blank-lines | nsob | Not removed you can add a blank line |
--space-special-semicolon | nss | Row for or while statement, the ";" before without air. |
--tab-size | ts4 | A tab of four spaces (to be divisible "-in") |
--use-tabs | ut | Use tab to indent |