Linux indent命令用于調(diào)整C原始代碼文件的格式。
indent可辨識C的原始代碼文件,并加以格式化,以方便程序設計師閱讀。
indent [參數(shù)][源文件] 或 indent [參數(shù)][源文件][-o 目標文件]
參數(shù):
使用的indent參數(shù) | 值 | 含義 |
---|---|---|
--blank-lines-after-declarations | bad | 變量聲明后加空行 |
--blank-lines-after-procedures | bap | 函數(shù)結(jié)束后加空行 |
--blank-lines-before-block-comments | bbb | 塊注釋前加空行 |
--break-before-boolean-operator | bbo | 較長的行,在邏輯運算符前分行 |
--blank-lines-after-commas | nbc | 變量聲明中,逗號分隔的變量不分行 |
--braces-after-if-line | bl | "if"和"{"分做兩行 |
--brace-indent 0 | bli0 | "{"不繼續(xù)縮進 |
--braces-after-struct-decl-line | bls | 定義結(jié)構(gòu),"struct"和"{"分行 |
--comment-indentationn | c33 | 語句后注釋開始于行33 |
--declaration-comment-columnn | cd33 | 變量聲明后注釋開始于行33 |
--comment-delimiters-on-blank-lines | ncdb | 不將單行注釋變?yōu)閴K注釋 |
--cuddle-do-while | ncdw | "do --- while"的"while"和其前面的"}"另起一行 |
--cuddle-else | nce | "else"和其前面的"}"另起一行 |
--case-indentation 0 | cli0 | switch中的case語句所進0個空格 |
--else-endif-columnn | cp33 | #else, #endif后面的注釋開始于行33 |
--space-after-cast | cs | 在類型轉(zhuǎn)換后面加空格 |
--line-comments-indentation n | d0 | 單行注釋(不從1列開始的),不向左縮進 |
--break-function-decl-args | nbfda | 關閉:函數(shù)的參數(shù)一個一行 |
--declaration-indentationn | di2 | 變量聲明,變量開始于2行,即不必對齊 |
--format-first-column-comments | nfc1 | 不格式化起于第一行的注釋 |
--format-all-comments | nfca | 不開啟全部格式化注釋的開關 |
--honour-newlines | hnl | Prefer to break long lines at the position of newlines in the input. |
--indent-leveln | i4 | 設置縮進多少字符,如果為tab的整數(shù)倍,用tab來縮進,否則用空格填充。 |
--parameter-indentationn | ip5 | 舊風格的函數(shù)定義中參數(shù)說明縮進5個空格 |
--line-length 75 | l75 | 非注釋行最長75 |
--continue-at-parentheses | lp | 續(xù)行從上一行出現(xiàn)的括號開始 |
--space-after-procedure-calls | pcs | 函數(shù)和"("之間插入一個空格 |
--space-after-parentheses | nprs | 在"("后")"前不插入空格 |
--procnames-start-lines | psl | 將函數(shù)名和返回類型放在兩行定義 |
--space-after-for | saf | for后面有空格 |
--space-after-if | sai | if后面有空格 |
--space-after-while | saw | while后面有空格 |
--start-left-side-of-comments | nsc | 不在生成的塊注釋中加* |
--swallow-optional-blank-lines | nsob | 不去掉可添加的空行 |
--space-special-semicolon | nss | 一行的for或while語句,在";"前不加空。 |
--tab-size | ts4 | 一個tab為4個空格(要能整除"-in") |
--use-tabs | ut | 使用tab來縮進 |