The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

Интерактивная система просмотра системных руководств (man-ов)

 ТемаНаборКатегория 
 
 [Cписок руководств | Печать]

indent (1)
  • >> indent (1) ( Solaris man: Команды и прикладные программы пользовательского уровня )
  • indent (1) ( FreeBSD man: Команды и прикладные программы пользовательского уровня )
  • indent (1) ( Linux man: Команды и прикладные программы пользовательского уровня )
  • 
    NAME
         indent - indent and format a C program source file
    
    SYNOPSIS
         indent input-file [ output-file ] [ [ -bap | -nbap ]
         [ -bacc | -nbacc ] [ -bad | -nbad ] [ -bbb | -nbbb ]
         [ -bc | -nbc ] [ -bl ] [ -br ] [ -bs | -nbs ] [ -cn ]
         [ -cdn ] [ -cdb | -ncdb ] [ -ce | -nce ] [ -cin ]  [ -clin ]
         [ -dn ] [ -din ] [ -dj | -ndj ] [ -eei | -neei ]
         [ -ei | -nei ] [ -fc1 | -nfc1 ] [ -in ] [ -ip | -nip ]
         [ -ln ] [ -lcn ] [ -lp | -nlp ]  [ -pcs | -npcs ]  [ -npro ]
         [ -psl | -npsl ] [ -sc | -nsc ] [ -sob | -nsob ] [ -st ]
         [ -T typename ] [ -troff ] [ -v | -nv ]
    
    DESCRIPTION
         indent is a C program formatter.  It reformats the C program
         in  the  input-file according to the switches.  The switches
         which can be specified are described below.  They may appear
         before or after the file names.
    
         Note: if you only specify an input-file, the  formatting  is
         done "in-place", that is, the formatted file is written back
         into input-file and a backup copy of input-file  is  written
         in   the   current   directory.    If  input-file  is  named
         /blah/blah/file, the backup file is named file.BAK.
    
         If output-file is specified, indent checks to make  sure  it
         is different from input-file.
    
    OPTIONS
         The  options  listed  below  control  the  formatting  style
         imposed by indent.
    
         -bacc,-nbacc
                   If -bacc is specified,  a  blank  line  is  forced
                   around  every  conditional compilation block.  For
                   example, in front of every #ifdef and after  every
                   #endif.   Other blank lines surrounding these will
                   be swallowed.  Default: -nbacc.
    
         -bad,-nbad
                   If -bad is specified, a blank line is forced after
                   every block of declarations.  Default: -nbad.
    
         -bap,-nbap
                   If -bap is specified, a blank line is forced after
                   every procedure body.  Default:  -nbap.
    
         -bbb,-nbbb
                   If -bbb is  specified,  a  blank  line  is  forced
                   before every block comment.  Default:  -nbbb.
    
         -bc,-nbc  If -bc is specified,  then  a  NEWLINE  is  forced
                   after each comma in a declaration.  -nbc turns off
                   this option.  Default: -bc.
    
         -br,-bl   Specifying -bl lines up compound  statements  like
                   this:
                        if (...)
                        {
                                       code
                        }
    
                   Specifying -br (the default) makes them look  like
                   this:
                        if (...) {
                                       code
                        }
    
         -bs,-nbs
              Enable (disable) the forcing of a blank  after  sizeof.
              Some people believe that sizeof should appear as though
              it were a procedure call (-nbs, the default)  and  some
              people  believe  that  since  sizeof is an operator, it
              should always be treated that  way  and  should  always
              have a blank after it.
    
         -cn  The column in which comments on code start.
               Default:  -c33.
    
         -cdn The column in which comments on declarations start. The
              default  is  for  these  comments  to start in the same
              column as those on code.
    
         -cdb,-ncdb
              Enable (disable) the placement of comment delimiters on
              blank  lines.   With this option enabled, comments look
              like this:
              /*
              * this is a comment
              */
    
         Rather than like this:
    
              /* this is a comment */
    
         This only affects block comments, not comments to the  right
         of code. Default:  -cdb.
    
         -ce,-nce
              Enables (disables) forcing else's to cuddle up  to  the
              immediately preceding `}'.  Default:  -ce.
    
         -cin Sets the continuation indent to  be  the  value  of  n.
              Continuation lines will be indented the value of n from
              the beginning of  the  first  line  of  the  statement.
              Parenthesized  expressions have extra indentation added
              to indicate the nesting, unless -lp is in effect.   -ci
              defaults to the same value as -i.
    
         -clin
              Cause case labels to be indented n  tab  stops  to  the
              right  of  the  containing  switch  statement.  -cli0.5
              causes case labels to be  indented  half  a  tab  stop.
              Default:  -cli0.
    
         -dn  Control the placement of comments which are not to  the
              right  of  code. Default:  -d1 means that such comments
              are placed one indentation level to the left  of  code.
              Specifying  -d0  lines up these comments with the code.
              See the section on comment indentation below.
    
         -din Specify the indentation, in character positions, from a
              declaration   keyword   to  the  following  identifier.
              Default:  -di16.
    
         -dj,-ndj
              -dj left justifies declarations.  -ndj indents declara-
              tions the same as code.  Default:  -ndj.
    
         -ei,-nei
              If -ei is enabled, ifs following elses  will  have  the
              same  indentation  as the preceding if statement. If it
              is disabled, ifs following elses will be  indented  one
              extra level. Default:  -ei.
    
         -eei,-neei
              If -eei is specified, an  extra  expression  indent  is
              applied on continuation lines of the expression part of
              if() and while().  These  continuation  lines  will  be
              indented  one extra level - twice instead of just once.
              This is to avoid the confusion  between  the  continued
              expression  and  the statement that follows the if() or
              while().  Default: -neei.
    
         -fc1,-nfc1
              Enables (disables)  the  formatting  of  comments  that
              start  in  column 1.  Often, comments whose leading `/'
              is in column 1 have been carefully  hand  formatted  by
              the  programmer.   In such cases, -nfc1 should be used.
              Default:  -fc1.
    
         -in  The number of spaces for  one  indentation  level.  The
              default is one tab stop, -i8.
    
         -ip,-nip
              Enables  (disables)  the   indentation   of   parameter
              declarations from the left margin.  Default:  -ip .
    
         -ln  Maximum length of an output line with a  trailing  com-
              ment.  Default:  -l78.
    
         -lcn Sets the line length  for  block  comments  to  n.   It
              defaults  to being the same as the usual line length as
              specified with -l.
    
         -lp,-nlp
              Lines up code surrounded by parenthesis in continuation
              lines.   If  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.  For example, here is how a piece
              of continued code looks with -nlp in effect:
                   p1 = first_procedure(second_procedure(p2, p3),
                                  third_procedure(p4, p5));
    
              With -lp in effect (the default) the code  looks  some-
              what clearer:
                   p1 = first_procedure(second_procedure(p2, p3),
                                          third_procedure(p4, p5));
    
              Inserting a couple more NEWLINE characters we get:
                   p1 = first_procedure(second_procedure(p2,
                                                      p3),
                                          third_procedure(p4,
                                                    p5));
    
              This example was generated with -lp.
    
         -npro
              Ignore   the   profile   files,    ./.indent.pro    and
              ~/.indent.pro.
    
         -pcs , -npcs
              If true (-pcs) all procedure calls and declarations  in
              the  source code will have a space inserted between the
              name and the '('.  Default:  -npcs
    
         -psl , -npsl
              If true (-psl) the names of  procedures  being  defined
              are  placed  in column 1 - their types, if any, will be
              left on the previous lines. Default:  -psl.
    
         -sc,-nsc
              Enables (disables) the placement of asterisks (`*'s) at
              the left edge of all comments. Default:  -sc.
    
         -sob,-nsob
              If -sob is  specified,  indent  will  swallow  optional
              blank  lines.   You  can  use  this to get rid of blank
              lines after declarations.  Default:  -nsob.
    
         -st  indent takes its input from the standard input, and put
              its output to the standard output.
    
         -T typename
              Add typename to the list of type keywords.  Names accu-
              mulate:   -T can be specified more than once.  You need
              to specify all the typenames that appear in  your  pro-
              gram  that  are  defined  by typedefs - nothing will be
              harmed if you miss a few, but the program won't be for-
              matted  as  nicely  as  it  should.  This sounds like a
              painful thing to have to do, but it is really a symptom
              of  a  problem in C:  typedef causes a syntactic change
              in the language and indent cannot find all typedefs.
    
         -troff
              Causes indent to format the program for  processing  by
              troff.   It  will  produce  a fancy listing in much the
              same spirit as vgrind.   If  the  output  file  is  not
              specified,  the default is standard output, rather than
              formatting in place.  The usual way to  get  a  troffed
              listing is with the command
    
                   indent -troff program.c | troff -mindent
    
         -v,-nv
              -v 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 gives  some
              size statistics at completion. Default:  -nv.
    
    USAGE
         You may set up your own "profile" of defaults to  indent  by
         creating  a  file  called  .indent.pro  in either your login
         directory or the current directory  and  including  whatever
         switches  you like.  An .indent.pro in the current directory
         takes precedence over the one in your login  directory.   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
         switches should be separated by SPACE, TAB, or NEWLINE char-
         acters.
    
      Comments
         Boxed          indent assumes that any comment with  a  dash
                        or  star  immediately after the start of com-
                        ment (that is,  `/*-'or`/**')  is  a  comment
                        surrounded  by  a box of stars.  Each line of
                        such a comment is left unchanged, except that
                        its  indentation  may  be adjusted to account
                        for the change in indentation  of  the  first
                        line of the comment.
    
         Straight text  All other comments are  treated  as  straight
                        text.   indent  fits as many words (separated
                        by SPACE, TAB, or NEWLINE  characters)  on  a
                        line  as  possible.   Blank lines break para-
                        graphs.
    
      Comment indentation
         If a comment is on a line with code it  is  started  in  the
         comment column, which is set by the -cn command line parame-
         ter.  Otherwise, the comment is  started  at  n  indentation
         levels less than where code is currently being placed, where
         n is specified by the -dn command line  parameter.   If  the
         code  on a line extends past the comment column, the comment
         starts further to the right, and the  right  margin  may  be
         automatically extended in extreme cases.
    
      Preprocessor lines
         In general, indent leaves  preprocessor  lines  alone.   The
         only reformatting that it will do is to straighten up trail-
         ing comments.  It leaves imbedded  comments  alone.   Condi-
         tional   compilation  (#ifdef...#endif)  is  recognized  and
         indent attempts to correctly compensate  for  the  syntactic
         peculiarities introduced.
    
      C syntax
         indent understands a substantial amount about the syntax  of
         C,  but  it  has  a "forgiving" parser.  It attempts to cope
         with the usual sorts of incomplete and misformed syntax.  In
         particular, the use of macros like:
    
              #define forever for(;;)
    
         is handled properly.
    
      /*INDENT OFF*/ /*INDENT ON*/
         All text between these two comments gets left alone.  There-
         fore,  when  you  put source code between these comments, it
         will not be affected by the reformatting.
    
    FILES
         ./.indent.pro       profile file
         ~/.indent.pro       profile file
    SEE ALSO
         troff(1)
    BUGS
         A common mistake that often causes grief is typing:
              indent *.c
    
         to the shell in an attempt to indent all the C programs in a
         directory.
    
    
    
    


    Поиск по тексту MAN-ов: 




    Партнёры:
    PostgresPro
    Inferno Solutions
    Hosting by Hoster.ru
    Хостинг:

    Закладки на сайте
    Проследить за страницей
    Created 1996-2024 by Maxim Chirkov
    Добавить, Поддержать, Вебмастеру