1 /* setupvar.c: Look up a value in texmf.cnf or use default.
3 Adapted in 2010 by Peter Breitenlohner. Public domain.
4 Written in 1995 by Karl Berry. Public domain. */
6 #include <w2c/config.h>
8 #include <kpathsea/variable.h>
10 /* Look up VAR_NAME in texmf.cnf; assign either the value found there or
14 setupboundvariable (integer
*var
, const_string var_name
, integer dflt
)
16 string expansion
= kpse_var_value (var_name
);
20 integer conf_val
= atoi (expansion
);
21 /* It's ok if the cnf file specifies 0 for extra_mem_{top,bot}, etc.
22 But negative numbers are always wrong. */
23 if (conf_val
< 0 || (conf_val
== 0 && dflt
> 0)) {
25 "%s: Bad value (%ld) in environment or texmf.cnf for %s, keeping %ld.\n",
27 (long) conf_val
, var_name
, (long) dflt
);
29 *var
= conf_val
; /* We'll make further checks later. */