Next: , Previous: Cross-References, Up: Top

10 Configuration Files and Variables.

As shown in the previous chapters, GNU cflow is highly configurable. Different command line options have different effects, as specifying new operation modes or altering some aspects of the output. You will likely use some options frequently, while you will use others from time to time, or not at all (See Options, for a full list of options).

The CFLOW_OPTIONS environment variable specifies default options to be placed in front of any explicit options. For example, if you set CFLOW_OPTIONS="--format=posix --cpp" in your .profile, cflow will behave as if the two options --format=posix and --cpp had been specified before any explicit options.

There is also another possibility to specify your default options. After incorporating eventual content of CFLOW_OPTIONS variable, cflow checks the value of the environment variable CFLOWRC. This value, if not empty, specifies the name of the configuration file to read. If CFLOWRC is not defined or is empty, the program attempts to read file .cflowrc in the user's home directory. It is not an error if any of these files does not exist. However, if the file does exist but cannot be processed, cflow will issue an explicit error message.

The configuration file is read line by line. Empty lines and lines beginning with usual shell comment character (‘#’) are ignored. Otherwise, the line is split into words, the same way shell does, and the resulting words are placed in the command line after any options taken from CFLOW_OPTIONS variable, but before any explicit options.

Pay attention when using such options as -D in the configuration file. The value of the -D option will be added to the preprocessor command line and will be processed by the shell, so be careful to properly quote its argument. The rule of thumb is: “use the same quoting you would have used in the shell command line”. For example, to run cc -E as a preprocessor, you can use the following configuration file:

     --cpp='cc -E'

By the way, the above example shows a way of coping with the ‘__extension__()’ construct used by gcc, i.e. by defining it to an empty string.

It may sometimes be necessary to cancel the effect of a command line option. For example, you might specify --brief in your configuration file, but then occasionally need to obtain verbose graph. To cancel the effect of any GNU cflow option that does not take arguments, prepend ‘no-’ to the corresponding long option name. Thus, specifying --no-brief cancels the effect of the previous --brief option.