Next: , Previous: , Up: Indent Program   [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 -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 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.


1.4.1 –blank-lines-after-declarations

The -bad option forces a blank line after every block of declarations. The -nbad option does not add any such blank lines.

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;

1.4.2 –blank-lines-after-procedures

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.


Previous: , Up: Blank lines   [Contents][Index]