GNU Info

Info Node: (kpathsea.info)Programming with config files

(kpathsea.info)Programming with config files


Prev: Program-specific files Up: Programming
Enter node , (file) or (file)node

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
`kpse_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 `kpse_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 `kpse_cnf_get' (declared in `kpathsea/cnf.h') with the
string VAR.

  No initialization calls are needed.


automatically generated by info2www version 1.2.2.9