4.3BSD-UWisc/man/catl/cxref.l




CXREF(1)            UNIX Programmer's Manual             CXREF(1)



NAME
     cxref - cross reference C source files

SYNOPSIS
     cxref [ -FSCcfis ] [ -w _w_i_d_t_h ] [files]

DESCRIPTION
     _C_x_r_e_f reads the named C source files and produces on the
     standard output a cross reference of all the identifiers and
     constants in the files.  Constants are integer constants
     (12, 0421, 0x1A), floating point constants (123.45, 0.2e-4),
     string constants ("this is a string\n"), and character con-
     stants ('a', '\033').  Identifiers, character constants, and
     string constants are sorted lexicographically, i.e. accord-
     ing to the machine collating sequence (7-bit ASCII on the
     Vax or the Pyramid).  Integer and floating point constants
     are sorted numerically.  The trailing 'l' or 'L' on long
     integer constants will not show up in the output listing.

     If no files are named, _c_x_r_e_f reads the standard input. For
     multiple files, the argument "-" (a single dash) indicates
     that the standard input should be read at that point.

     If arguments are given, they must come before any file
     names.

     _C_x_r_e_f recognizes the following arguments:

          -F   Fold case in comparison.  By default, case is dis-
               tinct in comparison of identifiers and string and
               character constants.  (_c_x_r_e_f simply passes the
               "-F" option on to _s_o_r_t(1) as "-f".)

          -S   Cross reference all files separately.  The default
               action is to cross reference all named files
               together.

          -c   Leave character constants out of the cross refer-
               ence listing.

          -f   Leave floating point constants out of the cross
               reference listing.

          -i   Leave integer constants out of the cross reference
               listing.

          -s   Leave string constants out of the cross reference
               listing.

          -C   Leave _a_l_l constants, character, string, integer,
               and floating point, out of the cross reference
               listing.  By default, all types of constants are



Printed 1/10/87           Georgia Tech                          1






CXREF(1)            UNIX Programmer's Manual             CXREF(1)



               included in the cross reference.

          -w _w_i_d_t_h
               Make the output be _w_i_d_t_h columns wide.  The output
               width will never be less than 51 or more than 132
               columns.  _C_x_r_e_f silently adjusts incorrect set-
               tings to the nearest allowable setting.  If no
               width is specified, the output will default to 80
               columns wide.

     _C_x_r_e_f does _n_o_t include #include files, or expand macro
     definitions.  Files named in #include lines can be listed on
     the command line if they should also be cross referenced.

     If a quoted string has an escaped newline in it (see ``The C
     Programming Language'', page 181, or Section 2.5 of the C
     Reference Manual), it will show up inside the string in the
     output listing as \N.  This is to make it visible to the
     programmer, and to keep the various filters which _C_x_r_e_f uses
     to actually do the work from getting terribly confused.

     _C_x_r_e_f is best run in the background, with its output
     redirected into a file or the line printer spooler _l_p_r(1),
     since it reads all the named files, using _s_o_r_t(1) as an
     intermediate pass.  The sorting can take time which the user
     can probably put to more productive use.

DIAGNOSTICS
     Self explanatory.

BUGS
     Systems running UNIX 4.0 and later already have a program
     named _c_x_r_e_f.  Therefore, on those systems, this program
     should be renamed.

     _C_x_r_e_f does not do any formatting on its output (other than
     to insure that it writes the proper number of columns), so
     it should probably be run piping its output into _p_r(1).

     Floating point constants are converted to a common format
     for sorting, therefore they may appear in the output in a
     format different from (but numerically equivalent to) their
     form in the original source code.

SEE ALSO
     _l_e_x(1), _l_p_r(1), _p_r(1), _s_o_r_t(1)

FILES
     /tmp/cxr.$$.*
          temporary files for integer and floating point
          contstants.  _C_x_r_e_f removes these files when it is
          through.



Printed 1/10/87           Georgia Tech                          2






CXREF(1)            UNIX Programmer's Manual             CXREF(1)



AUTHOR
     Arnold Robbins
     School of Information and Computer Science
     Georgia Institute of Technology
     Atlanta, Geogia  30332

     UUCP:     gatech!arnold
     CSNET:    arnold@gatech
     ARPANET:  arnold%gatech.csnet@csnet-relay.arpa

     Copyright (c) 1984 by Arnold Robbins.  All rights reserved.
     This program may not be sold, but may be distributed pro-
     vided this notice is included.










































Printed 1/10/87           Georgia Tech                          3