Linux indent command details code formatter

Source: Internet
Author: User
Tags nfca
ArticleDirectory
    • Syntax
    • Description

My current format is

Indent-NPRO-GNU-I4-ts4-sob-L200-SS-bl-Bli 0-npsl filename

 

Http://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp? Topic=%2fcom.ibm.aix.cmds%2fdoc%2faixcmds3%2findent.htm

Http://www.gnu.org/software/indent/manual/html_chapter/indent_1.html

Indent command

Purpose

Reformat a C LanguageProgram.

Syntax

Indent Inputfile [ Outputfile ] [ -Nbad | -Bad ] [ -NBAP | -Bap ] [ -Nbbb | -Bbb ] [ -NBC | -BC ] [ -Br | -BL ] [ -C N ] [ -CD N ] [ -Ncdb | -CDB ] [ -Nce | -Ce ] [ -Ci N ] [ -Cli N ] [ -D N ] [ -Di N ] [-Ndj | -DJ ] [ -Nei | -Ei ] [ -Fa ] [ -NFA ] [ -Nfc1 | -FC1 ] [ -I N ] [ -NIP | -IP ] [ -L N ] [ -LC N ] [ -NLP |-Lp ] [ -NPRO ] [ -NPCs | -PCs ] [ -NPs | -Ps ] [ -Npsl | -PSL ] [ -NSC | -SC ] [ -Nsob | -Sob ] [ -Nslb | -SLB ] [ -St ] [ -Troff ] [ -NV | -V ] [ -T Type ]...

Description

IndentThe command reformats a c program in the format specified with the command input flag.

If you only specifyInputfileParameters, re-formatted file write backInputfileParameter andInputfileThe backup copy is written back to the current directory with the file name. BakSuffix.

If you specifyOutputfileParameters,ThenIndentThe command will run a check to ensure that its name matchesInputfileParameters are different.

ToIndentCommand to set your own default profile, and create a file named. Indent. ProFile. This file contains the logos you want to include, which are separated by spaces, tabs, or line breaks.

Current Directory . Indent. Pro The flag in the file overwrites those in your login directory ( -T Type Sign, It is cumulative ). If Indent Command to run and a profile exists. The profile is read to set the default configuration of the program. However, the flag on the command line overwrites the profile flag.

 

 

 

Function Description: Adjust original CCodeFile format.

