CFLOW(1)                   POSIX Programmer's Manual                  CFLOW(1)



PPRROOLLOOGG
       This manual page is part of the POSIX Programmer's Manual.  The OS
       implementation of this interface may differ (consult the corresponding
       OS manual page for details of OS behavior), or the interface may not be
       implemented on OS.

NNAAMMEE
       cflow -- generate a C-language flowgraph (DDEEVVEELLOOPPMMEENNTT)

SSYYNNOOPPSSIISS
       cflow [[-r]] [[-d _n_u_m]] [[-D _n_a_m_e[[=_d_e_f]]]]... [[-i _i_n_c_l]] [[-I _d_i_r]]...
           [[-U _d_i_r]]... _f_i_l_e...

DDEESSCCRRIIPPTTIIOONN
       The _c_f_l_o_w utility shall analyze a collection of object files or
       assembler, C-language, _l_e_x, or _y_a_c_c source files, and attempt to build
       a graph, written to standard output, charting the external references.

OOPPTTIIOONNSS
       The _c_f_l_o_w utility shall conform to the Base Definitions volume of
       POSIX.1-2017, _S_e_c_t_i_o_n _1_2_._2, _U_t_i_l_i_t_y _S_y_n_t_a_x _G_u_i_d_e_l_i_n_e_s, except that the
       order of the --DD, --II, and --UU options (which are identical to their
       interpretation by _c_9_9) is significant.

       The following options shall be supported:

       --dd _n_u_m    Indicate the depth at which the flowgraph is cut off. The
                 application shall ensure that the argument _n_u_m is a decimal
                 integer. By default this is a very large number (typically
                 greater than 32000). Attempts to set the cut-off depth to a
                 non-positive integer shall be ignored.

       --ii _i_n_c_l   Increase the number of included symbols. The _i_n_c_l option-
                 argument is one of the following characters:

                 _x     Include external and static data symbols. The default
                       shall be to include only functions in the flowgraph.

                 _     (Underscore) Include names that begin with an
                       <underscore>.  The default shall be to exclude these
                       functions (and data if --ii xx is used).

       --rr        Reverse the caller:callee relationship, producing an inverted
                 listing showing the callers of each function. The listing
                 shall also be sorted in lexicographical order by callee.

OOPPEERRAANNDDSS
       The following operand is supported:

       _f_i_l_e      The pathname of a file for which a graph is to be generated.
                 Filenames suffixed by ..ll shall shall be taken to be _l_e_x
                 input, ..yy as _y_a_c_c input, ..cc as _c_9_9 input, and ..ii as the
                 output of _c_9_9 --EE.  Such files shall be processed as
                 appropriate, determined by their suffix.

                 Files suffixed by ..ss (conventionally assembler source) may
                 have more limited information extracted from them.

SSTTDDIINN
       Not used.

IINNPPUUTT FFIILLEESS
       The input files shall be object files or assembler, C-language, _l_e_x, or
       _y_a_c_c source files.

EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS
       The following environment variables shall affect the execution of
       _c_f_l_o_w:

       _L_A_N_G      Provide a default value for the internationalization
                 variables that are unset or null. (See the Base Definitions
                 volume of POSIX.1-2017, _S_e_c_t_i_o_n _8_._2, _I_n_t_e_r_n_a_t_i_o_n_a_l_i_z_a_t_i_o_n
                 _V_a_r_i_a_b_l_e_s for the precedence of internationalization
                 variables used to determine the values of locale categories.)

       _L_C___A_L_L    If set to a non-empty string value, override the values of
                 all the other internationalization variables.

       _L_C___C_O_L_L_A_T_E
                 Determine the locale for the ordering of the output when the
                 --rr option is used.

       _L_C___C_T_Y_P_E  Determine the locale for the interpretation of sequences of
                 bytes of text data as characters (for example, single-byte as
                 opposed to multi-byte characters in arguments and input
                 files).

       _L_C___M_E_S_S_A_G_E_S
                 Determine the locale that should be used to affect the format
                 and contents of diagnostic messages written to standard
                 error.

       _N_L_S_P_A_T_H   Determine the location of message catalogs for the processing
                 of _L_C___M_E_S_S_A_G_E_S.

