English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The Linux indent command is used to adjust the format of C original code files.
The Linux indent command is used to adjust the format of C original code files.
indent [parameters][source file] or indent [parameters][source file][-o Target file]
Parameters:
Indent parameter used | Value | Meaning |
---|---|---|
--blank-lines-after-declarations | bad | Add an empty line after variable declarations |
--blank-lines-after-procedures | bap | Add an empty line after the function ends |
--blank-lines-before-block-comments | bbb | Add an empty line before block comments |
--break-before-boolean-operator | bbo | Long lines are broken before logical operators |
--blank-lines-after-commas | nbc | In variable declarations, variables separated by commas do not break into lines |
--braces-after-if-line | bl | "if" and "{" are split into two lines |
--brace-indent 0 | bli0 | "{" does not continue to indent |
--braces-after-struct-decl-line | bls | Define structures, "struct" and "{" are split into two lines |
--comment-indentationn | c33 | Comments after statements start at line33 |
--declaration-comment-columnn | cd33 | Comments after variable declarations start at line33 |
--comment-delimiters-on-blank-lines | ncdb | Do not change single-line comments to block comments |
--cuddle-do-while | ncdw | "do --- The "while" in "while" and the preceding "}" start on a new line |
--cuddle-else | nce | "else" and the preceding "}" start on a new line |
--case-indentation 0 | cli0 | 0 spaces for case statements within switch |
--else-endif-columnn | cp33 | Comments after #else, #endif start at line33 |
--space-after-cast | cs | Add a space after type conversion |
--line-comments-indentation n | d0 | Single-line comments (do not indent from1Column starting), do not indent to the left |
--break-function-decl-args | nbfda | Disable: One parameter per line for function arguments |
--declaration-indentationn | di2 | Variable declaration, variable starts at2Line, that is, it is not necessary to align. |
--format-first-column-comments | nfc1 | Do not format comments starting from the first line. |
--format-all-comments | nfca | Do not enable the switch for full formatting of comments. |
--honour-newlines | hnl | Prefer to break long lines at the position of newlines in the input. |
--indent-leveln | i4 | Set the number of characters to indent, if it is a multiple of tab, use tab to indent, otherwise fill with spaces. |
--parameter-indentationn | ip5 | Parameter description indentation in old-style function definitions5spaces |
--line-length 75 | l75 | The longest non-comment line75 |
--continue-at-parentheses | lp | Continuation lines start from the parentheses on the previous line |
--space-after-procedure-calls | pcs | Insert a space between the function and "(" |
--space-after-parentheses | nprs | Do not insert space between "(" and ")" after ")" |
--procnames-start-lines | psl | Place the function name and return type on two lines in the definition |
--space-after-for | saf | There is space after the word "for" |
--space-after-if | sai | There is space after the word "if" |
--space-after-while | saw | There is space after the word "while" |
--start-left-side-of-comments | nsc | Do not add space in the generated block comments* |
--swallow-optional-blank-lines | nsob | Do not remove the optional blank lines |
--space-special-semicolon | nss | a for or while statement in a line, do not add space before ";" |
--tab-size | ts4 | one tab is4an empty space(It should be divisible by")-in") |
--use-tabs | ut | Use tab to indent |