cflow(1) cflow(1)
NAME
cflow - generate C flowgraph
SYNOPSIS
cflow [-r] [-i x] [-i ] [-d num] [cc-options] [--] file...
DESCRIPTION
The cflow command analyzes a collection of yacc, lex, assembler, C and
object files and builds a graph charting the external function refer-
ences. Files suffixed with .y, .l, and .c are processed by yacc, lex,
and the C compiler as appropriate. The results of the preprocessed
files, and files suffixed with .i, are then run through the first pass
of lint. Files suffixed with have information extracted from their
symbol tables. The results are collected and turned into a graph of
external references that is written on the standard output.
Each line of output consists, in sequence, of a line number, the name
of the global symbol, a colon, and the type definition. The name will
be indented by a number of tab positions which corresponds to its
nesting depth. Normally only function names that do not begin with an
underscore are listed (see -i). For information extracted from C
source code, the definition consists of an abstract type declaration,
the name of the source file delimited by angle brackets, and the line
number where the definition was found. Definitions extracted from
object files indicate the filename and location counter under which
the symbol appeared (e.g., text). Leading underscores in external
names are deleted. Once a definition of a name has been printed, sub-
sequent references to that name contain only the reference number of
the line where the definition may be found. For undefined references,
only <> is printed.
OPTIONS
In addition to the -D, -I, and -U options, which are interpreted just
as they are by cc/c89, the following options are interpreted by cflow:
-r Reverse the "caller:callee" relationship producing an inverted
listing showing the callers of each function. The listing is also
sorted in lexicographical order by callee.
-i x Include external and static data symbols. The default is to
include only functions in the flowgraph.
-i Include names that begin with an underscore. The default is to
exclude these functions (and data if -i x is used).
-d num
num indicates the depth at which the flowgraph is cut off. By
default this number is very large. Attempts to set the cutoff
depth to a nonpositive integer will be ignored.
-- If the first filename begins with a dash (-), the end of the
command-line options must be marked with --.
Page 1 Reliant UNIX 5.44 Printed 11/98
cflow(1) cflow(1)
EXAMPLES
Suppose the following code is in file.c:
int i;
main()
{
f();
g();
f();
}
f()
{
i = h();
}
The command
cflow -i x file.c
produces the output
1 main: int(), <file.c 4>
2 f: int(), <file.c 11>
3 h: <>
4 i: int, <file.c 1>
5 g: <>
When the nesting level becomes too deep, the output of cflow can be
piped (using the -e option) to the pr command to compress the tab
expansion to less than eight spaces.
EXIT STATUS
cflow reports multiple definitions. Only the first is accepted.
NOTES
Files produced by lex and yacc cause the reordering of line number
declarations, which can disrupt processing by cflow. To get proper
results, feed cflow the yacc or lex input.
LOCALE
The language of the message texts is governed by the environment vari-
able LCALL, LCMESSAGES or LANG.
When the default is set, the system behaves as if it were not interna-
tionalized, i.e. the message texts are in English. You must change one
of these variables in order to change the language of the message
texts.
Detailed information on the dependencies of the environment variables
and on internationalization in general can be found in the manual
Page 2 Reliant UNIX 5.44 Printed 11/98
cflow(1) cflow(1)
"Programmer's Guide: Internationalization - Localization". Refer also
to environ(5) for information on setting the user environment.
SEE ALSO
cc(1), c89(1), lex(1), lint(1), nm(1), pr(1), yacc(1).
Page 3 Reliant UNIX 5.44 Printed 11/98