DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

cxref(CP)


cxref -- generate C program cross-reference

Syntax

cxref [options] files

Description

The cxref(CP) command analyzes a collection of C files and builds a cross-reference table. cxref uses a special version of cc(CP) to include #define'd information in its symbol table. It generates a list of all symbols (auto, static, and global) in each individual file, or, with the -c option, in combination. The table includes four fields: NAME, FILE, FUNCTION, and LINE. The line numbers appearing in the LINE field also show reference marks as appropriate. The reference marks include:
   assignment   =
   declaration  -
   definition   *
If no reference marks appear, you can assume the reference to be a general reference.

cxref processes supplementary code set characters according to the locale specified in the LC_CTYPE environment variable (see LANG on environ(M)).

The -D, -I, and -U options are interpreted as by cc. In addition, cxref interprets the following options:


-c
Combine the source files into a single report. Without the -c option, cxref generates a separate report for each file on the command line.

-d
Disable printing declarations, making the report easier to read.

-l
Do not print local variables; print only global and file scope statistics.

-o outfile
Direct output to outfile.

-s
Operate silently; does not print input file names.

-t
Format listing for 80-column width.

-w num
Width option that formats output no wider than num (decimal) columns. This option will default to 80 if num is not specified or is less than 51.

-C
Run only the first pass of cxref, creating a .cx file that can later be passed to cxref. This is similar to the -c option of cc or lint(CP).

-F
Print the full path of the referenced file names.

-L cols
Modify the number of table columns in the LINE field. If you do not specify a number, cxref defaults to five columns.

-V
Print version information on the standard error.

-W name, file, function, line
Change the default width of at least one field. The default widths are:

Field Columns
NAME 15
FILE 13
FUNCTION 15
LINE 20 (4 per table column)

 Field      Columns
 NAME       15
 FILE       13
 FUNCTION   15
 LINE       20 (4 per table column)

Exit values

Upon successful completion, the exit status of cflow is 0, otherwise the exit status is non-zero.

Diagnostics

Error messages are unusually cryptic, but usually mean you cannot compile the files.

Examples

Suppose the C source file, a.c, contains the following lines:
   1	main()
   2	{
   3		int i;
   4		extern char c;
   5
   6		i=65;
   7	 	c=(char)i;
   8	}

The resulting cross-reference table produced by cxref is:

NAME FILE FUNCTION LINE  
c a.c --- 4- 7=
i a.c main 3* 6= 7
main a.c --- 2*  
u3b2 predefined --- 0*  
unix predefined --- 0*  

                NAME   FILE         FUNCTION   LINE
                c      a.c          ---        4-      7=
                i      a.c          main       3*      6=   7
                main   a.c          ---        2*
                u3b2   predefined   ---        0*
                unix   predefined   ---        0*

Files


TMPDIR/tcx.*
temporary files

TMPDIR/cx.*
temporary files

LIBDIR/xref
accessed by cxref

LIBDIR
usually /usr/ccs/lib

TMPDIR
usually /var/tmp but can be redefined by setting the environment variable TMPDIR (see tempnam(S)).

See also

cc(CP), cpp(CP), environ(M), lint(CP), tempnam(S)

Standards conformance

cxref(CP) is conformant with:

X/Open Portability Guide, Issue 3, 1989 .


© 2003 Commands for Programming (CP)
SCO OpenServer Release 5.0.7 -- 11 February 2003