[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1. The indent Program

can be used to make code easier to read. It can also convert from one style of writing C to another.

indent understands a substantial amount about the syntax of C, but it also attempts to cope with incomplete and misformed syntax.

In version 1.2 and more recent versions, the GNU style of indenting is the default.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1 Invoking indent

As of version 1.3, the format of the indent command is:

 
indent [options] [input-files]

indent [options] [single-input-file] [-o output-file]

This format is different from earlier versions and other versions of indent.

In the first form, one or more input files are specified. indent makes a backup copy of each file, and the original file is replaced with its indented version. See section Backup Files, for an explanation of how backups are made.

In the second form, only one input file is specified. In this case, or when the standard input is used, you may specify an output file after the ‘-o’ option.

To cause indent to write to standard output, use the ‘-st’ option. This is only allowed when there is only one input file, or when the standard input is used.

If no input files are named, the standard input is read for input. Also, if a filename named ‘-’ is specified, then the standard input is read.

As an example, each of the following commands will input the program ‘slithy_toves.c’ and write its indented text to ‘slithy_toves.out’:

 
indent slithy_toves.c -o slithy_toves.out

indent -st slithy_toves.c > slithy_toves.out

cat slithy_toves.c | indent -o slithy_toves.out

Most other options to indent control how programs are formatted. As of version 1.2, indent also recognizes a long name for each option name. Long options are prefixed by either ‘--’ or ‘+’.(1) In most of this document, the traditional, short names are used for the sake of brevity. See section Option Summary, for a list of options, including both long and short names.

Here is another example:

 
indent -br test/metabolism.c -l85

This will indent the program ‘test/metabolism.c’ using the ‘-br’ and ‘-l85’ options, write the output back to ‘test/metabolism.c’, and write the original contents of ‘test/metabolism.c’ to a backup file in the directory ‘test’.

Equivalent invocations using long option names for this example would be:

 
indent --braces-on-if-line --line-length185 test/metabolism.c

indent +braces-on-if-line +line-length185 test/metabolism.c

If you find that you often use indent with the same options, you may put those options into a file named ‘.indent.pro’. indent will first look for ‘.indent.pro’ in the current directory and use that if found. Otherwise, indent will search your home directory for ‘.indent.pro’ and use that file if it is found. This behavior is different from that of other versions of indent, which load both files if they both exist.

The format of .indent.pro is simply a list of options, just as they would appear on the command line, separated by white space (tabs, spaces, and newlines). Options in .indent.pro may be surrounded by C or C++ comments, in which case they are ignored.

Most command line switches are handled after processing ‘.indent.pro’. Options specified later override arguments specified earlier, with one exception: Explicitly specified options always override background options (see section Common styles).

You can prevent indent from reading an ‘.indent.pro’ file by specifying the ‘-npro’ option.

Alternatively, you can tell indent to read a profile from any file using the ‘--profile’ option. The option accepts a parameter which can be either an absolute pathname (beginning with a ‘/’), or relative. If the pathname is relative, indent searches in the current and home directories just like the ‘.indent.pro’ file. The ‘-npro’ option overrides this, as well.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2 Backup Files

As of version 1.3, GNU indent makes GNU–style backup files, the same way GNU Emacs does. This means that either simple or numbered backup filenames may be made.

Simple backup file names are generated by appending a suffix to the original file name. The default for the this suffix is the one-character string ‘~’ (tilde). Thus, the backup file for ‘python.c’ would be ‘python.c~’.

Instead of the default, you may specify any string as a suffix by setting the environment variable SIMPLE_BACKUP_SUFFIX to your preferred suffix.

Numbered backup versions of a file ‘momewraths’ look like ‘momewraths.c.~23~’, where 23 is the version of this particular backup. When making a numbered backup of the file ‘src/momewrath.c’, the backup file will be named ‘src/momewrath.c.~V~’, where V is one greater than the highest version currently existing in the directory ‘src’.

The type of backup file made is controlled by the value of the environment variable VERSION_CONTROL. If it is the string ‘simple’, then only simple backups will be made. If its value is the string ‘numbered’, then numbered backups will be made. If its value is ‘numbered-existing’, then numbered backups will be made if there already exist numbered backups for the file being indented; otherwise, a simple backup is made. If VERSION_CONTROL is not set, then indent assumes the behavior of ‘numbered-existing’.

Other versions of indent use the suffix ‘.BAK’ in naming backup files. This behavior can be emulated by setting SIMPLE_BACKUP_SUFFIX to ‘.BAK’.

Note also that other versions of indent make backups in the current directory, rather than in the directory of the source file as GNU indent now does.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.3 Common styles

There are several common styles of C code, including the GNU style, the Kernighan & Ritchie style, and the original Berkeley style. A style may be selected with a single background option, which specifies a set of values for all other options. However, explicitly specified options always override options implied by a background option.

As of version 1.2, the default style of GNU indent is the GNU style. Thus, it is no longer necessary to specify the option ‘-gnu’ to obtain this format, although doing so will not cause an error. Option settings which correspond to the GNU style are:

 
-nbad -bap -nbc -bl -ncdb -cs -nce -di2 -ndj
-ei -nfc1 -i2 -ip5 -lp -pcs -npsl -psl -nsc -nsob -bli2
-cp1 -nfca

The GNU coding style is that preferred by the GNU project. It is the style that the GNU Emacs C mode encourages and which is used in the C portions of GNU Emacs. (People interested in writing programs for Project GNU should get a copy of The GNU Coding Standards, which also covers semantic and portability issues such as memory usage, the size of integers, etc.)

The Kernighan & Ritchie style is used throughout their well-known book The C Programming Language. It is enabled with the ‘-kr’ option. The Kernighan & Ritchie style corresponds to the following set of options:

 
-nbad -bap -nbc -br -c33 -cd33 -ncdb -ce -ci4
-cli0 -cp33 -d0 -di1 -nfc1 -nfca -i4 -ip0 -l75 -lp
-npcs -npsl -nsc -nsob -nss -cs

Kernighan & Ritchie style does not put comments to the right of code in the same column at all times (nor does it use only one space to the right of the code), so for this style indent has arbitrarily chosen column 33.

The style of the original Berkeley indent may be obtained by specifying ‘-orig’ (or by specifying ‘--original’, using the long option name). This style is equivalent to the following settings:

 
-nbap -nbad -bc -br -c33 -cd33 -cdb -ce -ci4
-cli0 -cp33 -di16 -fc1 -fca -i4 -ip4 -l75 -lp
-npcs -psl -sc -nsob -nss -ts8

The Linux style is used in the Linux kernel and drivers. It is enabled with the ‘-linux’ option (or by specifying ‘--linux-style’. This style is equivalent to the following settings:

 
-nbad -bap -nbc -bbo -hnl -br -brs -c33 -cd33 -ncdb -ce -ci4
-cli0 -d0 -di1 -nfc1 -i8 -ip0 -l80 -lp -npcs -nprs -npsl -sai
-saf -saw -ncs -nsc -sob -nfca -cp33 -ss -ts8 -il1

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.4 Blank lines

Various programming styles use blank lines in different places. indent has a number of options to insert or delete blank lines in specific places.

The ‘-bad’ option causes indent to force a blank line after every block of declarations. The ‘-nbad’ option causes indent not to force such blank lines.

The ‘-bacc’ option forces a blank line after (before) every ifdef group. The ‘-nbacc’ option forces no such blank line.

The ‘-bap’ option forces a blank line after every procedure body. The ‘-nbap’ option forces no such blank line.

The ‘-bbb’ option forces a blank line before every boxed comment. (see section Comments) The ‘-nbbb’ option does not force such blank lines.

The ‘-sob’ option causes indent to swallow optional blank lines (that is, any optional blank lines present in the input will be removed from the output). If the ‘-nsob’ is specified, any blank lines present in the input file will be copied to the output file.

For example, given the input

 
char *foo;
char *bar;
/* This separates blocks of declarations.  */
int baz;

indent -bad produces

 
char *foo;
char *bar;

/* This separates blocks of declarations.  */
int baz;

and indent -nbad produces

 
char *foo;
char *bar;
/* This separates blocks of declarations.  */
int baz;

The ‘-bap’ option forces a blank line after every procedure body.

For example, given the input

 
int
foo ()
{
  puts("Hi");
}
/* The procedure bar is even less interesting.  */
char *
bar ()
{
  puts("Hello");
}

indent -bap produces

 
int
foo ()
{
  puts ("Hi");
}

/* The procedure bar is even less interesting.  */
char *
bar ()
{
  puts ("Hello");
}

and indent -nbap produces

 
int
foo ()
{
  puts ("Hi");
}
/* The procedure bar is even less interesting.  */
char *
bar ()
{
  puts ("Hello");
}

No blank line will be added after the procedure foo.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.5 Comments

indent formats both C and C++ comments. C comments are begun with ‘/*’, terminated with ‘*/’ and may contain newline characters. C++ comments begin with the delimiter ‘//’ and end at the newline.

indent handles comments differently depending upon their context. indent attempts to distinguish amongst comments which follow statements, comments which follow declarations, comments following preprocessor directives, and comments which are not preceded by code of any sort, i.e., they begin the text of the line (although not necessarily in column 1).

indent further distinguishes between comments found outside of procedures and aggregates, and those found within them. In particular, comments beginning a line found within a procedure will be indented to the column at which code is currently indented. The exception to this a comment beginning in the leftmost column; such a comment is output at that column.

indent attempts to leave boxed comments unmodified. The general idea of such a comment is that it is enclosed in a rectangle or ”box” of stars or dashes to visually set it apart. More precisely, boxed comments are defined as those in which the initial ‘/*’ is followed immediately by the character ‘*’, ‘=’, ‘_’, or ‘-’, or those in which the beginning comment delimiter (‘/*’) is on a line by itself, and the following line begins with a ‘*’ in the same column as the star of the opening delimiter.

Examples of boxed comments are:

 
/**********************
 * Comment in a box!! *
 **********************/

       /*
        * A different kind of scent,
        * for a different kind of comment.
        */

indent attempts to leave boxed comments exactly as they are found in the source file. Thus the indentation of the comment is unchanged, and its length is not checked in any way. The only alteration made is that an embedded tab character may be converted into the appropriate number of spaces.

If the ‘-bbb’ option is specified, all such boxed comments will be preceded by a blank line, unless such a comment is preceded by code.

Comments which are not boxed comments may be formatted, which means that the line is broken to fit within a right margin and left-filled with whitespace. Single newlines are equivalent to a space, but blank lines (two or more newlines in a row) are taken to mean a paragraph break. Formatting of comments which begin after the first column is enabled with the ‘-fca’ option. To format those beginning in column one, specify ‘-fc1’. Such formatting is disabled by default.

The right margin for formatting defaults to 78, but may be changed with the ‘-lc’ option. If the margin specified does not allow the comment to be printed, the margin will be automatically extended for the duration of that comment. The margin is not respected if the comment is not being formatted.

If the comment begins a line (i.e., there is no program text to its left), it will be indented to the column it was found in unless the comment is within a block of code. In that case, such a comment will be aligned with the indented code of that block (unless the comment began in the first column). This alignment may be affected by the ‘-d’ option, which specifies an amount by which such comments are moved to the left, or unindented. For example, ‘-d2’ places comments two spaces to the left of code. By default, comments are aligned with code, unless they begin in the first column, in which case they are left there by default – to get them aligned with the code, specify ‘-fc1’.

Comments to the right of code will appear by default in column 33. This may be changed with one of three options. ‘-c’ will specify the column for comments following code, ‘-cd’ specifies the column for comments following declarations, and ‘-cp’ specifies the column for comments following preprocessor directives #else and #endif.

If the code to the left of the comment exceeds the beginning column, the comment column will be extended to the next tabstop column past the end of the code, or in the case of preprocessor directives, to one space past the end of the directive. This extension lasts only for the output of that particular comment.

The ‘-cdb’ option places the comment delimiters on blank lines. Thus, a single line comment like /* Claustrophobia */ can be transformed into:

 
/*
   Claustrophobia
 */

Stars can be placed at the beginning of multi-line comments with the ‘-sc’ option. Thus, the single-line comment above can be transformed (with ‘-cdb -sc’) into:

 
/*
 * Claustrophobia
 */

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.6 Statements

The ‘-br’ or ‘-bl’ option specifies how to format braces.

The ‘-br’ option formats statement braces like this:

 
if (x > 0) {
  x--;
}

The ‘-bl’ option formats them like this:

 
if (x > 0)
  {
    x--;
  }

These options also affect structure and enumeration declarations. The ‘-br’ option produces structure declarations like the following:

 
struct Sname {
    int i;
    char chp;
} Vname;

The default behavior, also obtained by specifying ‘-bl’, would yield the following format for the same declaration:

 
struct Sname
  {
     int i;
     char chp;
  }
Vname;

If you use the ‘-bl’ option, you may also want to specify the ‘-bli’ option. This option specifies the number of spaces by which braces are indented. ‘-bli2’, the default, gives the result shown above. ‘-bli0’ results in the following:

 
if (x > 0)
{
  x--;
}

If you are using the ‘-br’ option, you probably want to also use the ‘-ce’ option. This causes the else in an if-then-else construct to cuddle up to the immediately preceding ‘}’. For example, with ‘-br -ce’ you get the following:

 
if (x > 0) {
  x--;
} else {
  fprintf (stderr, "...something wrong?\n");
}

With ‘-br -nce’ that code would appear as

 
if (x > 0) {
  x--;
}
else {
  fprintf (stderr, "...something wrong?\n");
}

The ‘-cdw’ option causes the while in a do-while loop to cuddle up to the immediately preceding ‘}’. For example, with ‘-cdw’ you get the following:

 
do {
  x--;
} while (x);

