From 48f9e4b1f4dfaf9bfb9dcb935ea1c3d39cf9c779 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 6 Aug 2019 23:33:17 +0000 Subject: new cross-engine (and kpsewhich) option --cnf-line git-svn-id: svn://tug.org/texlive/trunk@51830 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/lib/ChangeLog | 10 ++++++++++ Build/source/texk/web2c/lib/texmfmp.c | 31 +++++++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 2 deletions(-) (limited to 'Build/source/texk/web2c/lib') diff --git a/Build/source/texk/web2c/lib/ChangeLog b/Build/source/texk/web2c/lib/ChangeLog index 68adeb1192a..b0d9c472d10 100644 --- a/Build/source/texk/web2c/lib/ChangeLog +++ b/Build/source/texk/web2c/lib/ChangeLog @@ -1,3 +1,13 @@ +2019-08-06 Karl Berry + + * texmfmp.c (long_options): new option --cnf-line. + (user_cnf_lines, user_cnf_nlines): new globals. + (maininit): call kpathsea_cnf_line_env_progname + on each specified --cnf-line. + (parse_options): recognize it and save each arg. + Following suggestion from Pavel Sanda on ntg-pdftex, + 15 Jun 2019 19:02:11. + 2019-07-01 Hironobu Yamashita * texmfmp.c (getcreationdate): Fix a wrong conditional (XeTeX only). diff --git a/Build/source/texk/web2c/lib/texmfmp.c b/Build/source/texk/web2c/lib/texmfmp.c index 9d8303777ca..5ebb35c84c1 100644 --- a/Build/source/texk/web2c/lib/texmfmp.c +++ b/Build/source/texk/web2c/lib/texmfmp.c @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -663,6 +664,10 @@ int argc; /* If the user overrides argv[0] with -progname. */ static const_string user_progname; +/* Array and count of values given with --config-line. */ +static string *user_cnf_lines = NULL; +static unsigned user_cnf_nlines = 0; + /* The C version of the jobname, if given. */ static const_string c_job_name; @@ -813,6 +818,15 @@ maininit (int ac, string *av) /* FIXME: gather engine names in a single spot. */ xputenv ("engine", TEXMFENGINENAME); + if (user_cnf_lines) { + unsigned i; + for (i = 0; i < user_cnf_nlines; i++) { + /* debug printf ("ucnf%d: %s\n", i, user_cnf_lines[i]); */ + kpathsea_cnf_line_env_progname (kpse_def, user_cnf_lines[i]); + free (user_cnf_lines[i]); + } + } + /* Were we given a simple filename? */ main_input_file = get_input_file_name (); @@ -998,6 +1012,7 @@ maininit (int ac, string *av) /* The entry point: set up for reading the command line, which will happen in `topenin', then call the main body. */ + int #if defined(DLLPROC) DLLPROC (int ac, string *av) @@ -1633,17 +1648,18 @@ get_input_file_name (void) static struct option long_options[] = { { DUMP_OPTION, 1, 0, 0 }, #ifdef TeX - /* FIXME: Obsolete -- for backward compatibility only. */ + /* Obsolete -- for backward compatibility only. */ { "efmt", 1, 0, 0 }, #endif + { "cnf-line", 1, 0, 0 }, { "help", 0, 0, 0 }, { "ini", 0, &iniversion, 1 }, { "interaction", 1, 0, 0 }, { "halt-on-error", 0, &haltonerrorp, 1 }, { "kpathsea-debug", 1, 0, 0 }, { "progname", 1, 0, 0 }, - { "version", 0, 0, 0 }, { "recorder", 0, &recorder_enabled, 1 }, + { "version", 0, 0, 0 }, #ifdef TeX #ifdef IPC { "ipc", 0, &ipcon, 1 }, @@ -1740,6 +1756,17 @@ parse_options (int argc, string *argv) } else if (ARGUMENT_IS ("progname")) { user_progname = optarg; + } else if (ARGUMENT_IS ("cnf-line")) { + if (user_cnf_lines == NULL) { + user_cnf_nlines = 1; + user_cnf_lines = xmalloc (sizeof (const_string)); + } else { + user_cnf_nlines++; + user_cnf_lines = xrealloc (user_cnf_lines, + user_cnf_nlines * sizeof (const_string)); + } + user_cnf_lines[user_cnf_nlines-1] = xstrdup (optarg); + } else if (ARGUMENT_IS ("jobname")) { #ifdef XeTeX c_job_name = optarg; -- cgit v1.2.3