Go to the first, previous, next, last section, table of contents.


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.


Go to the first, previous, next, last section, table of contents.