With ‘-ncdw’ that code would appear as

 
do {
  x--;
}
while (x);

The ‘-cli’ option specifies the number of spaces that case labels should be indented to the right of the containing ‘switch’ statement.

The default setting gives code like:

 
switch (i)
  {
  case 0:
    break;
  case 1:
    {
      ++i;
    }
  default:
    break;
  }

Using the ‘-cli2’ option that would become:

 
switch (i)
  {
    case 0:
      break;
    case 1:
      {
        ++i;
      }
    default:
      break;
  }

The indentation of the braces below a case statement can be controlled with the ‘-cbin’ option. For example, using ‘-cli2 -cbi0’ results in:

 
switch (i)
  {
    case 0:
      break;
    case 1:
    {
      ++i;
    }
    default:
      break;
  }

If a semicolon is on the same line as a for or while statement, the ‘-ss’ option will cause a space to be placed before the semicolon. This emphasizes the semicolon, making it clear that the body of the for or while statement is an empty statement. -nss disables this feature.

The ‘-pcs’ option causes a space to be placed between the name of the procedure being called and the ‘(’ (for example, puts ("Hi");. The ‘-npcs’ option would give puts("Hi");).

If the ‘-cs’ option is specified, indent puts a space after a cast operator.

The ‘-bs’ option ensures that there is a space between the keyword sizeof and its argument. In some versions, this is known as the ‘Bill_Shannon’ option.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.7 Declarations

By default indent will line up identifiers, in the column specified by the ‘-di’ option. For example, ‘-di16’ makes things look like:

 
int             foo;
char           *bar;

Using a small value (such as one or two) for the ‘-di’ option can be used to cause the identifiers to be placed in the first available position, for example

 
int foo;
char *bar;

The value given to the ‘-di’ option will still affect variables which are put on separate lines from their types, for example ‘-di2’ will lead to

 
int
  foo;

If the ‘-bc’ option is specified, a newline is forced after each comma in a declaration. For example,

 
int a,
  b,
  c;

With the ‘-nbc’ option this would look like

 
int a, b, c;

The ‘-psl’ option causes the type of a procedure being defined to be placed on the line before the name of the procedure. This style is required for the etags program to work correctly, as well as some of the c-mode functions of Emacs.

You should use the ‘-T’ option to tell indent the name of all the type-names in your program that are defined by typedef. ‘-T’ can be specified more than once, and all names specified are used. For example, if your program contains

 
typedef unsigned long CODE_ADDR;
typedef enum {red, blue, green} COLOR;

you would use the options ‘-T CODE_ADDR -T COLOR’.

You may also use the ‘-ta’ option to tell indent to interpret identifiers ending with “_t” as if they were type-names declared by ‘-T’.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.8 Indentation

One issue in the formatting of code is how far each line should be indented from the left margin. When the beginning of a statement such as if or for is encountered, the indentation level is increased by the value specified by the ‘-i’ option. For example, use ‘-i8’ to specify an eight character indentation for each level. When a statement is broken across two lines, the second line is indented by a number of additional spaces specified by the ‘-ci’ option. ‘-ci’ defaults to 0. However, if the ‘-lp’ option is specified, and a line has a left parenthesis which is not closed on that line, then continuation lines will be lined up to start at the character position just after the left parenthesis. This processing also applies to ‘[’ and applies to ‘{’ when it occurs in initialization lists. For example, a piece of continued code might look like this with ‘-nlp -ci3’ in effect:

 
  p1 = first_procedure (second_procedure (p2, p3),
     third_procedure (p4, p5));

With ‘-lp’ in effect the code looks somewhat clearer:

 
  p1 = first_procedure (second_procedure (p2, p3),
                        third_procedure (p4, p5));

indent assumes that tabs are placed at regular intervals of both input and output character streams. These intervals are by default 8 columns wide, but (as of version 1.2) may be changed by the ‘-ts’ option. Tabs are treated as the equivalent number of spaces.

The indentation of type declarations in old-style function definitions is controlled by the ‘-ip’ parameter. This is a numeric parameter specifying how many spaces to indent type declarations. For example, the default ‘-ip5’ makes definitions look like this:

 
char *
create_world (x, y, scale)
     int x;
     int y;
     float scale;
{
  . . .
}

For compatibility with other versions of indent, the option ‘-nip’ is provided, which is equivalent to ‘-ip0’.

ANSI C allows white space to be placed on preprocessor command lines between the character ‘#’ and the command name. By default, indent retains this space, but specifying the ‘-nlps’ option directs indent to remove the whitespace.

Alternatively, you may use the ‘-ppi’ option to insert spaces, indenting the preprocessor keywords (after first removing any existing spacing between the character ‘#’ and preprocessor keywords). This option overrides ‘-lps’.

Use the ‘-eei’ option to tell indent to improve readability of continuation lines from the expression part of if(e), while(e), for(e;e;e) by indenting an extra tab stop so that they do not conflict with the code that follows.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.9 Disabling Formatting

Formatting of C code may be disabled for portions of a program by embedding special control comments in the program. To turn off formatting for a section of a program, place the disabling control comment

 
/* *INDENT-OFF* */

on a line by itself just before that section. Program text scanned after this control comment is output precisely as input with no modifications until the corresponding enabling comment is scanned on a line by itself. The disabling control comment is

 
/* *INDENT-ON* */

and any text following the comment on the line is also output unformatted. Formatting begins again with the input line following the enabling control comment.

More precisely, indent does not attempt to verify the closing delimiter (*/) for these C comments, and any whitespace on the line is totally transparent.

These control comments also function in their C++ formats, namely

 
// *INDENT-OFF*

and

 
// *INDENT-ON*

It should be noted that the internal state of indent remains unchanged over the course of the unformatted section. Thus, for example, turning off formatting in the middle of a function and continuing it after the end of the function may lead to bizarre results. It is therefore wise to be somewhat modular in selecting code to be left unformatted.

As a historical note, some earlier versions of indent produced error messages beginning with *INDENT**. These versions of indent were written to ignore any input text lines which began with such error messages.

You may also override the formatting of assignment statements by using a /* *INDENT-EQLS* */ comment. This tells indent to use the next statement as a hint of how it and subsequent statements (up to the next blank line) should be formatted. It uses the first “binary operator” (such as =) on the line as a marker. The resulting line will put that operator in the same column, and align the first “binary operator” on subsequent lines in the same column.

Here is an example of how it might be used:

 
/* *INDENT-EQLS* */
dimensions = 2;
x          = 5;
y          += 6;

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.10 Other Languages

In addition to recognizing C++ comments (which are now standard in C), indent provides limited support for C++ constructs:

It also accepts (and currently ignores) a ‘-c++’ option. This would be used with an alternate symbol table for C++.

If you add the ‘-ly’ option, indent also handles for Lex/Yacc scripts, by formatting the parts which are passed directly to the output. Both lex and yacc use the same file structure:

 
``definitions''
%%
``rules''
%%
``literal''

Anything in the “literal” section is copied to the output, and is assumed to be C source. Also, within the “definitions” and “rules” sections, lex/yacc pass any lines bracketed with %{ and %} to the output.

Other C statements within “rules” are not currently formatted.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.11 Miscellaneous options

To find out what version of indent you have, use the command indent --version. This will report the version number of indent, without doing any of the normal processing.

Use the --help option to get a usage summary.

The ‘-v’ option can be used to turn on verbose mode. When in verbose mode, indent reports when it splits one line of input into two more more lines of output, and gives some size statistics at completion.

The ‘-D’ option can be used to turn on debugging traces. Its parameter gives the debugging level (0 is off, 1 is on, 2 is more verbose).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.12 Bugs

The "-troff" option is strongly deprecated, and is not supported. A good thing for someone to do is to rewrite ‘indent’ to generate TeX source as a hardcopy output option, among other things.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.13 Copyright

The following copyright notice applies to the indent program. The copyright and copying permissions for this manual appear near the beginning of this document.

 
Copyright © 1999-2019, 2020 Thomas E. Dickey
Copyright © 1995, 1996 Joseph Arceneaux
Copyright © 1989, 1992, 1993, 1994, 1995, 1996 Free Software Foundation
Copyright © 1985 Sun Microsystems, Inc.
Copyright © 1980 The Regents of the University of California.
Copyright © 1976 Board of Trustees of the University of Illinois.
All rights reserved.

Redistribution and use in source and binary forms are permitted
provided that the above copyright notice and this paragraph are
duplicated in all such forms and that any documentation,
advertising materials, and other materials related to such
distribution and use acknowledge that the software was developed
by the University of California, Berkeley, the University of Illinois,
Urbana, and Sun Microsystems, Inc.  The name of either University
or Sun Microsystems may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED “AS IS” AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
PURPOSE.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

A. Option Summary

Here is a list of all the options for indent, alphabetized by short option. It is followed by a cross key alphabetized by long option.

-bacc
--blank-lines-after-ifdefs

Force blank lines after (and before) ifdefs.
See section Blank lines.

-bad
--blank-lines-after-declarations

Force blank lines after the declarations.
See section Blank lines.

-bap
--blank-lines-after-procedures

Force blank lines after procedure bodies.
See section Blank lines.

-bbb
--blank-lines-after-block-comments

Force blank lines after block comments.
See section Blank lines.

-bc
--blank-lines-after-commas

Force newline after comma in declaration.
See section Declarations.

-bl
--braces-after-if-line

Put braces on line after if, etc.
See section Statements.

-blin
--brace-indentn

Indent braces n spaces.
See section Statements.

-br
--braces-on-if-line

Put braces on line with if, etc. and structure declarations
See section Statements.

-bs
--Bill-Shannon
--blank-before-sizeof

Put a space between sizeof and its argument.
See section Statements.

-cn
--comment-indentationn

Put comments to the right of code in column n.
See section Comments.

-cbin
--case-brace-indentationn

Indent braces after a case label n spaces.
See section Statements.

-cdn
--declaration-comment-columnn

Put comments to the right of the declarations in column n.
See section Comments.

-cdb
--comment-delimiters-on-blank-lines

Put comment delimiters on blank lines.
See section Comments.

-cdw
--cuddle-do-while

Cuddle while of do {} while; and preceding ‘}’. See section Comments.

-ce
--cuddle-else

Cuddle else and preceding ‘}’.
See section Comments.

-cin
--continuation-indentationn

Continuation indent of n spaces.
See section Statements.

-clin
--case-indentationn

Case label indent of n spaces.
See section Statements.

-cpn
--else-endif-columnn

Put comments to the right of ‘#else’ and ‘#endif’ statements in column n.
See section Comments.

-cs
--space-after-cast

Put a space after a cast operator.
See section Statements.

-Dn
--debugn

Enable debugging traces.
See section Miscellaneous options.

-dn
--line-comments-indentationn

Set indentation of comments not to the right of code to n spaces.
See section Comments.

-din
--declaration-indentationn

Put variables in column n.
See section Declarations.

-eei
--extra-expression-indentation

Indent continuation lines of if, for and while statements.
See section Indentation.

-fc1
--format-first-column-comments

Format comments in the first column.
See section Comments.

-fca
--format-all-comments

Do not disable all formatting of comments.
See section Comments.

-gnu
--gnu-style

Use GNU coding style. This is the default.
See section Common styles.

-in
--indent-leveln
--indentation-leveln

Set indentation level to n spaces.
See section Indentation.

-ipn
--parameter-indentationn

Indent parameter types in old-style function definitions by n spaces.
See section Indentation.

-kr
--k-and-r-style
--kernighan-and-ritchie
--kernighan-and-ritchie-style

Use Kernighan & Ritchie coding style.
See section Common styles.

-ln
--line-lengthn

Set maximum line length for non-comment lines to n.
See section Comments.

-lcn
--comment-line-lengthn

Set maximum line length for comment formatting to n.
See section Comments.

-lp
--continue-at-parentheses

Line up continued lines at parentheses.
See section Indentation.

-lps
--leave-preprocessor-space

Leave space between ‘#’ and preprocessor directive.
See section Indentation.

-nbacc
--no-blank-lines-after-ifdefs

Do not force blank lines after (and before) ifdefs.
See section Blank lines.

-nbad
--no-blank-lines-after-declarations

Do not force blank lines after declarations.
See section Blank lines.

-nbap
--no-blank-lines-after-procedures

Do not force blank lines after procedure bodies.
See section Blank lines.

-nbbb
--no-blank-lines-after-block-comments

Do not force blank-lines after (before) block comments.
See section Blank lines.

-nbc
--no-blank-lines-after-commas

Do not force newlines after commas in declarations.
See section Declarations.

-ncdb
--no-comment-delimiters-on-blank-lines

Do not put comment delimiters on blank lines.
See section Comments.

-ncdw
--dont-cuddle-do-while

Do not cuddle } and the while of a do {} while;.
See section Statements.

-nce
--dont-cuddle-else

Do not cuddle } and else.
See section Statements.

