📄 indent.1
字号:
.\" SCCSID: @(#)indent.1 8.1 9/11/90.TH indent 1.SH Nameindent \- indent and format C program source.SH Syntax.B indent\fIinput\fR[\|\fIoutput\fR\|] [\|\fIflags\fR\|].SH Description.NXB "indent command".NXB "C program" "formatting"The.PN indentcommandis intended primarily as a C program formatter.Specifically,.PN indentindents code lines,aligns comments,inserts spaces around operators where necessary andbreaks up declaration lists as in ``int a,b,c;''..PPThe.PN indentcommanddoes not break up long statements to make them fit within themaximum line length, but it does flag lines that are too long. Linesare broken so that each statement starts a new line, and bracesappear alone on a line. Also, an attempt is made to line up identifiers in declarations..PPThe .I flagsthat can be specified follow. Theycan appear before or after the file names.If the.I outputfile is omitted, the formatted file is writtenback into.I inputand a ``backup'' copy of.I inputis written in the current directory.If.I inputis named ``/blah/blah/file'',the backup file isnamed ``.Bfile''.If.I outputis specified,.PN indentchecks to make sure it is different from.IR input ..SH Options.NXR "indent command" "options"The following options are used to control the formattingstyle imposed by.PN indent :.IP \fB\-l\fInnn\fR 12Determines maximum length of output line. The default is 75..IP \fB\-c\fInnn\fR Determines column in which comments start. The default is 33..IP \fB\-cd\fInnn\fR Determines column in which comments on declarations start. The defaultis for these comments to start in the same column as other comments..IP \fB\-i\fInnn\fR Determines number of spaces for one indentation level. The default is 4..IP \fB\-\|dj,\-\|ndj\fR Causes declarations to be left justified. .B \-ndjcausesthem to be indented the same as code. The default is.BR \-ndj ..IP \fB\-\|v,\-\|nv\fR .B \-v turns on ``verbose'' mode,.B \-nvturns it off. When in verbose mode,.PN indentreports when it splits one line of input into two or more lines of output,and it gives some size statistics at completion. The default is.BR \-nv ..IP \fB\-\|bc,\-\|nbc\fR Forces newline after each comma in a declaration. .B \-nbcturns off this option. The default is.BR \-bc ..IP \fB\-d\fInnn\fR Controls the placement of commentswhich are not to the right of code.Specifying.B \-d2means that such comments are placed twoindentation levels to the left of code.The default.B \-d0lines up these comments with the code.See the section on comment indentation below..IP \fB\-\|br,\-\|bl\fR Specifying.B \-blcausescomplex statements to be lined up in a space order. For example, .EX if (...) { code }.EESpecifying.B \-br(the default) makes them look like this:.EX if (...) { code }.EE.PPYou may set up your own ``profile'' of defaults to.PN indentby creating the file ``.indent.pro'' in your login directoryand including whatever switches you like..NXR "indent command" "setting default formatting"If.PN indentis run and a profile file exists, then it is readto set up the program's defaults.Switches on the command line, though,always override profile switches.The profilefile must be a single line of not more than 127 characters.The switches should be separated on the line by spaces or tabs..PP.B Multiline expressions.NXR "indent command" "multiline expressions and".PPThe.PN indentcommanddoes not break up complicated expressions that extend over multiplelines. However, it usually indents such expressions that havealready been broken up correctly.Such an expression might look like the following:.EXx = ( (Arbitrary parenthesized expression) + ( (Parenthesized expression) * (Parenthesized expression) ) );.EE.PP.B Comments.NXR "indent command" "comments recognized".PPThe.PN indentcommandrecognizes the following four kinds of comments:.TP 41)straight text.TP2)``box'' comments.TP3)UNIX-style comments.TP4) comments that should be passed through unchanged.PPThe comments are interpreted as follows:.TP 20.I ``Box'' commentsThe.PN indentcommand assumes that any comment with a dashimmediately after the start of comment (i.e. ``/*\-'')is a comment surrounded by a box of stars. Each lineof such a comment is left unchanged,except that the first non-blankcharacter of each successive line is lined up with the beginningslash of the first line. Box comments are indented (see below)..TP.I ``Unix-style'' commentsThis is the type of section header which is used extensively in the UNIX system source. If the startof comment (``/*'') appears on aline by itself, .PN indentassumes that it is aUNIX-style comment. These aretreated similarly to box comments, exceptthe first non-blank character on eachline is lined up with the `*' of the ``/*''..TP.I Unchanged commentsAny comment which starts in column 1 is left completelyunchanged. This is intended primarily for documentation header pages.The check for unchanged comments is made beforethe check for UNIX-style comments..TP.I Straight textAll other comments are treated as straight text. .I Indentfitsas many words (separated by blanks,tabs, or new lines) on a line as possible.Straight text comments are indented..PP.B Comment indentation.PPBox, UNIX-style, and straight text comments may be indented.If a comment is on a linewith code it is started in the ``commentcolumn'', which is set by the.B \-cnnncommand line parameter.Otherwise, thecomment is started at .I nnnindentation levels less than where code iscurrently being placed, where.I nnnis specified by the.B \-dnnncommand line parameter. (Indentedcomments is never be placed in column 1.)If the code on a line extends past the comment column,the comment is moved to the next line..SH Restrictions.NXR "indent command" "restricted"Does not know how to format ``long'' declarations..SH Diagnostics.NXR "indent command" "diagnostics"Diagnostic error messages, mostly totell that a text line has been brokenor is too long for the output line..SH Files.DT\&.indent.pro profile file.NXE "indent command".NXE "C program" "formatting"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -