indent(1)							    indent(1)


  indent - indent and format C program source


  indent input [output] [flags]


  The indent command is intended primarily as a C program formatter.  Specif-
  ically, indent indents code lines, aligns comments, inserts spaces around
  operators where necessary and breaks up declaration lists as in ``int

  The indent command does not break up long statements to make them fit
  within the maximum line length, but it does flag lines that are too long.
  Lines are broken so that each statement starts a new line, and braces
  appear alone on a line.  Also, an attempt is made to line up identifiers in

  The flags that can be specified follow.  They can appear before or after
  the file names.  If the output file is omitted, the formatted file is writ-
  ten back into input and a ``backup'' copy of input is written in the
  current directory.  If input is named /blah/blah/file the backup file is
  named .Bfile.	 If output is specified, indent checks to make sure it
  differs from input.


  The following flags are used to control the formatting style imposed by

      Determines maximum length of output line.	 The default is 75.

      Determines column in which comments start.  The default is 33.

      Determines column in which comments on declarations start.  The default
      is for these comments to start in the same column as other comments.

      Determines number of spaces for one indentation level.  The default is

      Causes declarations to be left justified; -ndj causes them to be
      indented the same as code.  The default is -ndj.

      The v flag turns on ``verbose'' mode; -nv turns it off.  When in
      verbose mode, indent reports when it splits one line of input into two
      or more lines of output, and it gives some size statistics at comple-
      tion.  The default is  -nv .

      Forces newline after each comma in a declaration.	 The -nbc flag turns
      off this option.	The default is -bc.

      Controls the placement of comments which are not to the right of code.
      Specifying -d2 means that such comments are placed two indentation lev-
      els to the left of code.	The default -d0 lines up these comments with
      the code.	 See the section on comment indentation below.

      Specifying -bl causes complex statements to be lined up in a space
      order.  For example:

	      if (...)

      Specifying -br (the default) makes them look like this:

	      if (...) {

  You can set up your own ``profile'' of defaults to indent by creating the
  file ``'' in your login 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, always override profile switches.  The profile file must be a sin-
  gle line of not more than 127 characters.  The switches should be separated
  on the line by spaces or tabs.

  Multiline expressions

  The indent command does not break up complicated expressions that extend
  over multiple lines.	However, it usually indents such expressions that
  have already been broken up correctly.  Such an expression might look like
  the following:

       x =
	       (Arbitrary parenthesized expression)
		   (Parenthesized expression)
		   (Parenthesized expression)


  The indent command recognizes the four following kinds of comments:

   1.  Straight text.

   2.  ``Box'' comments.

   3.  UNIX-style comments.

   4.  Comments that should be passed through unchanged.

  The comments are interpreted as follows:

  ``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 is left unchanged,
	  except that the first non-blank character of each successive line
	  is lined up with the beginning slash of the first line.  Box com-
	  ments are indented, as described below.

  ``Unix-style'' comments
	  This type of section header 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.  These are
	  treated similarly to box comments, except that the first non-blank
	  character on each line is lined up with the `*' of the ``/*''.

  Unchanged comments
	  Any comment which starts in column 1 is 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.

  Straight text
	  All other comments are treated as straight text.  The indent com-
	  mand fits as many words (separated by blanks, tabs, or new lines)
	  on a line as possible.  Straight text comments are indented.

  Comment indentation

  Box, UNIX-style, and straight text comments may be indented.	If a comment
  is on a line with code it is started in the ``comment column,'' which is
  set by the -cnnn command line parameter.  Otherwise, the comment is started
  at nnn indentation levels less than where code is currently being placed,
  where nnn is specified by the -dnnn command line parameter.  (Indented com-
  ments are never placed in column 1.) If the code on a line extends past the
  comment column, the comment is moved to the next line.


  Does not know how to format ``long'' declarations.


  Diagnostic error messages, mostly to tell that a text line has been broken
  or is too long for the output line.

FILES Profile file


  Commands: cb(1)