kpathsea: Programming with config files
7.4 Programming with config files
=================================
You can (and probably should) use the same 'texmf.cnf' configuration
file that Kpathsea uses for your program. This helps installers by
keeping all configuration in one place.
To retrieve a value VAR from config files, the best way is to call
'kpathsea_var_value' on the string 'VAR'. This will look first for an
environment variable VAR, then a config file value. The result will be
the value found or 'NULL'. This function is declared in
'kpathsea/variable.h'. For an example, see the 'shell_escape' code in
'web2c/lib/texmfmp.c'.
The routine to do variable expansion in the context of a search path
(as opposed to simply retrieving a value) is 'kpathsea_var_expand', also
declared in 'kpathsea/variable.h'. It's generally only necessary to set
the search path structure components as explained in the previous
section, rather than using this yourself.
If for some reason you want to retrieve a value _only_ from a config
file, not automatically looking for a corresponding environment
variable, call 'kpathsea_cnf_get' (declared in 'kpathsea/cnf.h') with
the string VAR.
No initialization calls are needed.