Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the use of Linux's indent command

2025-03-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "what is the use of Linux's indent command". In daily operation, I believe many people have doubts about the use of Linux's indent command. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the question of "what is the use of Linux's indent command?" Next, please follow the editor to study!

Linux commonly used commands indent commands are used to adjust the format of C original code files. Indent can identify C original code files and format them to facilitate programmers to read the method.

Syntax indent [parameters] [source files] or indent [parameters] [source files] [- o target files] parameters:

-bad or-blank-lines-after-declarations the declaration section or add a blank line.

-bap or-blank-lines-after-procedures add blank lines to the program or.

-bbb or-blank-lines-after-block-comments add a blank line after the comment section.

-bc or-blank-lines-after-commas in the declaration section, wrap if there is a comma.

-bl or-braces-after-if-line if (or else,for, etc.) is different from the "{" line of the subsequent execution section, and "}" is on its own line.

-bli or-brace-indent sets the number of {} indentation.

-br or-braces-on-if-line if (or else,for, etc.) is a different line from the "{" that executes the lame segment, and the "}" has its own line.

-bs or-blank-before-sizeof a space after sizeof.

-c or-comment-indentation places the comment in the specified field on the right side of the code.

-cd or-declaration-comment-column places the comment in the field specified to the right of the declaration.

-cdb or-comment-delimiters-on-blank-lines comment symbols are on their own line.

-ce or-cuddle-else places the else after "}" (the end of the if execution section).

-ci or-continuation-indentation specifies the number of lines to indent after a line break when the description is too long to wrap.

The number of squares indented by switch when-cli or-case-indentation- uses case.

-cp or-else-endif-column places the comments in the field to the right of the else and elseif narratives.

-cs or-space-after-cast a space after cast.

-d or-line-comments-indentation sets the number of indented spaces for comments that are not placed on the right side of the code.

-di or-declaration-indentation places the variable that declares the section in the specified field.

-fc1 or-format-first-column-comments formats comments placed at the front of each line.

-fca or-format-all-comments sets the format of all comments.

-gnu or-gnu-style specifies the format that uses GNU, which is the default.

-I or-indent-level sets the number of squares for indentation.

-ip or-parameter-indentation sets the number of indents for the parameter.

-kr or-k-and-r-style specifies the format that uses Kernighan&Ritchie.

When the-lp or-continue-at-parentheses statement is too long to wrap, and the statement contains parentheses, the contents of the starting field of each line in the brackets are arranged vertically.

-nbad or-no-blank-lines-after-declarations do not add blank lines after declaring the section.

-nbap or-no-blank-lines-after-procedures do not add blank lines 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, do not wrap even if there is a comma.

-ncdb or-no-comment-delimiters-on-blank-lines comment symbols should not be on their own line.

-nce or-dont-cuddle-else do not put else after "}".

-ncs or-no-space-after-casts do not leave a space after cast.

-nfc1 or-dont-format-first-column-comments do not format comments placed at the front of each line.

-nfca or-dont-format-comments do not format any comments.

Do not indent the-nip or-no-parameter-indentation parameters.

When the-nlp or-dont-line-up-parentheses statement is too long to wrap, and the statement contains parentheses, it is not necessary to align the starting fields of each line vertically.

-npcs or-no-space-after-function-call-names do not add a space after the name of the called function.

-npro or-ignore-profile do not read the configuration file .indent.pro of indent.

The-npsl or-dont-break-procedure-type program type is placed on the same line as the program name.

Do not add an asterisk (*) to the left of the-nsc or-dont-star-comments comments.

-nsob or-leave-optional-semicolon do not have to deal with extra blank lines.

-nss or-dont-space-special-semicolon if the for or while section has only one line, do not precede the semicolon with a space.

-nv or-no-verbosity do not display detailed information.

-orig or-original uses the Berkeley format.

-pcs or-space-after-procedure-calls adds a space between the name of the called function and "{".

-psl or-procnames-start-lines program types are placed on the first line of the program name.

-sc or-start-left-side-of-comments add an asterisk (*) to the left of each line comment.

-sob or-swallow-optional-blank-lines removes extra blank lines.

-ss or-space-special-semicolon if there is a line in the for or swile section, add a space before the semicolon.

-st or-standard-output displays the results on the standard output device.

-T data type name indentation.

-ts or-tab-size sets the length of the tab.

-v or-verbose displays detailed information when it is executed.

-version displays version information.

Indent code format explains the meaning of indent parameter values used-blank-lines-after-declarationsbad variable declaration followed by blank line-blank-lines-after-proceduresbap function ended with blank line-blank-lines-before-block-commentsbbb block comment preceded by blank line-break-before-boolean-operatorbbo longer line, line before logical operator-blank-lines-after-commasnbc variable declaration Comma-separated variables do not break-braces-after-if-linebl "if" and "{" split into two lines-brace-indent 0bli0 "{" do not continue indenting-braces-after-struct-decl-linebls definition structure The comment after the "struct" and "{" branch-comment-indentationnc33 statement begins on line 33-declaration-comment-columnncd33 after the variable is declared, and begins on line 33-comment-delimiters-on-blank-linesncdb does not turn the single-line comment into a block comment-the "while" of cuddle-do-whilencdw "do-while" and the "}" before it-another line of cuddle-elsence "else" and the other line of the case statement in case-indentation 0cli0switch 0 spaces-else-endif-columnncp33#else Comments after # endif start at line 33-space-after-castcs followed by a space-line-comments-indentation nd0 single-line comment (not starting with column 1) Do not indent to the left-break-function-decl-argsnbfda off: the parameter of the function is declared on one line-declaration-indentationndi2 variable declaration, the variable starts at line 2, that is, it is not necessary to align-format-first-column-commentsnfc1 does not format comments from the first line-format-all-commentsnfca does not turn on the switch for all formatted comments-honour-newlineshnlPrefer to break long lines at the position of newlines in the input.-indent-levelni4 sets the number of characters to indent, if it is an integer multiple of tab, use tab to indent Otherwise, fill it with spaces. -parameters in the old parameter-indentationnip5 style function definition indicate indentation of 5 spaces-line-length 75l75 non-comment line longest 75-continue-at-parentheseslp continuation line starts with the parentheses that appear on the previous line-insert a space between the space-after-procedure-callspcs function and "("-space-after-parenthesesnprs does not insert a space before "(") "- procnames-start-linespsl puts the function name and return type on two lines definition-space- After-forsaffor followed by spaces-space-after-ifsaiif followed by spaces-space-after-whilesawwhile followed by spaces-start-left-side-of-commentsnsc does not add *-swallow-optional-blank-linesnsob to generated block comments, does not remove blank lines that can be added-for or while statements on one line of space-special-semicolonnss In " "No extra space in front of it. -tab-sizets4 a tab for 4 spaces (to be able to divide "- in")-use-tabsut uses tab to indent to this point, the study on "what is the use of Linux's indent command" is over, hoping to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report