DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

(indent.info.gz) Statements

Info Catalog (indent.info.gz) Comments (indent.info.gz) Indent Program (indent.info.gz) Declarations
 
 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--;
        }
 
    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");
      }
 
    This 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 gives code like:
 
      switch (i)
        {
        case 0:
          break;
        case 1:
          {
            ++i;
          }
        default:
          break;
        }
 
    Using the `-cli2' 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.
 
    The `-saf' option forces a space between an `for' and the following
 parenthesis.  This is the default.
 
    The `-sai' option forces a space between an `if' and the following
 parenthesis.  This is the default.
 
    The `-saw' option forces a space between an `while' and the
 following parenthesis.  This is the default.
 
    The `-prs' option causes all parentheses to be seperated with a
 space from the what is between them.  For example, using `-prs' results
 in code like:
 
        while ( ( e_code - s_code ) < ( dec_ind - 1 ) )
          {
            set_buf_break ( bb_dec_ind );
            *e_code++ = ' ';
          }
 
Info Catalog (indent.info.gz) Comments (indent.info.gz) Indent Program (indent.info.gz) Declarations
automatically generated byinfo2html