[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4 Various Output Formats.

The output format described in previous chapters is called GNU Output. Beside this, cflow is also able to produce output format defined in POSIX standard (1). In this format, each line of output begins with a reference number, i.e. the ordinal number of this line in the output, followed by indentation of fixed amount of columns per level (see setting indentation). Following this are the name of the function, a colon and the function definition, if available. The function definition is followed by the location of the definition (file name and line number). Both definition and location are enclosed in angle brackets. If the function definition is not found, the line ends with an empty pair of angle brackets.

This output format is used when either a command line option ‘--format=posix’ (‘-f posix’) has been given, or the environment variable POSIXLY_CORRECT was set.

The output graph in POSIX format for our sample ‘whoami.c’ file will look as follows:

$ cflow --format=posix whoami.c
    1 main: int (int argc,char **argv), <whoami.c 26>
    2     fprintf: <>
    3     who_am_i: int (void), <whoami.c 8>
    4         getpwuid: <>
    5         geteuid: <>
    6         getenv: <>
    7         fprintf: <>
    8         printf: <>

It is not clear from the POSIX specification whether the output should contain argument lists in function declarations, or not. By default cflow will print them. However, some programs, analyzing cflow output expect them to be absent. If you use such a program, add ‘--omit-arguments’ option to cflow command line (see omit signature parts).

To produce a graphical representation of the flowgraph, use the ‘-f dot’ (‘--format=dot’). This outputs a graph in DOT format(2). To view the output on screen, use graphviz (3) dot program.

For example, you can create and view the flowgraph of the whoami example program with the following command:

cflow -f dot whoami.c | dot -Txlib

[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on December 30, 2021 using texi2html 5.0.