cflow - Generates a C language flow graph of external references
cflow [-r] [-d number] [-D name[=def]]... [-i incl] [-I dir]... [-U dir]...
[-MA] [-Ndnumber] [-Nlnumber] [-Nnnumber] [-Ntnumber] file...
The token -- (double-dash) is accepted as a delimiter indicating the end of
options. Any following arguments are treated as operands, even if they
begin with the - character.
Interfaces documented on this reference page conform to industry standards
Refer to the standards(5) reference page for more information about indus-
try standards and associated tags.
Indicates the depth at which the flow graph is cut off. The argument
number is a decimal integer. By default this is a very large number.
Attempts to set the cut-off depth to a nonpositive integer are ignored.
Defines name, as if by a C-language #define directive. If no =def is
given, a value of 1 is used.
Changes the number of included symbols. The incl parameter is one of
the following characters:
_ (Underscore). Includes names that begin with an underscore charac-
ter. By default, these functions are excluded (and corresponding
data if -i x is used).
p [Tru64 UNIX] Disables ANSI function prototypes. By default, unde-
fined function information is filled in with available prototype
x Includes external and static data symbols. By default, only func-
tions are included.
Adds the directory specified by dir to the list of directories in which
the lint program searches for #include files.
-MA [Tru64 UNIX] Specifies that the first pass of the modified lint com-
mand is operated in ANSI mode. The default mode of operation is
[Tru64 UNIX] Changes the dimension table size to number. The default
value of number is 2000.
[Tru64 UNIX] Changes the number of type nodes to number. The default
value of number is 8000.
[Tru64 UNIX] Changes the symbol table size to number. The default
value of number is 1500.
[Tru64 UNIX] Changes the number of tree nodes to number. The default
value of number is 1000.
-r Produces an inverted listing that shows the callers of each function,
sorted by called function.
Removes any initial definition of name, where name is a reserved symbol
that is predefined by the particular preprocessor.
The cflow command analyzes a collection of object files or assembler, C-
language, lex, or yacc source files, and attempts to write a chart of their
external references to standard output.
Files suffixed in .l, .y, .c, and .i are processed by lex and yacc and
preprocessed by the compiler preprocessor phase (bypassed for .i files) as
appropriate. The output is then run through a modified first pass of lint.
Files suffixed with .s are assembled and information is extracted (as in .o
files) from the symbol table.
From this output, cflow() writes a flow graph to standard output. Each line
of output provides the following information (in order from left to right):
+ A line number followed by sufficient tabs to indicate the level of
+ The name of the global, a colon, and its definition
The name is normally a function not defined as external and not beginning
with an underline character (see the -i _ and -i x inclusion options). For
information extracted from C source files, the definition consists of an
abstract type declaration (for example, char*), the name of the source file
surrounded by angle brackets, and the line number on which the definition
was found. Definitions extracted from object files contain the filename
and section under which the symbol appeared, such as text or data. The
cflow command deletes leading underline characters in C-style external
Once the cflow command displays a name, later references to the name con-
tain only the cflow line number where the definition can be found. For
undefined references, cflow displays only <> (angled brackets). If the
nesting level becomes too deep to display in available space, pipe the out-
put from the cflow command to the pr command using the -e option to
compress the tab expansion to less than eight spaces per tab stop.
To ensure that the line numbers produced by cflow match your lex and yacc
files, you must send the .l or .y file to the cflow command.
1. Given the following in file.c:
i = h();
cflow -i x file.c
produces the following output:
1 main: () int, <<file.c 4>>
2 f: () int, <<file.c 11>>
3 h: <<>>
4 i: int, <<file.c 1>>
5 g: <<>>
2. To generate a default flow graph of these C files that comprise a pro-
cflow timeout.c kill.c error.c
3. To produce a C flow graph with a single level of nesting of functions,
cflow -d1 resam.c pptp.c ptpt.c rrr.c whn.c
4. To generate a cflow graph of a lex program, enter:
5. To generate a cflow graph of a yacc program, enter:
6. To generate an inverted listing that shows the callers of each of the
functions in the C files used in the previous examples, enter:
cflow -r resam.c pptp.c ptpt.c rrr.c whn.c
The following environment variables affect the behavior of cflow:
Provides a default value for the locale category variables that are not
set or null.
If set, overrides the values of all other locale variables.
Determines the order in which output is sorted for the -r option.
Determines the locale for the interpretation of byte sequences as char-
acters (single-byte or multibyte) in input parameters and files.
Determines the locale used to affect the format and contents of diag-
nostic messages displayed by the command.
Determines the location of message catalogs for processing of
Commands: lex(1), lint(1), nm(1), pr(1), yacc(1)