-ncs
--no-space-after-casts

Do not put a space after cast operators.
See section Statements.

-neei
--no-extra-expression-indentation

Do not indent continuation lines of if, for and while statements.
See section Indentation.

-nfc1
--dont-format-first-column-comments

Do not format comments in the first column as normal.
See section Comments.

-nfca
--dont-format-comments

Do not format any comments.
See section Comments.

-nip
--no-parameter-indentation

Zero width indentation for parameters.
See section Indentation.

-nlp
--dont-line-up-parentheses

Do not line up parentheses.
See section Statements.

-nlps
--remove-preprocessor-space

Remove space between ‘#’ and preprocessor directive.
See section Indentation.

-npcs
--no-space-after-function-call-names

Do not put space after the function in function calls.
See section Statements.

-npsl
--dont-break-procedure-type

Put the type of a procedure on the same line as its name.
See section Declarations.

-nsc
--dont-star-comments

Do not put the ‘*’ character at the left of comments.
See section Comments.

-nsob
--leave-optional-blank-lines

Do not swallow optional blank lines.
See section Blank lines.

-nss
--dont-space-special-semicolon

Do not force a space before the semicolon after certain statements. Disables ‘-ss’.
See section Statements.

-nut
--no-tabs

Use spaces instead of tabs.
See section Indentation.

