Путеводитель по Руководству Linux

  User  |  Syst  |  Libr  |  Device  |  Files  |  Other  |  Admin  |  Head  |



   indent    ( 1 )

изменяет внешний вид программы C, вставляя или удаляя пробелы (changes the appearance of a C program by inserting or deleting whitespace.)

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 '-bfda' option causes a newline to be forced after the comma separating the arguments of a function declaration. The arguments will appear at one indention level deeper than the function declaration. This is particularly helpful for functions with long argument lists. The option '-bfde' causes a newline to be forced before the closing bracket of the function declaration. For both options the 'n' setting is the default: -nbfda and -nbfde.

For example,

void foo (int arg1, char arg2, int *arg3, long arg4, char arg5); With the '-bfda' option this would look like

void foo ( int arg1, char arg2, int *arg3, long arg4, char arg5);

With, in addition, the '-bfde' option this would look like

void foo ( int arg1, char arg2, int *arg3, long arg4, char arg5 );

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 must use the '-T' option to tell indent the name of all the typenames 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'.

The '-brs' or '-bls' option specifies how to format braces in struct declarations. The '-brs' option formats braces like this:

struct foo { int x; };

The '-bls' option formats them like this:

struct foo { int x; };

Similarly to the structure brace '-brs' and '-bls' options, the function brace options '-brf' or '-blf' specify how to format the braces in function definitions. The '-brf' option formats braces like this:

int one(void) { return 1; };

The '-blf' option formats them like this:

int one(void) { return 1; };

The '-sar' option affects how indent will render initializer lists. Without '-sar' they are formatted like this:

int a[] = {1, 2, 3, 4};

struct s { const char *name; int x; } a[] = { {"name", 0}, {"a", 1} };

With '-sar' they are formatted like this, with spaces inside the braces:

int a[] = { 1, 2, 3, 4 };

struct s { const char *name; int x; } a[] = { { "name", 0 }, { "a", 1 } };