Config files
------------
As mentioned above, Kpathsea reads "runtime configuration files"
named `texmf.cnf' for search path and other definitions. The search
path used to look for these configuration files is named `TEXMFCNF',
and is constructed in the usual way, as described above, except that
configuration files cannot be used to define the path, naturally; also,
an `ls-R' database is not used to search for them.
Kpathsea reads _all_ `texmf.cnf' files in the search path, not just
the first one found; definitions in earlier files override those in
later files. Thus, if the search path is `.:$TEXMF', values from
`./texmf.cnf' override those from `$TEXMF/texmf.cnf'.
While (or instead of) reading this description, you may find it
helpful to look at the distributed `texmf.cnf', which uses or at least
mentions most features. The format of `texmf.cnf' files follows:
* Comments start with `%' and continue to the end of the line.
* Blank lines are ignored.
* A `\' at the end of a line acts as a continuation character, i.e.,
the next line is appended. Whitespace at the beginning of
continuation lines is not ignored.
* Each remaining line must look like
VARIABLE [. PROGNAME] [=] VALUE
where the `=' and surrounding whitespace is optional.
* The VARIABLE name may contain any character other than whitespace,
`=', or `.', but sticking to `A-Za-z_' is safest.
* If `.PROGNAME' is present, the definition only applies if the
program that is running is named (i.e., the last component of
`argv[0]' is) PROGNAME or `PROGNAME.exe'. This allows different
flavors of TeX to have different search paths, for example.
* VALUE may contain any characters except `%' and `@'. (These
restrictions are only necessary because of the processing done on
`texmf.cnf' at build time, so you can stick those characters in
after installation if you have to.) The `$VAR.PROG' feature is
not available on the right-hand side; instead, you must use an
additional variable (see below for example). A `;' in VALUE is
translated to `:' if running under Unix; this is useful to write a
single `texmf.cnf' which can be used under both Unix and NT. (If
you really want `;''s in your filenames, add
`-DALLOW_SEMICOLON_IN_FILENAMES' to `CFLAGS'.)
* All definitions are read before anything is expanded, so you can
use variables before they are defined (like Make, unlike most other
programs).
Here is a configuration file fragment illustrating most of these points:
% TeX input files -- i.e., anything to be found by \input or \openin ...
latex209_inputs = .:$TEXMF/tex/latex209//:$TEXMF/tex//
latex2e_inputs = .:$TEXMF/tex/latex//:$TEXMF/tex//
TEXINPUTS = .:$TEXMF/tex//
TEXINPUTS.latex209 = $latex209_inputs
TEXINPUTS.latex2e = $latex2e_inputs
TEXINPUTS.latex = $latex2e_inputs
Although this format has obvious similarities to Bourne shell
scripts--change the comment character to `#', disallow spaces around
the `=', and get rid of the `.NAME' convention, and it could be run
through the shell. But there seemed little advantage to doing this,
since all the information would have to passed back to Kpathsea and
parsed there anyway, since the `sh' process couldn't affect its
parent's environment.
The implementation of all this is in `kpathsea/cnf.c'.