-nv
--no-verbosity

Disable verbose mode. See section Miscellaneous options.

-orig
--original
--original-style
--berkeley
--berkeley-style

Use the original Berkeley coding style.
See section Common styles.

-npro
--ignore-profile
+ignore-profile

Do not read ‘.indent.pro’ files.
See section Invoking indent.

-o
--output
--output-file

Write an output file, for the case where only one input is given.
See section Invoking indent.

-pcs
--space-after-procedure-calls

Insert a space between the name of the procedure being called and the ‘(’.
See section Statements.

-ppin
--preprocessor-indentationn

Insert spacing between ‘#’ and preprocessor keywords. This overrides ‘-lps’.
See section Indentation.

-psl
--procnames-start-lines

Put the type of a procedure on the line before its name.
See section Declarations.

-sc
--start-left-side-of-comments

Put the ‘*’ character at the left of comments.
See section Comments.

-sob
--swallow-optional-blank-lines

Swallow optional blank lines.
See section Blank lines.

-ss
--space-special-semicolon

On one-line for and while statements, force a blank before the semicolon.
See section Statements.

-st
--standard-output

Write to standard output.
See section Invoking indent.

-T

Tell indent the name of type-names.
See section Declarations.

-ta
-auto-typedefs

Tell indent to assume names ending with “_t” are type-names.
See section Declarations.

-tsn
--tab-sizen

Set tab size to n spaces.
See section Indentation.

-ut
--use-tabs

Use tabs. This is the default. See section Indentation.

-v
--verbose

Enable verbose mode.
See section Miscellaneous options.

-version

Output the version number of indent.
See section Miscellaneous options.

Options’ Cross Key

Here is a list of options alphabetized by long option, to help you find the corresponding short option.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Index

Jump to:   +   -   .  
B   C   E   G   I   K   L   O   S   T   U  
Index Entry Section

+
+ignore-profile1.1 Invoking indent

-
-auto-typedefs1.7 Declarations
-bacc1.4 Blank lines
-bad1.4 Blank lines
-bap1.4 Blank lines
-bbb1.4 Blank lines
-bc1.7 Declarations
--berkeley1.3 Common styles
--berkeley-style1.3 Common styles
--Bill-Shannon1.6 Statements
-bl1.6 Statements
--blank-before-sizeof1.6 Statements
--blank-lines-after-block-comments1.4 Blank lines
--blank-lines-after-commas1.7 Declarations
--blank-lines-after-declarations1.4 Blank lines
--blank-lines-after-ifdefs1.4 Blank lines
--blank-lines-after-procedures1.4 Blank lines
-blin1.6 Statements
-br1.6 Statements
--brace-indentn1.6 Statements
--braces-after-if-line1.6 Statements
--braces-on-if-line1.6 Statements
-bs1.6 Statements
-c++1.10 Other Languages
--c-plus-plus1.10 Other Languages
--case-brace-indentationn1.6 Statements
-cbin1.6 Statements
-cdb1.5 Comments
-cdn1.5 Comments
-cdw1.6 Statements
-ce1.6 Statements
-cin1.8 Indentation
-cn1.5 Comments
--comment-delimiters-on-blank-lines1.5 Comments
--comment-indentationn1.5 Comments
--continuation-indentationn1.8 Indentation
--continue-at-parentheses1.8 Indentation
-cpn1.5 Comments
-cs1.6 Statements
--cuddle-do-while1.6 Statements
--cuddle-else1.6 Statements
-D1.11 Miscellaneous options
--debug1.11 Miscellaneous options
--declaration-comment-columnn1.5 Comments
--declaration-indentationn1.7 Declarations
-din1.7 Declarations
-dn1.5 Comments
--dont-break-procedure-type1.7 Declarations
--dont-cuddle-do-while1.6 Statements
--dont-cuddle-else1.6 Statements
--dont-format-comments1.5 Comments
--dont-format-first-column-comments1.5 Comments
--dont-line-up-parentheses1.8 Indentation
--dont-space-special-semicolon1.6 Statements
--dont-star-comments1.5 Comments
-eei1.8 Indentation
--else-endif-columnn1.5 Comments
--extra-expression-indentation1.8 Indentation
-fc11.5 Comments
-fca1.5 Comments
--format-all-comments1.5 Comments
--format-first-column-comments1.5 Comments
-gnu1.3 Common styles
--gnu-style1.3 Common styles
-h1.11 Miscellaneous options
--help1.11 Miscellaneous options
--ignore-profile1.1 Invoking indent
-in1.8 Indentation
--indent-leveln1.8 Indentation
--indentation-leveln1.8 Indentation
-ipn1.8 Indentation
--k-and-r-style1.3 Common styles
--kernighan-and-ritchie1.3 Common styles
--kernighan-and-ritchie-style1.3 Common styles
-kr1.3 Common styles
--leave-optional-blank-lines1.4 Blank lines
--leave-preprocessor-space1.8 Indentation
--lex-or-yacc1.10 Other Languages
--line-comments-indentationn1.5 Comments
--linux1.3 Common styles
-lp1.8 Indentation
-lps1.8 Indentation
-ly1.10 Other Languages
-nbacc1.4 Blank lines
-nbad1.4 Blank lines
-nbap1.4 Blank lines
-nbbb1.4 Blank lines
-nbc1.7 Declarations
-ncdb1.5 Comments
-ncdw1.6 Statements
-nce1.6 Statements
-ncs1.6 Statements
-neei1.8 Indentation
-nfc11.5 Comments
-nfca1.5 Comments
-nip1.8 Indentation
-nlp1.8 Indentation
-nlps1.8 Indentation
--no-blank-lines-after-block-comments1.4 Blank lines
--no-blank-lines-after-commas1.7 Declarations
--no-blank-lines-after-declarations1.4 Blank lines
--no-blank-lines-after-ifdefs1.4 Blank lines
--no-blank-lines-after-procedures1.4 Blank lines
--no-comment-delimiters-on-blank-lines1.5 Comments
--no-extra-expression-indentation1.8 Indentation
--no-parameter-indentation1.8 Indentation
--no-space-after-casts1.6 Statements
--no-space-after-function-call-names1.6 Statements
--no-verbosity1.11 Miscellaneous options
-npcs1.6 Statements
-npro1.1 Invoking indent
-npsl1.7 Declarations
-nsc1.5 Comments
-nsob1.4 Blank lines
-nss1.6 Statements
-nv1.11 Miscellaneous options
-o1.1 Invoking indent
-orig1.3 Common styles
--original1.3 Common styles
--original-style1.3 Common styles
--output1.1 Invoking indent
--output-file1.1 Invoking indent
--parameter-indentationn1.8 Indentation
-pcs1.6 Statements
-ppin1.8 Indentation
--preprocessor-indentationn1.8 Indentation
--procnames-start-lines1.7 Declarations
-psl1.7 Declarations
--remove-preprocessor-space1.8 Indentation
-sc1.5 Comments
-sob1.4 Blank lines
--space-after-cast1.6 Statements
--space-after-procedure-calls1.6 Statements
--space-special-semicolon1.6 Statements
-ss1.6 Statements
-st1.1 Invoking indent
--standard-output1.1 Invoking indent
--start-left-side-of-comments1.5 Comments
--swallow-optional-blank-lines1.4 Blank lines
-T1.7 Declarations
-ta1.7 Declarations
--tab-sizen1.8 Indentation
-tsn1.8 Indentation
--usage1.11 Miscellaneous options
-v1.11 Miscellaneous options
--verbose1.11 Miscellaneous options
--version1.11 Miscellaneous options

.
.indent.pro’ file1.1 Invoking indent

B
Beginning indent1.1 Invoking indent
Berkeley style1.3 Common styles
Blank lines1.4 Blank lines

C
Comments1.5 Comments

E
etags requires ‘-psl1.7 Declarations

G
GNU style1.3 Common styles

I
Initialization file1.1 Invoking indent
Invoking indent1.1 Invoking indent

K
Kernighan & Ritchie style1.3 Common styles

L
Linux style1.3 Common styles
Long options, use of1.1 Invoking indent

O
Original Berkeley style1.3 Common styles
Output File Specification1.1 Invoking indent

S
Standard Output1.1 Invoking indent
Starting indent1.1 Invoking indent

T
Typenames1.7 Declarations
Typenames1.7 Declarations

U
Using Standard Input1.1 Invoking indent

Jump to:   +   -   .  
B   C   E   G   I   K   L   O   S   T   U  

[Top] [Contents] [Index] [ ? ]

Footnotes

(1)

+’ is being superseded by ‘--’ to maintain consistency with the POSIX standard.


[Top] [Contents] [Index] [ ? ]

Table of Contents


[Top] [Contents] [Index] [ ? ]

About This Document

This document was generated by Thomas E. Dickey on October 4, 2020 using texi2html 1.82.

The buttons in the navigation panels have the following meaning:

Button Name Go to From 1.2.3 go to
[ < ] Back Previous section in reading order 1.2.2
[ > ] Forward Next section in reading order 1.2.4
[ << ] FastBack Beginning of this chapter or previous chapter 1
[ Up ] Up Up section 1.2
[ >> ] FastForward Next chapter 2
[Top] Top Cover (top) of document  
[Contents] Contents Table of contents  
[Index] Index Index  
[ ? ] About About (help)  

where the Example assumes that the current position is at Subsubsection One-Two-Three of a document of the following structure:


This document was generated by Thomas E. Dickey on October 4, 2020 using texi2html 1.82.