Syntax: indent [parameter] [source file] or indent [parameter] [source file] [-O target file]
Note: Indent can identify and format the original code file of C to facilitate reading by programmers.
Parameters:
-Bad or-blank-lines-after-declarations add blank lines to the declaration section.
-Bap or-blank-lines-after-procedures in the program or add blank lines.
-BBB or-blank-lines-after-block-Comments add blank lines after the comment section.
-BC or-blank-lines-after-commas in the Declaration section, if there is a comma, It is a line break.
-BL or-braces-after-if-line if (or else, for, and so on) are different from the "{" and "}" in the subsequent execution section.
-Set the number of BLI <shrink cells> or-brace-indent <shrink cells>.
-Br or-braces-on-if-line if (or else, for, and so on) are different from the "{" and "}" in the subsequent execution of the segment.
-BS or-blank-before-sizeof is empty after sizeof.
-C <Number of columns> or-comment-indentation <Number of columns> place comments in the column specified on the right of the program code.
-CD <Number of columns> or-declaration-comment-column <Number of columns> place comments in the column specified on the right of the Declaration.
-CDB or-comment-delimiters-on-blank-lines comments are represented in a row.
-Ce or-cuddle-else places the else after "}" (the end of the IF execution segment.
-Ci <Number of reduced bins> or-continuation-indentation <Number of reduced bins> specifies the number of bins after a line break when the length is too long.
-When you use case-cli <shrink cells> or-case-indentation-<shrink cells> to use case, switch to shrink the number of cells.
-CP <Number of columns> or-else-endif-column <Number of columns> place comments in the column specified on the right of the else and elseif statements.
-Cs or-space-after-cast is empty after cast.
-D <Number of shrink cells> or-line-comments-indentation <Number of shrink cells> sets the number of shrink cells for comments not placed on the right of the program code.
-Di <Number of columns> or-declaration-indentation <Number of columns> places the variables of the Declaration section in the specified column.
-FC1 or-format-first-column-Comments: set the format of the comment placed at the top of each line.
-FCA or-format-all-Comments: set the format of all comments.
-GNU or-GNU-style specifies the GNU format, which is the default value.
-I <number of cells> or-indent-level <number of cells> sets the number of cells to be scaled down.
-IP <number of cells> or-parameter-indentation <number of cells> sets the number of cells to be scaled down.
-Kr or-K-and-R-style specifies the format of kernighan & Ritchie.
-LP or-continue-at-Parentheses describes long and line breaks. When the description contains an arc, the content of the starting column of each line in the arc is vertically arranged.
-Nbad or-no-blank-lines-after-declarations do not add blank lines after the declaration 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 blank lines after the comment section.
-In the Declaration section of-NBC or-no-blank-lines-after-commas, do not wrap the line even if a comma appears.
-Ncdb or-no-comment-delimiters-on-blank-lines annotator should not be a line of its own.
-Nce or-Dont-cuddle-else do not place the else after.
-NCs or-no-space-after-casts should not be empty 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 contract the nip or-no-parameter-indentation parameter.
-When NLP or-Dont-line-up-Parentheses statements are too long to wrap a line and the description contains an arc, you do not need to vertically arrange the start column of each line in the ARC.
-NPCs or-no-space-after-function-call-names do not add spaces after the called function name.
-NPRO or-ignore-profile should not read indent's configuration file. indent. Pro.
-Put the npsl or-Dont-break-procedure-type program type in the same line as the program name.
-Do not add an asterisk (*) to the left of the NSC or-Dont-star-Comments annotation (*).
-Nsob or-leave-optional-semicolon does not need to process redundant blank rows.
-Nss or-Dont-space-special-semicolon if the for or while section contains only one row, no space is added before the semicolon.
-NV or-no-verbosity does not display detailed information.
-Orig or-original uses the Berkeley format.
-PCs or-space-after-procedure-CILS Add a space between the called function name and.
-The PSL or-procnames-start-lines program type is placed in 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 Delete unnecessary blank lines.
-SS or-space-special-semicolon if there is a row in the for or swile section, add a space before the semicolon.
-St or-standard-output displays the result on the standard output device.
-T: the data type name is scaled down.
-Ts <number of cells> or-tab-size <number of cells> sets the length of the tab.
-V or-verbose displays detailed information during execution.
-Version: displays the version information.

 

 

 

Description of indent code formatting
Indent parameter used Value Description
-- Blank-lines-after-declarations Bad Add blank lines after variable Declaration
-- Blank-lines-after-Procedures Bap Add blank lines after function completion
-- Blank-lines-before-block-Comments Bbb Add blank lines before block comments
-- Break-before-Boolean-Operator BBO Long rows, before logical operators
-- Blank-lines-after-commas NBC In the variable declaration, variables separated by commas are not separated.
-- Braces-after-if-line BL "If" and "{" are divided into two rows.
-- Brace-indent 0 Bli0 "{" Do not continue indent
-- Braces-after-struct-Decl-line Bytes Define structure, "struct" and "{" Branch
-- Comment-indentationn C33 The comment after the statement starts at row 33.
-- Declaration-comment-columnn CD33 After the variable is declared, the Comment starts at row 33.
-- Comment-delimiters-on-blank-Lines Ncdb Do not change single-line comments to block comments
-- Cuddle-do-while Ncdw "Do --- while", "while" and "}" in front of it start with another line
-- Cuddle-Else NCE "Else" and "}" Start with another line
-- Case-indentation 0 Cli0 The case statement in the switch has 0 spaces.
-- Else-endif-columnn Cp33 # Else, # Note after endif starts at line 33
-- Space-after-cast CS Add space after type conversion
-- Line-comments-indentation n D0 Single Row comment (not starting from 1 column), not indented to left
-- Break-function-Decl-ARGs Nbfda Close: one row of function parameters
-- Declaration-indentationn Di2 Variable declaration. The variable starts in two rows, that is, it does not have to be aligned.
-- Format-first-column-Comments Nfc1 Do not format the comment starting from the first line
-- Format-all-Comments Nfca Disable the function of formatting all comments.
-- Honor-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 an integer multiple of the tabs, use the tab to indent. Otherwise, use spaces to fill the tab.
-- Parameter-indentationn IP5 In the old style function definition, the parameter description is Indented by five spaces.
-- Line-length 75 L75 The maximum number of non-commented rows is 75.
-- Continue-at-parentheses Lp The last line starts with parentheses.
-- Space-after-procedure-CILS PCs Insert a space between the function and "("
-- Space-after-parentheses NPRS Do not insert spaces before "(" ")"
-- Procnames-start-Lines Psl Define the function name and return type in two rows
-- Space-after- SAF For is followed by spaces.
-- Space-after-if Sai If is followed by a space
-- Space-after-while Saw While followed by Spaces
-- Start-left-side-of-Comments NSC Not adding * in the generated block comment *
-- Swallow-optional-blank-Lines Nsob Do not remove empty rows that can be added
-- Space-special-semicolon NSS The for or while statement of a row is not empty before.
-- Tab-size Ts4 A tab contains four spaces (to divide "-in ")
-- Use-Tabs UT Use tab to indent

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.