查看文件vim
就会看到:
#!/bin/sh
PARAM="-npro -kr -i8 -ts8 -sob -l80 -ss -ncs -cp1"
RES=`indent --version`
V1=`echo $RES | cut -d' ' -f3 | cut -d'.' -f1`
V2=`echo $RES | cut -d' ' -f3 | cut -d'.' -f2`
V3=`echo $RES | cut -d' ' -f3 | cut -d'.' -f3`
if [ $V1 -gt 2 ]; then
elif [ $V1 -eq 2 ]; then
fi
indent $PARAM "$@"
其中有一行:
-npro -kr -i8 -ts8 -sob -l80 -ss -ncs -cp1
这一行就是linux内核使用indent整理代码的格式。
其中-l80是每一行最多80个字母,超出会拆行,如果不喜欢可以使用更长的行字数
使用的indent参数 值 含义
--blank-lines-after-declarations
--blank-lines-after-procedures
--blank-lines-before-block-comments
--break-before-boolean-operator
--blank-lines-after-commas
--braces-after-if-line
--brace-indent 0
--braces-after-struct-decl-line
--comment-indentationn
--declaration-comment-columnn
--comment-delimiters-on-blank-lines
--cuddle-do-while
--cuddle-else
--case-indentation 0
--else-endif-columnn
--space-after-cast
--line-comments-indentation n
--break-function-decl-args
--declaration-indentationn
--format-first-column-comments
--format-all-comments
--honour-newlines
--indent-leveln
--parameter-indentationn
--line-length 75
--continue-at-parentheses
--space-after-procedure-calls
--space-after-parentheses
--procnames-start-lines
--space-after-for
--space-after-if
--space-after-while
--start-left-side-of-comments
--swallow-optional-blank-lines
--space-special-semicolon
--tab-size
--use-tabs