home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / INDENTPP.ZIP / INDENT.MAN < prev    next >
Text File  |  1992-08-27  |  30KB  |  899 lines

  1. cat indent.man
  2.  
  3.  
  4.  
  5.      INDENT(1)             A/UX (July 14, 1989)              INDENT(1)
  6.  
  7.  
  8.  
  9.      NAME
  10.           indent - indent and format C program source
  11.  
  12.      SYNOPSIS
  13.           indent  [ input-file [ output-file ] ] [ -bad | -nbad ]
  14.                  [ -bap | -nbap ] [ -bbb | -nbbb ] [ -bc | -nbc ]
  15.                  [ -bl ] [ -br ] [ -brr ] [ -cn ] [ -cdn ]
  16.                  [ -cdb | -ncdb ] [ -ce | -nce ] [ -cin ] [ -clin ]
  17.                  [ -ccin ] [ -dn ] [ -din ] [ -fc1 | -nfc1 ] [ -in ]
  18.                  [ -ip | -nip ] [ -ln ] [ -lcn ] [ -lp | -nlp ]
  19.                  [ -pcs | -npcs ] [ -npro ] [ -prs | -nprs ]
  20.                  [ -psl | -npsl ] [ -sc | -nsc ] [ -sob | -nsob ]
  21.                  [ -st ] [ -tabsn ] [ -troff ] [ -v | -nv ] [ -+ ]
  22.  
  23.  
  24.      DESCRIPTION
  25.           Indent is a C program formatter.  It reformats the C program
  26.           in the input-file according to the switches.  The switches
  27.           which can be specified are described below. They may appear
  28.           before or after the file names.
  29.  
  30.           NOTE: If you only specify an input-file, the formatting is
  31.           done 'in-place', that is, the formatted file is written back
  32.           into input-file and a backup copy of input-file is written
  33.           in the current directory.  If input-file is named
  34.           '/blah/blah/file', the backup file is named file.BAK.
  35.  
  36.           If output-file is specified, indent checks to make sure it
  37.           is different from input-file.
  38.  
  39.      OPTIONS
  40.           The options listed below control the formatting style
  41.           imposed by indent.
  42.  
  43.           -bap,-nbap     If -bap is specified, a blank line is forced
  44.                          after every procedure body.  Default:  -nbap.
  45.  
  46.           -bad,-nbad     If -bad is specified, a blank line is forced
  47.                          after every block of declarations.  Default:
  48.                          -nbad.
  49.  
  50.           -bbb,-nbbb     If -bbb is specified, a blank line is forced
  51.                          before every block comment.  Default:  -nbbb.
  52.  
  53.           -bc,-nbc       If -bc is specified, then a newline is forced
  54.                          after each comma in a declaration. -nbc turns
  55.                          off this option.  The default is -bc.
  56.  
  57.           -br,-bl,-brr   Specifying -bl lines up compound statements
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.      Page 1                                          (printed 3/16/92)
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.      INDENT(1)             A/UX (July 14, 1989)              INDENT(1)
  72.  
  73.  
  74.  
  75.                          like this:
  76.                              if (...)
  77.                              {
  78.                                  code
  79.                              }
  80.                          Specifying -br (the default) makes them look
  81.                          like this:
  82.                              if (...) {
  83.                                  code
  84.                              }
  85.                          And specifying -brr makes them look like
  86.                          this:
  87.                              if (...)
  88.                                  {
  89.                                  code
  90.                                  }
  91.  
  92.           -cn            The column in which comments on code start.
  93.                          The default is 33.
  94.  
  95.           -cdn           The column in which comments on declarations
  96.                          start.  The default is for these comments to
  97.                          start in the same column as those on code.
  98.  
  99.           -cdb,-ncdb     Enables (disables) the placement of comment
  100.                          delimiters on blank lines.  With this option
  101.                          enabled, comments look like this:
  102.                               /*
  103.                                * this is a comment
  104.                                */
  105.                          Rather than like this:
  106.                               /* this is a comment */
  107.                          This only affects block comments, not
  108.                          comments to the right of code. The default is
  109.                          -cdb .
  110.  
  111.           -ce,-nce       Enables (disables) forcing 'else's to cuddle
  112.                          up to the immediatly preceeding -ce .
  113.  
  114.           -cin           Sets the continuation indent to be n.
  115.                          Continuation lines will be indented that far
  116.                          from the beginning of the first line of the
  117.                          statement.  Parenthesized expressions have
  118.                          extra indentation added to indicate the
  119.                          nesting, unless -lp is in effect.  -ci
  120.                          defaults to the same value as -i.
  121.  
  122.           -clin          Causes case labels to be indented n tab stops
  123.                          to the right of the containing switch
  124.                          statement.  -cli0.5 causes case labels to be
  125.                          indented half a tab stop.  The default is
  126.                          -cli0 .
  127.  
  128.  
  129.  
  130.      Page 2                                          (printed 3/16/92)
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.      INDENT(1)             A/UX (July 14, 1989)              INDENT(1)
  138.  
  139.  
  140.  
  141.           -ccin          Causes case code to be indented n tab stops
  142.                          to the right of the corresponding case label.
  143.                          -cci0.5 causes case code to be indented half
  144.                          a tab stop.  The default is -cci1 .
  145.  
  146.           -dn            Controls the placement of comments which are
  147.                          not to the right of code.  The default -d1
  148.                          means that such comments are placed one
  149.                          indentation level to the left of code.
  150.                          Specifying -d0 lines up these comments with
  151.                          the code.  See the section on comment
  152.                          indentation below.
  153.  
  154.           -din           Specifies the indentation, in character
  155.                          positions, from a declaration keyword to the
  156.                          following identifier.  The default is -di16 .
  157.  
  158.           -fc1,-nfc1     Enables (disables) the formatting of comments
  159.                          that start in column 1.  Often, comments
  160.                          whose leading '/' is in column 1 have been
  161.                          carefully hand formatted by the programmer.
  162.                          In such cases, -nfc1 should be used.  The
  163.                          default is -fc1.
  164.  
  165.           -in            The number of spaces for one indentation
  166.                          level.  The default is 4.
  167.  
  168.           -ip,-nip       Enables (disables) the indentation of
  169.                          parameter declarations from the left margin.
  170.                          The default is -ip .
  171.  
  172.           -ln            Maximum length of an output line.  The
  173.                          default is 75.
  174.  
  175.           -npro          Causes the profile files, './.indent.pro' and
  176.                          '~/.indent.pro', to be ignored.
  177.  
  178.           -lp,-nlp       Lines up code surrounded by parenthesis in
  179.                          continuation lines.  If a line has a left
  180.                          paren which is not closed on that line, then
  181.                          continuation lines will be lined up to start
  182.                          at the character position just after the left
  183.                          paren.  For example, here is how a piece of
  184.                          continued code looks with -nlp in effect:
  185.                              p1 = first_procedure(second_procedure(p2, p3),
  186.                                  third_procedure(p4, p5));
  187.                          With -lp in effect (the default) the code
  188.                          looks somewhat clearer:
  189.                              p1 = first_procedure(second_procedure(p2, p3),
  190.                                                   third_procedure(p4, p5));
  191.  
  192.  
  193.  
  194.  
  195.  
  196.      Page 3                                          (printed 3/16/92)
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.      INDENT(1)             A/UX (July 14, 1989)              INDENT(1)
  204.  
  205.  
  206.  
  207.                          Inserting a couple more newlines we get:
  208.                              p1 = first_procedure(second_procedure(p2,
  209.                                                                    p3),
  210.                                                   third_procedure(p4,
  211.                                                                   p5));
  212.  
  213.           -pcs , -npcs   If true (-pcs) all procedure calls will have
  214.                          a space inserted between the name and the
  215.                          '('.  The default is -npcs
  216.  
  217.           -prs , -nprs   If true (-prs) all parentheses will have a
  218.                          space inserted after the '(' and before the
  219.                          ')'.  The default is -nprs
  220.  
  221.           -psl , -npsl   If true (-psl) the names of procedures being
  222.                          defined are placed in column 1 - their types,
  223.                          if any, will be left on the previous lines.
  224.                          The default is -psl
  225.  
  226.           -sc,-nsc       Enables (disables) the placement of asterisks
  227.                          ('*'s) at the left edge of all comments.
  228.  
  229.           -sob,-nsob     If -sob is specified, indent will swallow
  230.                          optional blank lines.  You can use this to
  231.                          get rid of blank lines after declarations.
  232.                          Default:  -nsob
  233.  
  234.           -st            Causes indent to take its input from stdin,
  235.                          and put its output to stdout.
  236.  
  237.           -Ttypename     Adds typename to the list of type keywords.
  238.                          Names accumulate:  -T can be specified more
  239.                          than once.  You need to specify all the
  240.                          typenames that appear in your program that
  241.                          are defined by typedefs - nothing will be
  242.                          harmed if you miss a few, but the program
  243.                          won't be formatted as nicely as it should.
  244.                          This sounds like a painful thing to have to
  245.                          do, but it's really a symptom of a problem in
  246.                          C: typedef causes a syntactic change in the
  247.                          language and indent can't find all typedefs.
  248.  
  249.           -tabsn         Tells indent that tabs are assumed to be at
  250.                          every n columns.  The default is -tabs8 .
  251.  
  252.           -troff         Causes indent to format the program for
  253.                          processing by troff.  It will produce a fancy
  254.                          listing in much the same spirit as vgrind.
  255.                          If the output file is not specified, the
  256.                          default is standard output, rather than
  257.                          formatting in place.
  258.  
  259.  
  260.  
  261.  
  262.      Page 4                                          (printed 3/16/92)
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.      INDENT(1)             A/UX (July 14, 1989)              INDENT(1)
  270.  
  271.  
  272.  
  273.           -v,-nv         -v turns on 'verbose' mode, -nv turns it off.
  274.                          When in verbose mode, indent reports when it
  275.                          splits one line of input into two or more
  276.                          lines of output, and gives some size
  277.                          statistics at completion. The default is -nv.
  278.  
  279.           -+             turns on support for C++. In c++ mode, :: is
  280.                          permited in identifiers, C++ keywords are
  281.                          supported, and class definition keywords
  282.                          (public, private, etc.) are set in column 2.
  283.  
  284.      FURTHER DESCRIPTION
  285.           You may set up your own 'profile' of defaults to indent by
  286.           creating a file called .indent.pro in either your login
  287.           directory or the current directory and including whatever
  288.           switches you like.  A '.indent.pro' in the current directory
  289.           takes precedence over the one in your login directory.  If
  290.           indent is run and a profile file exists, then it is read to
  291.           set up the program's defaults.  Switches on the command
  292.           line, though, always override profile switches.  The
  293.           switches should be separated by spaces, tabs or newlines.
  294.  
  295.           Comments
  296.  
  297.           'Box' comments.  Indent assumes that any comment with a dash
  298.           or star immediately after the start of comment (that is,
  299.           '/*-' or '/**') is a comment surrounded by a box of stars.
  300.           Each line of such a comment is left unchanged, except that
  301.           its indentation may be adjusted to account for the change in
  302.           indentation of the first line of the comment.
  303.  
  304.           Straight text.  All other comments are treated as straight
  305.           text.  Indent fits as many words (separated by blanks, tabs,
  306.           or newlines) on a line as possible.  Blank lines break
  307.           paragraphs.
  308.  
  309.           Comment indentation
  310.  
  311.           If a comment is on a line with code it is started in the
  312.           'comment column', which is set by the -cn command line
  313.           parameter.  Otherwise, the comment is started at n
  314.           indentation levels less than where code is currently being
  315.           placed, where n is specified by the -dn command line
  316.           parameter.  If the code on a line extends past the comment
  317.           column, the comment starts further to the right, and the
  318.           right margin may be automatically extended in extreme cases.
  319.  
  320.           Special Comments
  321.  
  322.           Indent produces and interprets some special comments.  When
  323.           indent cannot parse the source, it prints a message on
  324.           standard error and inserts a comment into the output of the
  325.  
  326.  
  327.  
  328.      Page 5                                          (printed 3/16/92)
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.      INDENT(1)             A/UX (July 14, 1989)              INDENT(1)
  336.  
  337.  
  338.  
  339.           form
  340.                /**INDENT** ErrorMessage */
  341.  
  342.           Indent interprets several special comments as directives.
  343.           First, it makes no attempt to format lines containing the
  344.           error comment described above.
  345.  
  346.           Second, lines of the form:
  347.                /* INDENT OFF */
  348.           or
  349.                /* INDENT ON */
  350.           disable and re-enable indent formatting. Any amount of
  351.           whitespace may replace the spaces shown in the examples.
  352.  
  353.           Third, indent allows formatting controls to be included in
  354.           the source via comments of the form:
  355.                /* INDENT: arg1 arg2 arg3 ... arg4 */
  356.           The arguments given are in the same syntax as the command
  357.           line or profile file.  For example:
  358.                /* INDENT: -cli.25 -nfc1 */
  359.  
  360.           Preprocessor lines
  361.  
  362.           In general, indent leaves preprocessor lines alone.  The
  363.           only reformmatting that it will do is to straighten up
  364.           trailing comments.  It leaves imbedded comments alone.
  365.           Conditional compilation (#ifdef...#endif) is recognized and
  366.           indent attempts to correctly compensate for the syntactic
  367.           peculiarites introduced.
  368.  
  369.           C syntax
  370.  
  371.           Indent understands a substantial amount about the syntax of
  372.           C, but it has a 'forgiving' parser.  It attempts to cope
  373.           with the usual sorts of incomplete and misformed syntax.  In
  374.           particular, the use of macros like:
  375.                   #define forever for(;;)
  376.           is handled properly.
  377.  
  378.      FILES
  379.           ./.indent.pro  profile file
  380.  
  381.      BUGS
  382.           Indent has even more switches than ls.
  383.  
  384.           A common mistake that often causes grief is typing:
  385.               indent *.c
  386.           to the shell in an attempt to indent all the C programs in a
  387.           directory.  This is a really nasty thing to do.  (Think
  388.           about it.)
  389.  
  390.  
  391.  
  392.  
  393.  
  394.      Page 6                                          (printed 3/16/92)
  395.  
  396.  
  397.  
  398. /users/jrs>SHAR_EOF
  399. if test 15722 -ne "`wc -c indent.man`"
  400. then
  401. echo shar: error transmitting indent.man '(should have been 15722 characters)'
  402. fi
  403. echo shar: extracting indent.1
  404. sed 's/^X//' << \SHAR_EOF > indent.1
  405. .\" Copyright 1989 Object Design, Inc.
  406. .\" Copyright (c) 1985 Sun Microsystems, Inc.
  407. .\" Copyright (c) 1980 The Regents of the University of California.
  408. .\" Copyright (c) 1976 Board of Trustees of the University of Illinois.
  409. .\" All rights reserved.
  410. .\" Redistribution and use in source and binary forms are permitted
  411. .\" provided that the above copyright notice and this paragraph are
  412. .\" duplicated in all such forms and that any documentation,
  413. .\" advertising materials, and other materials related to such
  414. .\" distribution and use acknowledge that the software was developed
  415. .\" by the University of California, Berkeley, the University of Illinois,
  416. .\" Urbana, and Sun Microsystems, Inc.  The name of either University
  417. .\" or Sun Microsystems may not be used to endorse or promote products
  418. .\" derived from this software without specific prior written permission.
  419. .\" THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
  420. .\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  421. .\" WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  422. .\" 
  423. .\"    @(#)indent.1    6.5 (Berkeley) 88/09/15
  424. .\"
  425. .TH INDENT 1 "July 14, 1989
  426. .SH NAME
  427. indent \- indent and format C program source
  428. .SH SYNOPSIS
  429. .in +\w'\fBindent \fR'u
  430. .ti -\w'\fBindent \fR'u
  431. \fBindent \fR [ \fIinput-file\fR [ \fIoutput-file\fR ] ]
  432. [\ \fB\-bad\fR\ |\ \fB\-nbad\fR\ ]
  433. [\ \fB\-bap\fR\ |\ \fB\-nbap\fR\ ]
  434. [\ \fB\-bbb\fR\ |\ \fB\-nbbb\fR\ ]
  435. [\ \fB\-bc\fR\ |\ \fB\-nbc\fR\ ]
  436. [\ \fB\-bl\fR\ ]
  437. [\ \fB\-br\fR\ ]
  438. [\ \fB\-brr\fR\ ]
  439. [\ \fB\-c\fIn\fR\ ]
  440. [\ \fB\-cd\fIn\fR\ ]
  441. [\ \fB\-cdb\fR\ |\ \fB\-ncdb\fR\ ]
  442. [\ \fB\-ce\fR\ |\ \fB\-nce\fR\ ]
  443. [\ \fB\-ci\fIn\fR\ ]
  444. [\ \fB\-cli\fIn\fR\ ]
  445. [\ \fB\-cci\fIn\fR\ ]
  446. [\ \fB\-d\fIn\fR\ ]
  447. [\ \fB\-di\fIn\fR\ ]
  448. [\ \fB\-fc1\fR\ |\ \fB\-nfc1\fR\ ]
  449. [\ \fB\-i\fIn\fR\ ]
  450. [\ \fB\-ip\fR\ |\ \fB\-nip\fR\ ]
  451. [\ \fB\-l\fIn\fR\ ]
  452. [\ \fB\-lc\fIn\fR\ ]
  453. [\ \fB\-lp\fR\ |\ \fB\-nlp\fR\ ]
  454. [\ \fB\-pcs\fR\ |\ \fB\-npcs\fR\ ]
  455. [\ \fB\-npro\fR\ ]
  456. [\ \fB\-prs\fR\ |\ \fB\-nprs\fR\ ]
  457. [\ \fB\-psl\fR\ |\ \fB\-npsl\fR\ ]
  458. [\ \fB\-sc\fR\ |\ \fB\-nsc\fR\ ]
  459. [\ \fB\-sob\fR\ |\ \fB\-nsob\fR\ ]
  460. [\ \fB\-st\fR\ ]
  461. [\ \fB\-tabs\fIn\fR\ ]
  462. [\ \fB\-troff\fR\ ]
  463. [\ \fB\-v\fR\ |\ \fB\-nv\fR\ ]
  464. [\ \fB-+\fR ]
  465.  
  466. .SH DESCRIPTION
  467. .I Indent
  468. is a \fBC\fR program formatter.  It reformats the \fBC\fR program in the
  469. \fIinput-file\fR according to the switches.  The switches which can be
  470. specified are described below. They may appear before or after the file
  471. names.
  472. .LP
  473. \fBNOTE\fP: If you only specify an \fIinput-file\fR, the formatting is
  474. done 'in-place', that is, the formatted file is written back into
  475. .I input-file
  476. and a backup copy of
  477. .I input-file
  478. is written in the current directory.  If
  479. .I input-file
  480. is named '/blah/blah/file', the backup file is named
  481. .RI file .BAK.
  482. .LP
  483. If
  484. .I output-file
  485. is specified,
  486. .I indent
  487. checks to make sure it is different from
  488. .IR input-file .
  489. .SH OPTIONS
  490. .LP
  491. The options listed below control the formatting style imposed by
  492. .IR indent .
  493. .TP 15
  494. .BR \-bap , \-nbap
  495. If
  496. .B \-bap
  497. is specified, a blank line is forced after every procedure body.  Default:
  498. .B \-nbap.
  499. .TP 15
  500. .BR \-bad , \-nbad
  501. If
  502. .B \-bad
  503. is specified, a blank line is forced after every block of
  504. declarations.  Default:  
  505. .B \-nbad.
  506. .TP 15
  507. .BR \-bbb , \-nbbb
  508. If
  509. .B \-bbb
  510. is specified, a blank line is forced before every block comment.  Default:
  511. .B \-nbbb.
  512. .TP 15
  513. .BR \-bc , \-nbc
  514. If
  515. .B \-bc
  516. is specified, then a newline is forced after each comma in a declaration. 
  517. .B \-nbc
  518. turns off this option.  The default is
  519. .BR \-bc .
  520. .TP 15
  521. .BR \-br , \-bl , \-brr
  522. Specifying
  523. .B \-bl
  524. lines up compound statements like this:
  525. .ne 4
  526. .nf
  527. .ft L
  528.     if (...)
  529.     {
  530.         code
  531.     }
  532. .ft R
  533. .fi
  534. Specifying
  535. .B \-br
  536. (the default) makes them look like this:
  537. .ne 3
  538. .nf
  539. .ft L
  540.     if (...) {
  541.         code
  542.     }
  543. .ft R
  544. .fi
  545. And specifying
  546. .B \-brr
  547. makes them look like this:
  548. .ne 3
  549. .nf
  550. .ft L
  551.     if (...)
  552.         {
  553.         code
  554.         }
  555. .ft R
  556. .fi
  557. .LP
  558. .TP 15
  559. .BI \-c n
  560. The column in which comments on code start.  The default is 33.  
  561. .TP 15
  562. .BI \-cd n
  563. The column in which comments on declarations start.  The default
  564. is for these comments to start in the same column as those on code.
  565. .TP 15
  566. .BI \-cdb , \-ncdb
  567. Enables (disables) the placement of comment delimiters on blank lines.  With
  568. this option enabled, comments look like this:
  569. .nf
  570. .ft L
  571. .ne 3
  572.     /*
  573.      * this is a comment
  574.      */
  575. .ft R
  576. .fi
  577. Rather than like this:
  578. .nf
  579. .ft L
  580.     /* this is a comment */
  581. .ft R
  582. .fi
  583. This only affects block comments, not comments to the right of code. The default is
  584. .B \-cdb .
  585. .TP 15
  586. .BI \-ce , \-nce
  587. Enables (disables) forcing 'else's to cuddle up to the immediatly preceeding
  588. '}'.  The default is
  589. .B \-ce .
  590. .TP 15
  591. .BI \-ci n
  592. Sets the continuation indent to be \fIn\fR.  Continuation
  593. lines will be indented that far from the beginning of the first line of the
  594. statement.  Parenthesized expressions have extra indentation added to
  595. indicate the nesting, unless \fB\-lp\fR is in effect.
  596. \fB\-ci\fR defaults to the same value as \fB\-i\fR.
  597. .TP 15
  598. .BI \-cli n
  599. Causes case labels to be indented
  600. .I n
  601. tab stops to the right of the containing \fBswitch\fR statement.
  602. \fB-cli0.5\fR causes case labels to be indented half a tab stop.  The
  603. default is
  604. .B \-cli0 .
  605. .TP 15
  606. .BI \-cci n
  607. Causes case code to be indented
  608. .I n
  609. tab stops to the right of the corresponding case label.
  610. \fB-cci0.5\fR causes case code to be indented half a tab stop.  The
  611. default is
  612. .B \-cci1 .
  613. .TP 15
  614. .BI \-d n
  615. Controls the placement of comments which are not to the
  616. right of code.  The default
  617. .B \-d1
  618. means that such comments are placed one indentation level to the
  619. left of code.  Specifying
  620. .B \-d0
  621. lines up these comments with the code.  See the section on comment
  622. indentation below.
  623. .TP 15
  624. .BI \-di n
  625. Specifies the indentation, in character positions, from a declaration keyword
  626. to the following identifier.  The default is
  627. .B \-di16 .
  628. .if 0 \{.TP 15
  629. .BR \-dj , \-ndj
  630. .B \-dj
  631. left justifies declarations.
  632. .B \-ndj
  633. indents declarations the same as code.  The default is
  634. .BR \-ndj .
  635. .TP 15
  636. .BI \-ei , \-nei
  637. Enables (disables) special
  638. .B else-if
  639. processing.  If it's enabled,
  640. .BR if "s"
  641. following
  642. .BR else "s"
  643. will have the same indendation as the preceeding
  644. .B if
  645. statement.\}
  646. .TP 15
  647. .BI \-fc1 , \-nfc1
  648. Enables (disables) the formatting of comments that start in column 1.
  649. Often, comments whose leading '/' is in column 1 have been carefully
  650. hand formatted by the programmer.  In such cases, \fB\-nfc1\fR should be
  651. used.  The default is \fB\-fc1\fR.
  652. .TP 15
  653. .BI \-i n
  654. The number of spaces for one indentation level.  The default is 4.
  655. .TP 15
  656. .BI \-ip , \-nip
  657. Enables (disables) the indentation of parameter declarations from the left
  658. margin.  The default is
  659. .B \-ip .
  660. .TP 15
  661. .BI \-l n
  662. Maximum length of an output line.  The default is 75.
  663. .TP 15
  664. .B \-npro
  665. Causes the profile files, './.indent.pro' and '~/.indent.pro', to be ignored.
  666. .TP 15
  667. .BI \-lp , \-nlp
  668. Lines up code surrounded by parenthesis in continuation lines.  If a line
  669. has a left paren which is not closed on that line, then continuation lines
  670. will be lined up to start at the character position just after the left
  671. paren.  For example, here is how a piece of continued code looks with -nlp
  672. in effect:
  673. .ne 2
  674. .nf
  675. .ft L
  676.     p1 = first_procedure(second_procedure(p2, p3),
  677.         third_procedure(p4, p5));
  678. .ft R
  679. .fi
  680. .ne 5
  681. With \fB-lp\fR in effect (the default) the code looks somewhat clearer:
  682. .nf
  683. .ft L
  684.     p1 = first_procedure(second_procedure(p2, p3),
  685.                          third_procedure(p4, p5));
  686. .ft R
  687. .fi
  688. .ne 5
  689. Inserting a couple more newlines we get:
  690. .nf
  691. .ft L
  692.     p1 = first_procedure(second_procedure(p2,
  693.                                           p3),
  694.                          third_procedure(p4,
  695.                                          p5));
  696. .ft R
  697. .fi
  698. .TP 15
  699. .B \-pcs , \-npcs
  700. If true (\fB-pcs\fR) all procedure calls will have a space inserted between
  701. the name and the '('.  The default is 
  702. .B \-npcs
  703. .TP 15
  704. .B \-prs , \-nprs
  705. If true (\fB-prs\fR) all parentheses will have a space inserted
  706. after the '(' and before the ')'.  The default is 
  707. .B \-nprs
  708. .TP 15
  709. .B \-psl , \-npsl
  710. If true (\fB-psl\fR) the names of procedures being defined are placed in
  711. column 1 \- their types, if any, will be left on the previous lines.  The
  712. default is 
  713. .B -psl
  714. .TP 15
  715. .BI \-sc , \-nsc
  716. Enables (disables) the placement of asterisks ('*'s) at the left edge of all
  717. comments.    
  718. .TP 15
  719. .BR \-sob , \-nsob
  720. If
  721. .B \-sob
  722. is specified, indent will swallow optional blank lines.  You can use this to
  723. get rid of blank lines after declarations.  Default:
  724. .B \-nsob
  725. .TP 15
  726. .B \-st
  727. Causes
  728. .B indent
  729. to take its input from stdin, and put its output to stdout.
  730. .TP 15
  731. .BI \-T typename
  732. Adds
  733. .I typename
  734. to the list of type keywords.  Names accumulate:
  735. .B \-T
  736. can be specified more than once.  You need to specify all the typenames that
  737. appear in your program that are defined by \fBtypedef\fRs \- nothing will be
  738. harmed if you miss a few, but the program won't be formatted as nicely as
  739. it should.  This sounds like a painful thing to have to do, but it's really
  740. a symptom of a problem in C: \fBtypedef\fR causes a syntactic change in the
  741. language and \fIindent\fR can't find all \fBtypedef\fRs.
  742. .TP 15
  743. .BI \-tabs n
  744. Tells indent that tabs are assumed to be at every
  745. .I n
  746. columns.  The
  747. default is
  748. .B \-tabs8 .
  749. .TP 15
  750. .B \-troff
  751. Causes
  752. .B indent
  753. to format the program for processing by troff.  It will produce a fancy
  754. listing in much the same spirit as
  755. .BR vgrind.
  756. If the output file is not specified, the default is standard output,
  757. rather than formatting in place.
  758. .TP 15
  759. .BR \-v , \-nv
  760. .B \-v
  761. turns on 'verbose' mode,
  762. .B \-nv
  763. turns it off.  When in verbose mode,
  764. .I indent
  765. reports when it splits one line of input into two or more lines of output,
  766. and gives some size statistics at completion. The default is
  767. .BR \-nv .
  768. .TP 15
  769. .B \-+
  770. turns on support for C++. In c++ mode, :: is permited in identifiers, 
  771. C++ keywords are supported, and class definition keywords 
  772. (public, private, etc.) are set in column 2.
  773. .SH "FURTHER DESCRIPTION"
  774. .LP
  775. You may set up your own 'profile' of defaults to
  776. .I indent
  777. by creating a file called
  778. .BI . indent . pro
  779. in either your login directory or the current directory and including
  780. whatever switches you like.  A '.indent.pro' in the current directory takes
  781. precedence over the one in your login directory.  If
  782. .I indent
  783. is run and a profile file exists, then it is read to set up the program's
  784. defaults.  Switches on the command line, though, always override profile
  785. switches.  The switches should be separated by spaces, tabs or newlines.
  786. .LP
  787. .B Comments
  788. .LP
  789. .IR "'Box' comments" .
  790. .I Indent
  791. assumes that any comment with a dash or star immediately after the start of
  792. comment (that is, '/*\-' or '/**') is a comment surrounded by a box of stars.
  793. Each line of such a comment is left unchanged, except that its indentation
  794. may be adjusted to account for the change in indentation of the first line
  795. of the comment.
  796. .LP
  797. .IR "Straight text" .
  798. All other comments are treated as straight text.
  799. .I Indent
  800. fits as many words (separated by blanks, tabs, or newlines) on a
  801. line as possible.  Blank lines break paragraphs.
  802. .LP
  803. .B Comment indentation
  804. .LP
  805. If a comment is on a line with code it is started in the 'comment column',
  806. which is set by the
  807. .BI \-c n
  808. command line parameter.  Otherwise, the comment is started at
  809. .I n
  810. indentation levels less than where code is currently being placed, where
  811. .I n
  812. is specified by the
  813. .BI \-d n
  814. command line parameter.  If the code on a line extends past the comment
  815. column, the comment starts further to the right, and the right margin may be
  816. automatically extended in extreme cases.
  817. .LP
  818. .B Special Comments
  819. .LP
  820. .I Indent
  821. produces and interprets some special comments.
  822. When indent cannot parse the source, it prints a message on standard error
  823. and inserts a comment into the output of the form
  824. .nf
  825. .ft L
  826.     /**INDENT** ErrorMessage */
  827. .ft R
  828. .fi
  829. .LP
  830. .I Indent
  831. interprets several special comments as directives. 
  832. First, it makes no attempt to format lines containing the error comment
  833. described above.
  834. .LP
  835. Second, lines of the form:
  836. .nf
  837. .ft L
  838.     /* INDENT OFF */
  839. or
  840.     /* INDENT ON */
  841. .ft R
  842. .fi
  843. disable and re-enable indent formatting. 
  844. Any amount of whitespace may replace the spaces shown in the examples.
  845. .LP
  846. Third, 
  847. .I indent
  848. allows formatting controls to be included in the source via comments of the form:
  849. .nf
  850. .ft L
  851.     /* INDENT: arg1 arg2 arg3 ... arg4 */
  852. .ft R
  853. .fi
  854. The arguments given are in the same syntax as the command line or profile file.
  855. For example:
  856. .nf
  857. .ft L
  858.     /* INDENT: -cli.25 -nfc1 */
  859. .ft R
  860. .fi
  861. .LP
  862. .B Preprocessor lines
  863. .LP
  864. In general, \fIindent\fR leaves preprocessor lines alone.  The only
  865. reformmatting that it will do is to straighten up trailing comments.  It
  866. leaves imbedded comments alone.  Conditional compilation
  867. (\fB#ifdef...#endif\fR) is recognized and \fIindent\fR attempts to correctly
  868. compensate for the syntactic peculiarites introduced.
  869. .LP
  870. .B C syntax
  871. .LP
  872. \fIIndent\fR understands a substantial amount about the syntax of C, but it
  873. has a 'forgiving' parser.  It attempts to cope with the usual sorts of
  874. incomplete and misformed syntax.  In particular, the use of macros like:
  875. .nf
  876. .ft L
  877.         #define forever for(;;)
  878. .ft R
  879. .fi
  880. is handled properly.
  881. .SH FILES
  882. .DT
  883. .br
  884. \&./.indent.pro    profile file
  885. .br
  886. .SH BUGS
  887. .I Indent
  888. has even more switches than \fIls\fR.
  889.  
  890. .ne 5
  891. A common mistake that often causes grief is typing:
  892. .nf
  893. .ft L
  894.     indent *.c
  895. .ft R
  896. .fi
  897. to the shell in an attempt to indent all the \fBC\fR programs in a directory.
  898. This is a really nasty thing to do.  (Think about it.)
  899.