Linux indent command details

Source: Internet
Author: User
Tags nfca

My current format is
-Kr-i4-ts4-nsob-l80-ss-ncs-cp1-bap-nbc-bl-bli0-ncdb-ncdw-nce-cli0-d0-pcs-nprs-saf -sai-saw-nss


Indent command
Purpose

Reformat a C-language program.

Syntax
Indent InputFile [OutputFile] [-nbad |-bad] [-nbap |-bap] [-nbbb |-bbb] [-nbc |-bc] [-br |-bl] [-cn] [-cdn] [-ncdb |-cdb] [-nce |-ce] [-cin] [-clin] [-dn] [-din] [- ndj |-dj] [-nei |-ei] [-fa] [-nfa] [-nfc1 |-fc1] [-in] [-nip |-ip] [- ln] [-lcn] [-nlp |-lp] [-npro] [-npcs |-pcs] [-nps |-ps] [-npsl |-psl] [- nsc |-SC] [-nsob |-sob] [-nslb |-slb] [-st] [-troff] [-nv |-v] [-TType] ...

Description
The indent command reformats a c program in the format specified with the command input flag.

If only the InputFile parameter is specified, the reformatted file is written back to the InputFile parameter, and the backup copy of an InputFile is written back to the current directory. The file name is suffixed with. BAK.

If the OutputFile parameter is specified, the indent command runs a check to ensure that its name is different from that of the InputFile parameter.

To set your own default profile for the indent command, create a file named. indent. pro in your logon directory or the current directory. This file contains the logos you want to include, which are separated by spaces, tabs, or line breaks.

The. indent. pro files in the current directory overwrite those in your logon directory (except the-T Type flag, which is cumulative ). If the indent command is 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: adjusts the format of the original C code file.
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
Description of the indent parameter value used
-- Blank-lines-after-declarations: Add blank lines after the bad variable Declaration
-- Add blank lines after the blank-lines-after-procedures bap function is completed
-- Blank-lines-before-block-comments: Add blank lines before the bbb block comment.
-- Break-before-boolean-operator bbo long row, Branch before logical operators
-- In the blank-lines-after-commas nbc 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 topology defines the structure, "struct" and "{" Branch
-- Comment-indentationn c33 statement and the comment starts at row 33
-- Declaration-comment-columnn cd33 variable declaration and Comments start at row 33
-- Comment-delimiters-on-blank-lines ncdb does not change a single row comment to a block comment
-- Cuddle-do-while ncdw "do --- while" "while" and "}" before it start with another line
-- Cuddle-else nce "else" and "}" Start with another line
-- Case-indentation 0 the case statement in cli0 switch has 0 spaces.
-- Else-endif-columnn cp33 # else, # The comments after endif start at row 33.
-- Space-after-cast cs: add space after type conversion
-- Line-comments-indentation n d0 single row comment (not starting from column 1), not indented to the left
-- Disable break-function-decl-args nbfda: one row of function parameters.
-- Declaration-indentationn di2 variable declaration. The variable starts from two rows, that is, the alignment is unnecessary.
-- Format-first-column-comments nfc1 does not format the comment starting from the first line
-- Format-all-comments nfca does not enable 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: specifies the number of indentations. If it is an integer multiple of the tabs, tab is used for indenting. Otherwise, spaces are used for filling.
-- Parameter-indentationn ip5 the parameter description in the old style function definition is Indented by five spaces
-- Line-length 75 l75 non-Comments rows up to 75
-- Continue-at-parentheses lp start from the parentheses in the last row
-- Space-after-procedure-callpcs function and insert a space "("
-- Space-after-parentheses nprs inserts no space before "(" ")"
-- Procnames-start-lines psl put the function name and return type in two rows for definition
-- Space-after-for saf for is followed by a space
-- Space-after-if sai if is followed by a space
-- Space-after-while saw while is followed by a space
-- Start-left-side-of-comments nsc is not added to the generated block comment *
-- Swallow-optional-blank-lines nsob do not remove the added blank lines
-- Space-special-semicolon nss: for or while statement in a row, no blank before.
-- Tab-size ts4 a tab has four spaces (to be able to exclude "-in ")
-- Use-tabs ut use tab to indent


Author siriurs28

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.