Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ indent(1) — A/UX 3.0.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cb(1)




indent(1) indent(1)
NAME indent - indents and formats C program source SYNOPSIS indent input [output] [-bc,-nbc] [-br,-bl] [-cn] [-cdn] [[-dj],-ndj] [-dn] [-in] [-ln] [-v,-nv] ARGUMENTS [-bc,-nbc] Causes a newline to be forced after each comma in a declaration. If -bc is specified, a newline will be forced after each comma in a declaration. If -nbc is specified, this option is turned off. The default is -bc. [-br,-bl] Specifies the format of complex statements. If -bl is specified, complex statements will be lined up like this: if (...) { code } If -br (the default) is specified, they will look like this: if (...) { code } -cn Specifies the column in which comments will start. Replace n with the column number. The default is 33. -cdn Specifies the column in which comments on declarations will start. Replace n with the column number. The default is for these comments to start in the same column as other comments. [-dj],-ndj Specifies the justification of the declarations. -dj will cause declarations to be left justified. -ndj will cause them to be indented the same as code. The default is -ndj. -dn Controls the placement of comments which are not to the right of code. Specifying -d2 means that such comments will be placed two indentation levels to the left of code. The default, -d1, places comments one indentation level to the left of code. -d0 lines up these comments with the code. See the section on January 1992 1



indent(1) indent(1)
comment indentation following. -in Specifies the number of spaces for one indentation level. Replace n with the number of spaces. The default is 4. input Specifies the file to be formatted. -ln Specifies the maximum length of an output line. Replace n with the length of the output line. The default is 75. output Specifies the results of the formatted input file. When specified, indent checks to make sure it is different from input. This option is not given, the formatted file will be written back into input and a ``backup'' copy of input will be written in the current directory. [-v],-nv Turns verbose mode on or off. -v turns on verbose mode, and -nv turns it off. When in verbose mode, indent will report when it splits one line of input into two or more lines of output, and it will give some size statistics at completion. The default is -nv. DESCRIPTION indent is intended primarily as a C program formatter. Specifically, indent can indent code lines, align comments, insert spaces around operators where necessary, and break up declaration lists as in inta,b,c;. The indent command will not break up long statements to make them fit within the maximum line length, but it will flag lines that are too long. Lines will be broken so that each statement starts a new line. Comments will be lined up one indentation level to the left of the code, and an attempt is made to line up identifiers in declarations. The options may appear before or after the file names. If input is named /blah/blah/file, the backup file will be named .Bfile. You may set up your own ``profile'' of defaults to indent by creating the file .indent.pro in your home directory and including whatever switches you like. If indent is run and a profile file exists, then it is read to set up the program's defaults. Switches on the command line, though, will always override profile switches. The profile file must be a single line of not more than 127 characters. The 2 January 1992



indent(1) indent(1)
switches should be separated on the line by spaces or tabs. Multiline expressions The indent command will not break up complicated expressions that extend over multiple lines, but it will usually correctly indent such expressions which have already been broken up. Such an expression might end up looking like this: x = ( (Arbitrary parenthesized expression) + ( (Parenthesized expression) * (Parenthesized expression) ) ); Comments The indent command recognizes four kinds of comments. They are: straight text, box comments, UNIX-style comments, and unchanged comments. The action taken with these various types are as follows: Straight Text All other comments are treated as straight text. The indent command will fit as many words (separated by blanks, tabs, or newlines) on a line as possible. Straight text comments will be indented. Box Comments The indent command assumes that any comment with a dash immediately after the start of comment (i.e. /*-) is a comment surrounded by a box of stars. Each line of such a comment will be left unchanged, except that the first nonblank character of each successive line will be lined up with the beginning slash of the first line. Box comments will be indented (see below). UNIX-style Comments This is the type of section header which is used extensively in the UNIX system source. If the start of comment (/*) appears on a line by itself, indent assumes that it is a UNIX-style comment. It will be treated similarly to box comments, except the first nonblank character on each line will be lined up with the ``*'' of the /*. Unchanged Comments January 1992 3



indent(1) indent(1)
Any comment which starts in column 1 will be left completely unchanged. This is intended primarily for documentation header pages. The check for unchanged comments is made before the check for UNIX-style comments. Comment Indentation Box, UNIX-style, and straight text comments may be indented. If a comment is on a line with code, it will be started in the comment column which is set by the -cn option. Otherwise, the comment will be started at n indentation levels less than where code is currently being placed, where n is specified by the -dn option. (Indented comments will never be placed in column 1.) If the code on a line extends past the comment column, the comment will be moved to the next line. LIMITATIONS The indent command does not know how to format ``long'' declarations. STATUS MESSAGES AND VALUES Status messages generally tell that a text line has been broken or is too long for the output line. FILES /usr/ucb/indent Executable file ~/.indent.pro Profile file SEE ALSO cb(1) 4 January 1992

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026