1 /* proginit.c: useful initializations for DVI drivers.
3 Copyright 1994, 1995, 1996, 2008 Karl Berry.
4 Copyright 1997, 2005 Olaf Weber.
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public License
17 along with this library; if not, see <http://www.gnu.org/licenses/>. */
19 #include <kpathsea/config.h>
20 #include <kpathsea/c-pathch.h>
21 #include <kpathsea/proginit.h>
22 #include <kpathsea/tex-file.h>
25 /* These initializations were common to all the drivers modified for
26 kpathsea, so a single routine seemed in order. Kind of a bollixed-up
27 mess, but still better than repeating the code. */
30 kpse_init_prog P4C(const_string, prefix, unsigned, dpi, const_string, mode,
31 const_string, fallback)
33 string font_var = concat (prefix, "FONTS");
34 string header_var = concat (prefix, "HEADERS");
35 string makepk_var = concat (prefix, "MAKEPK");
36 string size_var = concat (prefix, "SIZES");
38 /* Do both `pk_format' and `any_glyph_format' for the sake of xdvi; in
39 general, mktexpk might apply to either, and the program will ask
40 for the one it wants. */
42 /* Might have a program-specific name for mktexpk itself. */
43 if (getenv (makepk_var)) {
44 /* If we did, we want to enable the program, I think. */
45 kpse_set_program_enabled (kpse_pk_format, 1, kpse_src_env);
46 kpse_set_program_enabled (kpse_any_glyph_format, 1, kpse_src_env);
48 kpse_format_info[kpse_pk_format].program
49 = kpse_format_info[kpse_any_glyph_format].program
50 = getenv (makepk_var);
53 /* A couple font paths have traditionally had application-specific
54 environment variables to override all else; namely, XDVIFONTS and
55 DVIPSHEADERS. So set those if we have them. */
56 kpse_format_info[kpse_pk_format].override_path
57 = kpse_format_info[kpse_gf_format].override_path
58 = kpse_format_info[kpse_any_glyph_format].override_path
59 = kpse_format_info[kpse_tfm_format].override_path
62 kpse_format_info[kpse_tex_ps_header_format].override_path
63 = getenv (header_var);
65 kpse_init_fallback_resolutions (size_var);
66 xputenv_int ("MAKETEX_BASE_DPI", dpi);
67 kpse_fallback_font = fallback;
69 /* Ugliness. See comments in kpse_make_tex in kpathsea/tex-make.c. */
70 xputenv ("MAKETEX_MODE", mode ? mode : DIR_SEP_STRING);