AASSYYNNCCHHRROONNOOUUSS EEVVEENNTTSS
       Default.

SSTTDDOOUUTT
       The flowgraph written to standard output shall be formatted as follows:


           "%d %s:%s\n", <_r_e_f_e_r_e_n_c_e _n_u_m_b_e_r>, <_g_l_o_b_a_l>, <_d_e_f_i_n_i_t_i_o_n>

       Each line of output begins with a reference (that is, line) number,
       followed by indentation of at least one column position per level.
       This is followed by the name of the global, a <colon>, and its
       definition. Normally globals are only functions not defined as an
       external or beginning with an <underscore>; see the OPTIONS section for
       the --ii inclusion option. For information extracted from C-language
       source, the definition consists of an abstract type declaration (for
       example, cchhaarr **) and, delimited by angle brackets, the name of the
       source file 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 (for example, _t_e_x_t).

       Once a definition of a name has been written, subsequent references to
       that name contain only the reference number of the line where the
       definition can be found. For undefined references, only ""<<>>"" shall be
       written.

SSTTDDEERRRR
       The standard error shall be used only for diagnostic messages.

OOUUTTPPUUTT FFIILLEESS
       None.

EEXXTTEENNDDEEDD DDEESSCCRRIIPPTTIIOONN
       None.

EEXXIITT SSTTAATTUUSS
       The following exit values shall be returned:

        0    Successful completion.

       >0    An error occurred.

CCOONNSSEEQQUUEENNCCEESS OOFF EERRRROORRSS
       Default.

       _T_h_e _f_o_l_l_o_w_i_n_g _s_e_c_t_i_o_n_s _a_r_e _i_n_f_o_r_m_a_t_i_v_e_.

AAPPPPLLIICCAATTIIOONN UUSSAAGGEE
       Files produced by _l_e_x and _y_a_c_c cause the reordering of line number
       declarations, and this can confuse _c_f_l_o_w.  To obtain proper results,
       the input of _y_a_c_c or _l_e_x must be directed to _c_f_l_o_w.

EEXXAAMMPPLLEESS
       Given the following in ffiillee..cc:


           int i;
           int f();
           int g();
           int h();
           int
           main()
           {
               f();
               g();
               f();
           }
           int
           f()
           {
               i = h();
           }

       The command:


           cflow -i x file.c

       produces the output:


           1 main: int(), <file.c 6>
           2    f: int(), <file.c 13>
           3        h: <>
           4        i: int, <file.c 1>
           5    g: <>

RRAATTIIOONNAALLEE
       None.

FFUUTTUURREE DDIIRREECCTTIIOONNSS
       None.

SSEEEE AALLSSOO
       _c_9_9, _l_e_x, _y_a_c_c

       The Base Definitions volume of POSIX.1-2017, _C_h_a_p_t_e_r _8, _E_n_v_i_r_o_n_m_e_n_t
       _V_a_r_i_a_b_l_e_s, _S_e_c_t_i_o_n _1_2_._2, _U_t_i_l_i_t_y _S_y_n_t_a_x _G_u_i_d_e_l_i_n_e_s

CCOOPPYYRRIIGGHHTT
       Portions of this text are reprinted and reproduced in electronic form
       from IEEE Std 1003.1-2017, Standard for Information Technology --
       Portable Operating System Interface (POSIX), The Open Group Base
       Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the
       Institute of Electrical and Electronics Engineers, Inc and The Open
       Group.  In the event of any discrepancy between this version and the
       original IEEE and The Open Group Standard, the original IEEE and The
       Open Group Standard is the referee document. The original Standard can
       be obtained online at http://www.opengroup.org/unix/online.html .

       Any typographical or formatting errors that appear in this page are
       most likely to have been introduced during the conversion of the source
       files to man page format. To report such errors, see
       https://www.kernel.org/doc/man-pages/reporting_bugs.html .



IEEE/The Open Group                  2017                             CFLOW(1)
