summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/lib
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-02-25 19:22:25 +0000
committerKarl Berry <karl@freefriends.org>2021-02-25 19:22:25 +0000
commitad547a6b5986815fda458221149728d9d9ab1d87 (patch)
tree16296910eb3eca724371474ea9aea3994dc69614 /Build/source/texk/web2c/lib
parent947b43de3dd21d58ccc2ffadefc4441ea1c2a813 (diff)
restore Build,TODO from r57911
git-svn-id: svn://tug.org/texlive/trunk@57915 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/lib')
-rw-r--r--Build/source/texk/web2c/lib/ChangeLog3105
-rw-r--r--Build/source/texk/web2c/lib/Makefile.am48
-rw-r--r--Build/source/texk/web2c/lib/Makefile.in876
-rw-r--r--Build/source/texk/web2c/lib/README2
-rw-r--r--Build/source/texk/web2c/lib/alloca.c504
-rw-r--r--Build/source/texk/web2c/lib/basechsuffix.c43
-rw-r--r--Build/source/texk/web2c/lib/chartostring.c23
-rw-r--r--Build/source/texk/web2c/lib/coredump.c58
-rw-r--r--Build/source/texk/web2c/lib/eofeoln.c65
-rw-r--r--Build/source/texk/web2c/lib/fprintreal.c15
-rw-r--r--Build/source/texk/web2c/lib/input2int.c48
-rw-r--r--Build/source/texk/web2c/lib/inputint.c20
-rw-r--r--Build/source/texk/web2c/lib/lib.h73
-rw-r--r--Build/source/texk/web2c/lib/main.c45
-rw-r--r--Build/source/texk/web2c/lib/mfmpi386.asm145
-rw-r--r--Build/source/texk/web2c/lib/mfmpw32.c189
-rw-r--r--Build/source/texk/web2c/lib/openclose.c471
-rw-r--r--Build/source/texk/web2c/lib/printversion.c78
-rw-r--r--Build/source/texk/web2c/lib/setupvar.c33
-rw-r--r--Build/source/texk/web2c/lib/texmfmp.c4036
-rw-r--r--Build/source/texk/web2c/lib/uexit.c20
-rw-r--r--Build/source/texk/web2c/lib/usage.c35
-rw-r--r--Build/source/texk/web2c/lib/version.c6
-rw-r--r--Build/source/texk/web2c/lib/zround.c42
24 files changed, 9980 insertions, 0 deletions
diff --git a/Build/source/texk/web2c/lib/ChangeLog b/Build/source/texk/web2c/lib/ChangeLog
new file mode 100644
index 00000000000..be05b6cdcee
--- /dev/null
+++ b/Build/source/texk/web2c/lib/ChangeLog
@@ -0,0 +1,3105 @@
+2021-01-01 Akira Kakuto <kakuto@w32tex.org>
+
+ * printversion.c: Update copyright year.
+
+2020-12-10 Akira Kakuto <kakuto@w32tex.org>
+
+ * lib.h: Definition of eof() contradicts corecrt_io.h
+ in Visual Studio 2019.
+
+2020-09-24 Akira Kakuto <kakuto@w32tex.org>
+
+ * texmfmp.c: Call kpse_in_name_ok() in find_input_file() for
+ getfilemoddate(), getfilesize(), getfiledump() and getmd5sum(),
+ instead of in each separate routine. Doing it in the latter
+ means we always check an absolute filename, and thus fail with
+ openin_any=p. Original report from Adrian,
+ https://tug.org/pipermail/tex-live/2020-September/046127.html
+
+2020-08-28 Karl Berry <karl@tug.org>
+
+ * texmfmp.c (input_line): always clear errno before calling getc,
+ else an EINTR errno might persist, masking a real EOF. On the other
+ hand, loop as long as we have EOF && EINTR so we don't prematurely
+ stop reading characters.
+ https://tug.org/pipermail/tex-k/2020-August/003297.html
+
+2020-07-18 Karl Berry <karl@freefriends.org>
+
+ * texmfmp.c: reformat so that all function return types and names
+ both are at the beginning of a line.
+
+2020-07-17 Karl Berry <karl@freefriends.org>
+
+ * texmfmp.c (calledit): close only open input files,
+ not non-files resulting from terminal interactions.
+ This means looking at each element of input_stack
+ instead of only looking at the input_file array. Painful.
+ Original report from Xiao Zhang,
+ https://tex.stackexchange.com/q/552113
+
+2020-01-01 Akira Kakuto <kakuto@w32tex.org>
+
+ * printversion.c: Update copyright year.
+
+2019-12-10 Hironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
+
+ * do_dump [FMT_COMPRESS]: change conditional from XeTeX.
+
+2019-08-10 Andreas Scherer <https://ascherer.github.io>
+
+ * lib.h: add missing prototypes from 'openclose.c' and 'texmfmp.c'.
+
+2019-08-09 Karl Berry <karl@freefriends.org>
+
+ * texmfmp.c (texmf_yesno): no longer static, since we call it
+ from tex.ch.
+
+ * texmfmp.c: doc fixes; most "fixme"s were nothing that we ever
+ need to fix at this late date.
+
+2019-08-08 Akira Kakuto <kakuto@w32tex.org>
+
+ * texmfmp.c: This file is not used in lua[jit]tex.
+
+2019-08-07 Akira Kakuto <kakuto@w32tex.org>
+
+ * texmfmp.c: Improve support of non-ascii path names in
+ synctex. Support -cnf-line=command_line_encoding=value.
+ These changes are for Windows only.
+
+2019-08-06 Karl Berry <karl@freefriends.org>
+
+ * 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 <h.y.acetaminophen@gmail.com>
+
+ * texmfmp.c (getcreationdate): Fix a wrong conditional (XeTeX only).
+
+2019-06-30 Hironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
+
+ * texmfmp.c (getfiledump): Change readbuffer to unsigned char*.
+ Without this change, xetexdir/tests/filedump.tex ends up with
+ "!error: snprintf failed: file ../../../texk/web2c/lib/texmfmp.c"
+ (XeTeX only).
+
+2019-05-14 Akira Kakuto <kakuto@w32tex.org>
+
+ * texmfmp.c: Support non-ascii file names in special cases
+ implemented in a previous change on 2019-05-08 (Windows only).
+
+2019-05-08 Akira Kakuto <kakuto@w32tex.org>
+
+ * texmfmp.c: Introduce a new function find_input_file(s)
+ to fix a bug that in special cases getfilesize() etc. for
+ image files saved in "output-directory" do not work.
+ A report in tex-k list:
+ https://tug.org/pipermail/tex-k/2019-May/003014.html
+
+2019-03-30 Akira Kakuto <kakuto@w32tex.org>
+
+ * texmfmp.c: Improve to record texmf.cnf. (ptex and friends,
+ and w32 only).
+ * openclose.c: Remove "static" in order to use relevant
+ functions externally. (w32 only).
+
+2019-03-23 Akira Kakuto <kakuto@w32tex.org>
+
+ * texmfmp.c: On windows, xetex and pdftex did not record
+ texmf.cnf in the case of --recorder because of special
+ initializations. Fix this bug. It is not needed to rebuild
+ in other platforms.
+
+2019-01-01 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * printversion.c: Update copyright year.
+
+2018-12-17 Igor Liferenko <igor.liferenko@gmail.com>
+
+ * texmfmp.c (maininit): default to guessing an explicit &dumpname
+ as the "preloaded" (not really) format, if one was specified.
+ tex-k msgs of 23 Sep 2018 12:13:06, 23 Sep 2018 18:36:52.
+ (With comment and formatting tinkering from karl.)
+
+2018-12-17 Andreas Scherer <https://ascherer.github.io>
+
+ * printversion.c (printversionandexit): Search for PROGNAME
+ in banner independent of 'This is' prefix.
+
+2018-11-19 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c: Remove unused functions for XeTeX.
+ Check kpse_in_name_ok() in getfilesize(), getfiledump(),
+ and getmd5sum().
+
+2018-11-18 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c: Make necessary changes for XeTeX in
+ getcreationdate(), getfilemoddate(), getfilesize(),
+ and getfiledump().
+
+2018-11-17 Joseph Wright <joseph.wright@morningstar2.co.uk>
+
+ * texmfmp.c: Support some primitives from pdfTeX in XeTeX.
+
+2018-11-14 Andreas Scherer <https://ascherer.github.io>
+
+ * printversion.c: free xmalloc'd prog_name.
+
+2018-11-13 Karl Berry <karl@freefriends.org>
+
+ * texmfmp.c (FORCE_SOURCE_DATE_set, SOURCE_DATE_EPOCH_set): new static.
+ (init_start_time, get_date_and_time): initialize them.
+ (getfilemoddate): use_utc if both vars set.
+ Original suggestion from Ulrike Fischer, tex-live 3 Nov 2018 23:00:48,
+ original patch from Akira Kakuto.
+ (getfilemoddate): also, return nothing if ! kpse_in_name_ok.
+
+2018-11-04 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * openclose.c: cleanup for non-ascii file names (w32 only)
+
+2018-06-28 Karl Berry <karl@freefriends.org>
+
+ * openclose.c (open_input_with_dirname): do not prepend the
+ top-level directory name if the subsidiary aux file being searched
+ for is alrady absolute. Private report from John Collins
+ (22 Jun 2018 14:01:31).
+
+2018-06-14 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c: remove sjisterminal (w32 only).
+
+2018-06-10 TANAKA Takuji <ttk@t-lab.opal.ne.jp>
+
+ * texmfmp.c: Allow non-ascii file names for pdfTeX
+ with UTF-8 source files (w32 only).
+
+2018-06-09 TANAKA Takuji <ttk@t-lab.opal.ne.jp>
+
+ * texmfmp.c, openclose.c: Support UTF-8 file names
+ on UTF-8 locale in pTeX (Unix-like platform only).
+
+2018-05-29 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c: Discard the changes for pdfTeX on 2018-05-11,
+ since 'command_line_encoding=utf-8' is not so natural
+ for pdfTeX (w32 only).
+
+2018-05-12 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c: Allow non-ascii file names for pdfTeX (w32 only).
+ Changes on 2018-05-11 were incomplete.
+
+2018-05-11 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c: Allow non-ascii file names for pdfTeX (w32 only).
+
+2018-03-16 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c: Remove support of short 8.3 names (w32 only).
+
+2018-01-01 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * printversion.c: 2017 ---> 2018.
+
+2017-10-21 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * openclose.c: If opened fname is a directory in
+ output_directory, discard it in Unix platforms.
+ Report from Duncan Steele,
+ http://tug.org/pipermail/tex-live/2017-October/040731.html
+
+ In Windows, fopen (fname, mode) is always NULL, in the case
+ where fname is a directory, thus it is discarded automatically.
+ Thanks to Hironobu Yamashita,
+ http://tug.org/pipermail/tex-live/2017-October/040735.html
+
+2017-09-05 Karl Berry <karl@tug.org>
+ and Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c (IS_SPC_OR_EOL): new macro.
+ (topenin): use it, instead of ISBLANK.
+ (parse_first_line): doc fix.
+ (input_line): remove only trailing space characters
+ instead of using ISBLANK.
+ See also analogous change in xetexdir/XeTeX_ext.c.
+ Original bug report from Evan Aad,
+ http://tug.org/pipermail/tex-k/2017-August/002801.html
+
+2017-03-12 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c: Adopt Jonathan's solution for the Change on 2017-02-01.
+
+2017-02-13 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c: unsigned long long >= 0. Thanks Luigi.
+
+2017-02-01 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c: Avoid a crash in xelatex for
+ http://tug.org/pipermail/xetex/2017-January/026975.html.
+ It is not a fix but a stopgap.
+
+2017-01-02 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * printversion.c: 2016 ---> 2017.
+
+2016-11-14 Hironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
+
+ * texmfmp.c: Change a condition to support new primitives in e(u)ptex.
+
+2016-06-12 Karl Berry <karl@freefriends.org>
+
+ * texmfmp.c (get_date_and_time):
+ rename envvar SOURCE_DATE_EPOCH_TEX_PRIMITIVES to FORCE_SOURCE_DATE.
+ http://tug.org/pipermail/tex-k/2016-June/002722.html
+ (and surrounding thread, starting in May)
+
+2016-05-20 Karl Berry <karl@tug.org>
+
+ * TeX Live 2016 release.
+
+2016-05-06 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c: Avoid crash for too large a value of SOURCE_DATE_EPOCH.
+ (w32 only).
+
+2016-05-06 Karl Berry <karl@tug.org>
+
+ * texmfmp.c (init_start_time, get_date_and_time) [onlyTeX]:
+ ignore SOURCE_DATE_EPOCH... envvars for original TeX.
+
+2016-05-05 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c (strtoull) [_MSC_VER]: #define as _strtoui64.
+
+2016-05-04 Karl Berry <karl@freefriends.org>
+
+ * texmfmp.c (init_start_time): new fn, factored out from
+ initstarttime.
+ (get_date_and_time): if envvar SOURCE_DATE_EPOCH_TEX_PRIMITIVES
+ is set, initialize minutes, day, month, year, from
+ SOURCE_DATE_EPOCH value. Requested by Debian, thread starting at
+ http://tug.org/pipermail/tex-k/2016-May/002691.html.
+
+2016-04-14 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c: Fix a bug to show input file name in the case of pipe input.
+ Reported by Enrico Gregorio:
+ http://tug.org/pipermail/tex-live/2016-April/038030.html
+
+2016-03-22 Karl Berry <karl@freefriends.org>
+
+ * texmfmp.c: no uexit after FATAL.
+
+2016-03-21 Karl Berry <karl@freefriends.org>
+
+ * texmfmp.c (initstarttime): wording of invalid SOURCE_DATE_EPOCH.
+
+2016-01-26 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c: Improve to skip BOM (win32 only).
+
+2016-01-02 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * printversion.c: 2015 ---> 2016.
+
+2015-11-15 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c: Show return code of system() if it is not zero.
+
+2015-11-01 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c: Improve restricted shell escape for w32 a little.
+
+2015-08-19 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c: Another minor modification (unused static).
+
+2015-08-18 The Thanh Han <hanthethanh@gmail.com>
+
+ * texmfmp.c: Patch from Maria with some minor modification.
+
+2015-07-09 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c: Add \pdfmdfivesum to XeTeX.
+
+2015-07-02 Hironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
+
+ * texmfmp.c: Moved convertStringToHexString() and getmd5sum()
+ from ../pdftexdir/utils.c to here.
+
+2015-06-12 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ Integrate MFLua and MFLuaJIT.
+ * texmfmp.c: Adapted.
+
+2015-03-16 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * printversion.c: 2014 ---> 2015.
+
+2014-11-06 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c: Avoid MinGW64 warnings (INVALID_SOCKET => -1).
+
+2014-11-03 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c: Indentation.
+
+2014-10-30 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c: Use the decision about tex*.dll from ../texmfmp.h.
+
+2014-10-09 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c: Apply some code from W32TeX.
+
+2014-08-22 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c: Symplify support of multibyte characters, by
+ updating fsyscp_popen in kpathsea (Windows only).
+
+2014-08-22 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c: Avoid several compiler warnings (Windows only).
+
+2014-08-22 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c: Support multibyte characters in pipe (Windows only).
+
+2014-07-23 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c: Short-file-name convention is incompatible with
+ --src-specials (Windows only).
+
+2014-07-21 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c: Use getnullstr() in maketexstring(), also in aleph.
+
+2014-07-19 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c: Use getnullstr() in maketexstring(), as in pdfTeX,
+ in most cases in order to avoid an assertion error.
+
+2014-07-15 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c: Replace the deprecated spawnvp() by _spawnvp(),
+ they differ for 64-bit MinGW.
+
+2014-07-04 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c: Remove redundant cpp macros (w32 only).
+
+2014-06-20 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c: Support short-file-name convention (w32 only).
+
+2014-05-06 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ Update to e-pTeX and e-upTeX from Akira Kakuto.
+ * texmfmp.c (getfiledump): Move definition of this function
+ also used by e-(u)pTeX from ../pdftexdir/utils.c to here.
+
+2014-01-20 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * printversion.c: 2013 ---> 2014.
+
+2014-01-15 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c: Do not declare dump_name, now done in change files.
+
+2014-01-14 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c: use fsyscp_system instead of system (Windows only).
+
+2013-12-31 TANAKA Takuji <KXD02663@nifty.ne.jp>
+
+ * openclose.c: bug fix about error check when fopen.
+ Use fsyscp_fopen() instead of fsyscp_xfopen() (Windows only)
+ * texmfmp.c: Use get_command_line_args_utf8() (Windows only)
+
+2013-12-03 TANAKA Takuji <KXD02663@nifty.ne.jp>
+
+ * openclose.c, texmfmp.c: Support KANJI file name in (e)upTeX and
+ XeTeX on Windows.
+
+2013-06-11 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ Update to e-pTeX and e-upTeX 130605 from Hironori Kitagawa.
+ * texmfmp.c (pdftex_fail): Adapted from ../pdftexdir/utils.c.
+ (initstarttime, makecstring, makecfilename, getcreationdate,
+ getfilemoddate, getfilesize): Move definition of these functions
+ also used by e-(u)pTeX from ../pdftexdir/utils.c to here.
+
+2013-04-09 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * printversion.c: 2012 ---> 2013.
+
+2013-01-18 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c (mk_shellcmdlist): Simplify.
+
+2013-01-06 Khaled Hosny <khaledhosny@eglug.org>
+
+ * texmfmp.c [XeTeX]: Support input pipes.
+
+2012-11-20 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * Makefile.am: Avoid use of deprecated INCLUDES.
+
+2012-10-14 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c: Use _IONBF for unbuffered stream.
+
+2012-10-10 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c (mk_shellcmdlist): The argument is not constant.
+
+2012-10-10 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c: Modify determination of fullpath for restricted shell
+ escape commands.
+
+2012-09-19 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c: Since normalize_quotes() is declared static,
+ the forward declaration should also be static.
+
+2012-09-11 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c (maininit): On Windows, latex "\input" "a b c", for example,
+ was not allowed. Allow file name with spaces in these cases.
+
+2012-08-28 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * main.c [WIN32]: Added _setmaxstdio() (from W32TeX).
+
+ * openclose.c (recorder_start): Reduce TL/W32TeX diffs.
+ Avoid using pid_t lacking in WIN32 (MSVC).
+
+2012-08-22 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c [IS_pTeX]: Rename initdefaultkanji() => initkanji().
+
+2012-08-06 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c [WIN32]: bug fix. use rewind (f) to clear error and
+ EOF indicators.
+
+2012-07-23 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c (runpopen): Binary mode for popen() on Windows now
+ done in kpathsea.
+
+2012-06-30 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c [WIN32]: Ignore DLLPROC for __MINGW32__.
+
+2012-06-30 Peter Breitenlohner <peb@mppmu.mpg.de>
+2012-06-27 Norbert Preining <preining@logic.at>
+
+ * texmfmp.c (runpopen): Append "b" on Windows.
+ (open_{in,out}_or_pipe): Do not use the "b" here.
+
+2012-06-27 Karl Berry <karl@tug.org>
+
+ * texmfmp.c (generic_synctex_get_current_name): return the
+ empty string if passed null (can happen with -ini).
+
+2012-06-26 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c (open_{in,out}_or_pipe): Use popen() modes "rb" and
+ "wb" only for Windows, Posix allows them only for fopen().
+ (This makes pdftex's \input"|..." feature work again,
+ unintentionally broken.)
+ tex-live mail, 26 Jun 2012 06:24:11.
+
+2012-05-04 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * printversion.c (printversionandexit): Update 'Copyright 2012'.
+
+2012-04-08 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c (mk_shellcmdlist, init_shell_escape,
+ shell_cmd_is_allowed, normalize_quotes): Declare as static.
+ (get_seconds_and_micros): Define only for pdfTeX.
+ (getrandomseed): Removed, MP only.
+
+2012-03-04 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ Avoid 'differ in signedness' warnings.
+ * texmfmp.c (input_line): Cast buffer to 'unsigned char *'.
+
+2012-02-14 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * eofeoln.c (eof): Fix a typo in comment.
+
+2012-01-30 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * printversion.c, texmfmp.c: Drop report of file offset bits.
+
+2012-01-17 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * lib.h, printversion.c, texmfmp.c: Report file offset bits.
+
+2011-12-06 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * setupvar.c (setupboundvariable): Warning message: the bad
+ value can be from the environment or from texmf.cnf.
+
+2011-10-11 Peter Breitenlohner <peb@mp.mpg.de>
+
+ * texmfmp.c [WIN32]: Slightly reformulate Byte order marks.
+
+2011-10-07 Peter Breitenlohner <peb@mp.mpg.de>
+
+ * texmfmp.c: More changes to reduce diffs with W32TeX.
+
+2011-10-04 Peter Breitenlohner <peb@mp.mpg.de>
+
+ * texmfmp.c: More changes to reduce diffs with W32TeX,
+ for compilation with MS Visual Studio 2005.
+
+2011-10-05 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c : remove unused free_shellcmdlist()
+
+2011-10-04 Peter Breitenlohner <peb@mp.mpg.de>
+
+ * texmfmp.c (calledit): More changes to reduce diffs with W32TeX.
+
+2011-10-01 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c: write (sock, buff, n) and send (sock, buff, n, 0)
+ for ipc_snd () are different in winsock.
+
+2011-09-30 Peter Breitenlohner <peb@mp.mpg.de>
+
+ * texmfmp.c [Aleph]: Remove unused variable `eightbitp'.
+
+2011-09-21 Peter Breitenlohner <peb@mp.mpg.de>
+
+ * texmfmp.c [IPC]: More changes to reduce diffs with W32TeX.
+
+2011-09-11 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c: Disable options -translate-file, -default-translate-file,
+ and -8bit for Aleph. The option -kanji-internal=STRING is effective
+ also for pTeX and epTeX.
+
+2011-09-02 Peter Breitenlohner <peb@mp.mpg.de>
+
+ * texmfmp.c: More changes to reduce diffs with W32TeX.
+
+2011-09-01 Peter Breitenlohner <peb@mp.mpg.de>
+
+ * texmfmp.c [WIN32]: Minor rewrite to reduce diffs with W32TeX.
+
+2011-08-30 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c [WIN32]: Remove a semicolon.
+
+2011-08-29 Peter Breitenlohner <peb@mp.mpg.de>
+
+ * texmfmp.c [WIN32]: Allow to build TeX & Co as DLL.
+
+2011-08-23 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c: Remove some (e-)pTeX cruft.
+
+ * openclose.c [PTEX]: No nkf_open() and nkf_close() for WIN32.
+
+2011-08-18 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c: Options for (e-)pTeX and (e-)upTeX.
+
+2011-08-12 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c: Add upTeX and e-upTeX.
+
+2011-08-04 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c: Do not #include empty file <kpathsea/recorder.h>.
+
+2011-08-03 Magnus Granberg <zorry@gentoo.org>
+
+ * texmfmp.c: Use C code for i?86 when -fPIC.
+
+2011-07-04 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c: Drop `#warning SyncTeX: -synctex command line...'.
+
+2011-05-18 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c (ipcpage): Add 'free(cwd)'.
+ (generic_synctex_get_current_name): Use xgetcwd().
+
+2011-05-12 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c: Change arg2 of kpse_absolute_p() from `0' to `false'.
+
+2011-05-11 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c: add a function generic_synctex_get_current_name()
+ in order to get full path names for SyncTeX.
+
+2011-05-04 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c (ipc_open_out): Avoid to #define SOCK_NONBLOCK which
+ conflicts with newer GNU C library headers.
+
+2011-05-04 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * openclose.c (recorder_change_filename): on windows, an opened file
+ cannot be renamed.
+
+2011-05-02 Karl Berry <karl@tug.org>
+
+ * openclose.c (recorder_change_filename): take output_directory
+ into account. Report/patch from
+ Philipp Stephani, 30 Apr 2011 16:11:53,
+ http://tracker.luatex.org/view.php?id=615
+
+2011-04-28 Karl Berry <karl@tug.org>
+
+ * printversion.c (printversionandexit): it is 2011.
+
+2011-04-27 Karl Berry <karl@tug.org>
+
+ * texmfmp.c (initscreen): do not mention mfw, which is no more.
+ Suggestion from Reinhard Kotucha, tex-k mail 21 Jul 2010 11:40:36.
+
+2011-04-19 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ Avoid 'differ in signedness' warnings.
+ texmfmp.c (input_line): Caat input_line2() arg2 to 'char *'.
+
+2011-03-10 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c (calledit): [__MINGW32__] Drop win32_system() and
+ use system() as for all other systems.
+
+2011-03-07 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * setupvar.c (setupboundvariable): `program_invocation_name' has
+ been renamed into `kpse_invocation_name'.
+
+2010-06-10 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ Reorganize web2c headers.
+ * alloca.c, basechsuffix.c, chartostring.c, coredump.c,
+ eofeoln.c, fprintreal.c, input2int.c, inputint.c, main.c,
+ openclose.c, printversion.c, setupvar.c, uexit.c, usage.c,
+ zround.c:
+ #include <w2c/config.h> instead of <config.h> or "config.h".
+ * version.c: #include <w2c/c-auto.h> instead of "c-auto.h".
+
+2010-06-06 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c: include kpathsea/concatn.h if WIN32 is defined.
+
+2010-06-04 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c: include kpathsea/concatn.h and remove cast
+ for concatn ().
+
+2010-05-24 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * texmfmp.c: on win32, all restricted shell escape commands are
+ executed by fullpath.
+
+2010-05-18 Karl Berry <karl@tug.org>
+
+ * printversion.c (printversionandexit): 2010.
+
+2010-05-10 Karl Berry <karl@tug.org>
+
+ * input2int.c (zinput2ints, zinput3ints): don't bother
+ to cast result of fprintf.
+
+2010-04-25 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * lib.h:
+ * texmfmp.c: remove TEXDLL.
+
+2010-04-21 Karl Berry <karl@tug.org>
+
+ * Makefile.am (EXTRA_DIST),
+ * win32main.c: rm per Akira.
+
+2010-04-20 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c, lib.h: Remove luaTeX specific code.
+
+ * lib.h: Move extern declaration of ptexbanner from here
+ to ../pdftexdir/ptexlib.h (instatiated in texmfmp.c).
+
+2010-04-19 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * main.c, texmfmp.c: Remove extern declaration of mainbody,
+ is in lib.h.
+ * openclose.c (recorder_enabled, output_directory): Remove
+ extern declarations, are in lib.h.
+ * lib.h: Move extern declaration of fullnameoffile to here ...
+ * texmfmp.c: ... from here ...
+ * openclose.c: ... and from here.
+ * texmfmp.c [XeTeX]: Move extern declarations of papersize and
+ outputdriver from here to ../xetexdir/XeTeX_ext.h.
+
+ * Makefile.am, openclose.c, printversion.c:
+ Integrate libp.a for pTeX.
+
+2010-04-18 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c (maininit) [__SyncTeX__]: omit warning about no
+ SyncTeX for pTeX.
+
+2010-04-11 Karl Berry <karl@tug.org>
+
+ * texmfmp.c,
+ * printversion.c,
+ * openclose.c,
+ * chartostring.c,
+ * basechsuffix.c: remove useless casts to (string) or (char *),
+ etc. of xmalloc.
+
+2010-03-30 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * openclose.c (open_input): Fixed a typo.
+ From Akira Kakuto <kakuto@fuk.kindai.ac.jp>, 30 Mar 2010 12:33:33.
+
+2010-03-30 Karl Berry <karl@tug.org>
+
+ * (recorder_start): throw in pid in recorder_name so parallel builds
+ have a chance of working. Report from
+ Kirill Smelkov, Debian bug 575731, tex-k mail 29 Mar 2010 06:18:35.
+
+2010-03-19 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * setupvar.c (setupboundvariable): Fix off by one error in msg.
+
+2010-03-05 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c (setupboundvariable): Moved from here ...
+ * setupvar.c (new): ... to here for use in non-engine programs.
+ * lib.h (setupboundvariable): Moved from ../texmfmp.h to here.
+ * Makefile.am (lib_a_SOURCES): Added setupvar.c.
+
+2010-02-24 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c (IPC) [WIN32]: #include <winsock2.h> instead of
+ <sys/socket.h> and <fcntl.h>, use ioctlsocket() instead of
+ fcnt() for non-blocking, and use Sleep() instead of sleep().
+
+2010-02-21 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c: #include <window/mfdisplay.h> instead of externs.
+
+2010-02-20 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c (calledit): Use win32_system() with two args only
+ for MinGW32, native WIN32 uses only one arg.
+ (catch_interrupt) [WIN32]: Declare as static.
+
+2010-02-01 Karl Berry <karl@tug.org>
+
+ * openclose.c (open_input): do not try prepending TEXMFOUTPUT for
+ reading if the filename is absolute.
+
+2010-01-24 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c (mk_shellcmdlist): Declare string param as const.
+
+2010-01-22 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c (maininit) [__SyncTeX__]: omit warning about no
+ SyncTeX for luaTeX.
+ (gettexstring): Declare as static for luaTeX.
+
+2010-01-16 Karl Berry <karl@tug.org>
+
+ * texmfmp.c (do_dump, do_undump): give full name of file
+ in fatal message when something cannot be (un)dumped.
+
+2010-01-02 Karl Berry <karl@tug.org>
+
+ * texmfmp.c (runsystem): doc fix.
+
+2009-12-23 Karl Berry <karl@tug.org>
+
+ * usage.c (usagehelp)
+ * texmfmp.c (BUG_ADDRESS): default to tex-k@tug.org, no @mail.
+
+2009-12-01 Alexander Cherepanov <cherepan@mccme.ru>
+
+ * texmfmp.c (parse_first_line): initialize s to NULL.
+ * usage.c: doc fix.
+
+2009-11-12 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c (shell_cmd_is_allowed): Check for invalid single
+ quote also within quoted arguments.
+ Reported by Akira Kakuto <kakuto@fuk.kindai.ac.jp>,
+ diagnosed by Manuel P\'egouri\'e-Gonnard <mpg@elzevir.fr>.
+
+2009-10-24 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c (openinnameok, openoutnameok): Moved to Kpathsea
+ and renamed kpse_{in,out}_name_ok.
+
+2009-09-06 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c (last_lineno): MAYBE_STATIC for luaTeX.
+ (srcspecialsoption, parse_src_specials_option): static but not
+ used for luaTeX.
+
+2009-09-05 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c (runpopen): Used only for pdfTeX and luaTeX.
+ (last_source_name etc): Not used by MF.
+ (ipcpage): Avoid unconstifying cast.
+ (compare_paths): Declare as static.
+ (mfwin_sw): Constify member string.
+
+2009-09-04 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c (initscreen): Add explicit braces.
+ (getrandomseed, makefullnamestring): ANSI C definition.
+
+2009-08-27 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * lib.h (NOT_WEB2C): New preprocessor macro, if defined prevents
+ declaration of argc, argv, cmdline, and mainbody (from main.c).
+
+2009-08-24 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * openclose.c (open_output): Bugfix? local var 'fname' was
+ shadowed by a second one. Avoid memory leak.
+
+2009-08-22 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * lib.h, texmfmp.c, version.c: Constify ptexbanner and
+ versionstring.
+
+2009-08-21 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ Avoid maximal compiler warnings.
+ * openclose.c (recorder_record_name): Constify string param1.
+ (recorder_record_{name,input,output}): Rename param
+ nameoffile=>name, not to shadow global var.
+
+2009-08-20 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * lib.h (ptexbanner): Add decl for pdfTeX and luaTeX.
+ * texmfmp.c (ptexbanner): Drop decl but keep initializer.
+ * printversion.c (kpathsea_version_string):
+ #include <kpathsea/version.h> and drop extern declaration.
+
+2009-08-17 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c (shell_cmd_is_allowed): Change param1 from 'char **'
+ to 'const char *'.
+ (runsystem, runpopen): Constify string params.
+
+2009-07-24 Martin Schr\"oder <martin@oneiros.de>
+
+ * printversion.c: don't nest extern declarations
+
+2009-06-23 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * basechsuffix.c, chartostring.c, coredump.c, eofeoln.c,
+ fprintreal.c, input2int.c, inputint.c, main.c, openclose.c,
+ printversion.c, texmfmp.c, uexit.c, usage.c, win32main.c,
+ zround.c: drop P?C, P?H, use ANSI C function declarations.
+
+2009-06-10 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * Makefile.am (AM_CFLAGS): enable compiler warnings.
+ * lib.h (new): declarations for *.c from ../cpascal.h.
+ * basechsuffix.c, chartostring.c, eofeoln.c, fprintreal.c,
+ input2int.c, inputint.c, main.c, openclose.c, printversion.c,
+ zround.c: #include "lib.h" to declare function prototypes.
+ * openclose.c: declare internal function recorder_record_name as
+ static; declare param of recorder_record_input and
+ recorder_record_output as const_string as from ../cpascal.h.
+
+2009-06-01 Karl Berry <karl@tug.org>
+
+ * printversion.c (printversionandexit): it's 2009.
+ Also, remove special references to kpathsea author(s) etc.
+
+2009-03-29 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c: remove all references to (Web2C version of) MP.
+
+2009-05-18 Karl Berry <karl@tug.org>
+
+ * openclose.c (recorder_start): use output_directory for the .fls
+ file, if it has been specified with --output-directory.
+ metapost mail from Nicola, 16 May 2009 13:41:36.
+
+2009-03-29 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c: remove all references to Omega, eOmega, and pdfeTeX.
+
+2009-03-28 Karl Berry <karl@tug.org>
+
+ * texmfmp.c (mk_shellcmdlist, shell_cmd_is_allowed): not static,
+ so luatex can access. From Taco.
+
+2009-03-27 Taco Hoekwater <taco@luatex.org>
+
+ * texmfmp.c (parse_options): add #ifndef luaTeX guard for
+ --src-specials, because luaTeX does not implement it.
+ (parse_src_specials_option): add #ifndef luaTeX guard for
+ the same reason.
+
+2009-03-02 Karl Berry <karl@tug.org>
+
+ * texmfmp.c (long_options): make -enable-write18 and -disable-write18
+ synonyms for -shell-escape and -no-shell-escape.
+
+2009-02-26 Karl Berry <karl@tug.org>
+
+ * texmfmp.c: Implementation of restricted shell escapes from Akira.
+ (mk_shellcmdlist, init_shell_escape, char_needs_quote, Isspace,
+ shell_cmd_is_allowed, runsystem, runpopen): new fns.
+ (long_options, parse_cmd_line): new option --shell-restricted.
+ (main): call init_shell_escape.
+ (open_in_or_pipe, open_out_or_pipe): call runpopen.
+
+2009-02-06 Karl Berry <karl@tug.org>
+
+ * texmfmp.c (maininit) [__SyncTeX__]: omit warning about no
+ SyncTeX for Omega and MF/MP.
+
+2008-03-24 Karl Berry <karl@tug.org>
+
+ * printversion.c: it's 2008.
+
+2008-03-16 Karl Berry <karl@tug.org>
+
+ * texmfmp.c (maininit): don't append DUMP_EXT if it's already
+ there. Report from Hans.
+
+2008-03-09 Karl Berry <karl@tug.org>
+
+ * texmfmp.c (maketexstring) [!MP]: only define this fn if !MP,
+ since MetaPost has its own in mpdir/utils.c.
+ (input_line): initialize i = EOF. From Taco.
+
+2008-01-29 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * Makefile.in: Add @configure_input@ line.
+
+2007-12-28 Karl Berry <karl@tug.org>
+
+ * texmfmp.c (parse_options): do not set user_progname at
+ DUMP_OPTION or efmt.
+ (maininit): instead, do it here, after options are read.
+
+2007-09-05 Karl Berry <karl@tug.org>
+
+ * texmfmp.c (long_options): move output-directory output to be
+ enabled for MF and MP too. From Akira.
+
+2007-08-20 Karl Berry <karl@tug.org>
+
+ * texmfmp.c (main) [WIN32]: _setmaxstdio(2048), to increase
+ open files limit. From Akira, 19 Aug 2007 09:30:30 +0900.
+
+2007-07-26 Karl Berry <karl@tug.org>
+
+ * openclose.c (recorder_record_name): fflush the recorder file,
+ since this is for debugging. Suggested by George White.
+
+2006-12-28 Martin Schr\"oder <martin@oneiros.de>
+
+ * texmfmp.c: fixed some warnings raised by gcc for unused variables
+ and different signedness of arguments
+
+2006-07-16 Karl Berry <karl@tug.org>
+
+ * mfmpi386.asm: missing " chars.
+
+2006-07-15 Karl Berry <karl@tug.org>
+
+ * mfmpi386.asm (asm): prepend with .text to avoid seg fault with
+ -g3 or -ggdb3 due to the symbols ending up in the data section.
+ tex-k report by Edward Catmur, 29 Mar 2006 00:09:15 +0100.
+
+2006-06-19 Karl Berry <karl@tug.org>
+
+ * texmfmp.c (open_in_or_pipe) [!pdfTeX && !pdfeTeX]: track
+ fullnameoffile; from Akira and Jonathan.
+
+2005-08-13 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * printversion.c: Update copyright messages.
+
+2005-08-03 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Implement -etex switch.
+
+2005-07-29 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (opennameok): Check all occurrences of ".." in a
+ filename, not just the first. Reported by Yutaka OIWA
+ <y.oiwa@aist.go.jp>.
+
+2005-07-27 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * printversion.c: libkpathsea is covered by the LGPL, not the GPL,
+ and is the common factor that brings in the *GPL to all
+ web2c-based programs.
+
+ * texmfmp.c (get_seconds_and_micros): New function, gets high-res
+ time if possible. Remove references to pdfxtex.
+
+2005-07-22 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * input2int.c: The correct format string to use depends on whether
+ integer is an int or a long int. Reported by M.J. Rutter
+ <mjr19@cus.cam.ac.uk>.
+
+2005-06-26 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * Makefile.in: Replace ac_include with kpse_include. From Peter
+ Breitenlohner.
+
+2005-06-22 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c [MP][BANNER]: Update for MetaPost 0.901.
+
+2005-06-21 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (opennameok,openinnameok,openoutnameok): Add new
+ parameter to opennameok() so its diagnostics are correct wrt to
+ whether we are testing a file name for reading or writing.
+
+2005-04-12 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (getjobname): Add a parameter, the string to return if
+ --jobname wasn't given.
+ This is part of a group of changes that fix pdftex bug 302.
+ http://sarovar.org/tracker/?func=detail&atid=493&aid=302&group_id=106
+
+ * openclose.c (open_input): kpse_find_file() always returns a new
+ string, so we can unconditionally deallocate it.
+
+ * texmfmp.c (maininit): Factor out common code into texmf_yesno().
+ (texmf_yesno): New function, return true if a variable is set and set
+ to 't', 'y', or '1' in texmf.cnf or the environment.
+
+2004-12-20 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c [pdfTeX,pdfeTeX,pdfxTeX]: New variable ptexbanner.
+
+2004-12-19 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c [TeX] (maininit): For all TeX variants, recognize
+ "initex" and "virtex" program names, just in case.
+
+2004-09-16 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * printversion.c (printversionandexit): Hartmut Henkel
+ <hartmut_henkel@gmx.de> noticed that the engines start running
+ like this: "This is TeX, Version 3.141592 (Web2C 7.5.3)" but the
+ -version output looks like this "TeX (Web2C 7.5.3) 3.141592".
+ He supplied a small patch to rectify this.
+
+2004-08-28 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * openclose.c (open_input,open_output): Implement output_directory
+ option.
+
+ * texmfmp.c: Accept -output-directory option.
+
+2004-07-14 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (setupcharset): Remove this fuction. The
+ initialization is performed is done by the engine.
+ (read_char_translation_file): Rename to readtcxfile.
+ (readtcxfile): Some comment changes compared to its previous
+ incarnation.
+
+ * usage.c (usagehelp): Add second argument, email address for bug
+ reports. Requested by the pdftex team.
+
+ * texmfmp.c: Add -output-format to the long_options array.
+ Also add BUG_ADDRESS to the macros defined for each engine.
+ Call usagehelp with BUG_ADDRESS as second argument.
+
+2004-07-03 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (parse_options): Make it so that aleph and omega also
+ parse the -translate-file and -8bit options, even though they now
+ silently ignore them. (They have to ignore them in any case, as
+ neither makes sense for these programs.)
+
+2004-07-02 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c [TeX]: Implement -efmt as alternate spelling for -fmt.
+ This option is only present for backward compatibility, and will
+ go away in the future.
+
+2004-06-29 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * Makefile.in: Don't include alloca.o in the objects. It
+ shouldn't be used anywhere.
+
+2004-06-16 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (get_input_name): Off-by-one errors when
+ erasing/restoring the final quote. From Akira Kakuto
+ <kakuto@fsci.fuk.kindai.ac.jp>.
+
+2004-06-15 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: (normalize_quotes): New function, takes a filename
+ and returns an allocated string with the name quoted iff it
+ contains a space.
+ (get_input_file_name): Factor out normalize_quotes.
+ (getjobname): Add quotes if needed. callmakempx: Add quotes if
+ needed.
+
+2004-06-04 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (get_input_file_name): New function. Get the name of
+ the input file for use by parse_first_line(), and if the filename
+ contains spaces make sure a properly quoted version will be given
+ to TeX.
+ (parse_first_line): Now takes the name of the input file (or NULL) as
+ an argument, instead of looking for it.
+
+2004-05-26 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Remove -oem code.
+
+2004-05-14 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Remove much of the locale-dependent code. Some
+ pieces remain because they are related to the Win32 '-oem' option,
+ where I do not know yet whether that option should go as well.
+
+2004-05-10 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (setupcharset): Fixing a regression. When a line in a
+ TCX file contains two numbers and a comment, set printable=1.
+ Reported by Staszek Wawrykiewicz <staw@gust.org.pl>.
+
+2004-05-08 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (main): We can now put TEXMFENGINENAME into the
+ environment for $engine in all cases.
+
+ * texmfmp.c: Add -halt-on-error option.
+
+2004-05-07 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (maininit): Set $engine appropriately.
+
+ * texmfmp.c: Implement -8bit option.
+
+ * texmfmp.c (makesrcspecial): Always put a space after the line
+ number.
+
+2004-04-16 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (setupcharset): More compact xprn assignment.
+
+2004-03-28 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Implement -no-shell-escape, -no-parse-first-line,
+ -no-file-line-error.
+
+2004-03-25 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c [eTeX](maininit): e-TeX will no longer treat being
+ called as "initex" or "virtex" special.
+ (tcx_get_num): Additional argument, upper bound we're accepting.
+ (read_char_translation_file): Allow for a third integer, 0 or 1, to
+ set printable status. This way you can translate characters
+ without making them printable. However, enforce that 7bit ASCII
+ remains printable.
+
+ * texmfmp.c (maininit): Add sanity check for -enc or -mltex
+ without -ini.
+
+2004-03-24 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * zround.c: Add public domain notice.
+
+ * win32main.c: Add public domain notice.
+
+ * version.c: Add public domain notice.
+
+ * uexit.c: Add public domain notice.
+
+ * printversion.c: Bump 2003 to 2004 in copyright notices.
+
+ * main.c: Add public domain notice.
+
+ * inputint.c: Add public domain notice.
+
+ * input2int.c: Add public domain notice.
+
+ * fprintreal.c: Add public domain notice.
+
+ * eofeoln.c: Add public domain notice.
+
+2004-03-22 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (parse_options): Add -output-format for the pdf*TeX
+ family.
+
+ * texmfmp.c: Changes for Aleph.
+
+ * texmfmp.c (long_options): Enable "enc" option.
+
+2004-03-16 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Allow file:line:error style messages to be enabled
+ from texmf.cnf. From Akira Kakuto <kakuto@fsci.fuk.kindai.ac.jp>.
+
+2004-02-26 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Rename isprintable to xprn.
+
+ * win32main.c: Sync with TeXlive.
+
+ * texmfmp.c: Add -enc option.
+
+ * texmfmp.c: Add support for pdfxTeX.
+
+2003-02-16 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Update banners for TeX 3.141592, MF 2.71828.
+
+2003-02-07 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: e-Omega support.
+
+2003-01-24 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (setupcharset): Do not adapt the isprintable array to
+ the locale.
+
+2003-01-10 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * printversion.c (printversionandexit): Update copyright notice
+ years.
+
+2002-12-14 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Remove some unsused variables.
+
+2002-11-11 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Implement a -parse-first-line option. With the
+ current code it is possible to switch %&-line parsing on from the
+ command line. To switch it off when it is enabled in texmf.cnf
+ requires the use of an environment variable.
+
+2002-10-20 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Add support for -jobname option.
+
+2002-10-06 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (maybe_parse_first_line): Split
+ maybe_parse_first_line: maybe_parse_first_line is called to set
+ parse_first_line_p for TeX, MF, MP, and parse_first_line is called
+ to do the actual parsing.
+
+ * texmfmp.c: Add support for mktexfmt; from Fabrice Popineau.
+
+2002-06-04 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Do not allow texmf.cnf to set the src_specials
+ option.
+
+2002-06-02 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Change handling of source specials so that there is a
+ single flag, src_specials_p, which can be used to see if any
+ source specials are generated.
+
+ * win32main.c: From Fabrice.
+
+2002-04-02 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c [Omega] (ipcpage,gettexstring): Correction of the way
+ the strstartar array is handled. Reported by Akira Kakuto
+ <kakuto@fsci.fuk.kindai.ac.jp>
+
+2001-11-27 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (initscreen): Clarify message generated when an X
+ window cannot be opened.
+
+2001-11-25 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Remove unnecessary casts to (int*). If C++ ->
+ NO_MF_ASM.
+
+ * alloca.c: Changes to allow this file to compile with C++.
+
+2001-11-19 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Changes to keep C++ compilers from choking.
+
+ * openclose.c: Remove double declaration of recorder_name, make
+ prototype of open_input consistent with cpascal.h.
+
+2001-11-18 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * uexit.c: Changes to keep C++ compilers from choking.
+
+ * texmfmp.c: Changes to keep C++ compilers from choking. Changes
+ to support the filename recorder.
+
+ * printversion.c: Changes to keep C++ compilers from choking.
+
+ * openclose.c: Changes to keep C++ compilers from choking.
+ (recorder_start): New function, starts filename recorder.
+ (recorder_change_filename): New function, change the name of the file
+ used by the filename recorder.
+ (open_input,open_output): Record filename, starting recorder if
+ necessary.
+
+ * chartostring.c: Changes to keep C++ compilers from choking.
+
+ * basechsuffix.c: Changes to keep C++ compilers from choking.
+
+2001-11-14 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (getrandomseed): If available use gettimeofday or
+ ftime to obtain a random seed number. These functions have a
+ higher resolution, so fix the problem that subsequent MF or MP
+ runs could have the same seed.
+
+2001-10-30 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Add support for source specials.
+
+ * openclose.c: Add support for file:line:style messages.
+
+2001-10-26 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Implement -tex=program option for mp.
+
+2001-10-24 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * usage.c (usage): Remove first argument, should now only be
+ called on abnormal exit.
+ (usage_help): Print help message, implies a normal exit.
+
+ * texmfmp.c: Modify usage/usage_help invocation.
+
+ * eofeoln.c (readln): New function, read a line and accept CRNL,
+ CR, and NL as end-of-line delimiters.
+
+2001-04-23 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * eofeoln.c (eoln): Accept both CR and LF as end-of-line
+ characters.
+
+2000-08-25 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (setupboundvariable): Add parentheses for clarity, and
+ to silence stupid compilers.
+
+2000-05-03 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (calledit): The first argument should be a pointer to
+ packedASCIIcode. This matters for Omega. From "C.M. Connelly"
+ <c@eskimo.com>.
+
+2000-04-21 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c [WIN32]: Add support for -oem option. From Fabrice.
+
+2000-04-13 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * openclose.c: Disabled the supporting code for remembering the
+ full name while the code for C style error messages and source
+ specials is under review.
+
+2000-04-03 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * openclose.c (open_input): Save full name of found file in
+ full_name_of_file variable. For "C-style" error messages and
+ source-file specials. After Stefan Ulrich
+ <ulrich@cis.uni-muenchen.de> and Fabrice Popineau
+ <Fabrice.Popineau@supelec.fr>.
+
+2000-01-13 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (parse_options): Stop option-processing at the first
+ non-option, so that a command line like 'tex \&sgmlbase
+ -lhtmlbase.tex -ousing.html using.html' feeds the '-lhtmlbase.tex'
+ and '-ousing.html' to the format. Reported by Jonathan Fine
+ <fine@active-tex.demon.co.uk>.
+
+1999-07-12 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (maininit): Add a --default-translate-file option, to
+ facilitate CSTeX. Suggestion (relayed?) by Petr Olsak
+ <olsak@math.feld.cvut.cz>.
+ (input_line): Make sure that catching a SIGINT won't be seen as a EOF
+ on the terminal. Problem noticed by DEK.
+
+1999-06-28 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * openclose.c (open_input): The pdfTeX people asked that the disk
+ not be pounded for .vf files.
+
+1999-05-29 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (opennameok): Allow ./ or its equivalent. Use
+ IS_DIR_SEP rather than comparing against DIR_SEP.
+
+ * openclose.c (open_input): Correct comment.
+
+1999-03-15 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (parse_options): Explicit --progname override the
+ inferred programe of the --fmt option. Suggested by Sebastian.
+ (ztakefraction,ztakescaled,zmakescaled,blankrectangle,paintrow): Add
+ prototypes. From Thomas.
+
+1999-02-14 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: The translate_filename variable is now external. Use
+ kpse_web2c_format to find tcx files.
+
+1999-02-06 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Remove include for kpathsea/config.h because it is
+ superfluous.
+ (calledit): Use P?C macro in definition.
+
+1999-02-04 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (maybe_parse_first_line): Allow both --translate-file
+ and -translate-file in first line.
+
+ * main.c (main): Remove __cdecl, from Fabrice.
+
+1999-01-27 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * zround.c (zround): Add cast to quiet compiler. By Fabrice.
+
+ * usage.c (usage): Use KPSEDLL for kpse_bug_address. By Fabrice.
+
+ * texmfmp.c [WIN32]: include sys/timeb.h.
+ (mainbody): Add TEXDLL to declaration.
+ (maininit): The old main function renamed.
+ (main): A new main function, stripped to the bones.
+ (getrandomseed): Get a random seed from the current time.
+ All after Fabrice.
+
+ * printversion.c (printversionandexit): Add KPSEDLL for
+ kpathsea_version_string, by Fabrice.
+
+ * main.c (main): Add __cdecl, from Fabrice.
+
+1999-01-24 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Support for pdfeTeX. From Thomas Esser.
+
+ * texmfmp.c (maybe_parse_first_line): Default to parsing if
+ maybe_parse_first_line is not defined in texmf.cnf.
+ (opennameok): Add an argument to specify default.
+ (openinok): Default to "a" if no openin_any found.
+ (openoutok): Default to "p" if no openout_any found.
+
+ * mfmpw32.c: Change CRNL to NL line-endings.
+
+1999-01-14 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Further changes and fixes for maybe_parse_first_line.
+ Add openinnameok and openoutnameok, which call opennameok.
+ (opennameok): Change implementation to reflect this.
+
+1999-01-13 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Rename maybe_set_dump_default_from_input to
+ maybe_parse_first_line. Add TCX support in the form of allowing a
+ --translate-file pseudo-option, as proposed by Wlodzimierz Bzyl
+ <matwb@monika.univ.gda.pl>.
+
+ * printversion.c: Correct --version output.
+
+ * Makefile.in: Rename kpathsea.make to kpathsea.mk.
+
+1999-01-10 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Update banners, add MFNOWIN ifdef.
+
+ * printversion.c (printversionandexit): Improve & update message.
+
+ * Makefile.in: Change of ../make/*.make to ../make/*.mk.
+
+1998-12-04 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Replace isblank with ISBLANK, to improve handling of
+ whitespace.
+
+1998-07-26 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (parse_options): Make --progname a no-op after --fmt
+ has been seen. Thus the order of these options no longer matters.
+
+ * texmfmp.c: Rename openoutnameok to opennameok.
+
+Sun May 31 17:27:22 1998 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Add a parse_first_line configuration entry, so the
+ %&format construct can be switched off when desired. Suggested by
+ Denis B Roegel.
+ Add a --debug-format option.
+
+Mon May 4 19:41:22 1998 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * basechsuffix.c (basenamechangesuffix): Replace call of basename
+ with xbasename.
+
+ * texmfmp.c (openoutnameok): Replace call of basename with
+ xbasename.
+
+Tue Mar 10 06:37:51 1998 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c [TeX & IPC] (ipcpage): Remember to set begun to true
+ once we've begun.
+
+Sun Mar 8 18:21:46 1998 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * printversion.c (printversionandexit): Copyright year is 1998.
+
+Tue Feb 10 17:56:36 1998 Olaf Weber <infovore@xs4all.nl>
+
+ * texmfmp.c: Provide the hooks for the epsf server. From Mathias
+ Herberts.
+
+ * eofeoln.c: Prototype eoln. Spotted by Andreas Scherer
+ <Andreas.Scherer@Pobox.Com>
+
+ * fprintreal.c: Prototype fprintreal. Spotted by Andreas Scherer
+ <Andreas.Scherer@Pobox.Com>
+
+Fri Jan 23 15:01:31 1998 Olaf Weber <infovore@xs4all.nl>
+
+ * texmfmp.c: Various patches for Omega from John Plaice.
+ (ipcpage [Omega]): Fix because string handling in Omega differs.
+ (maybe_set_dump_default): Fix to get %& to work in more cases.
+
+Thu Dec 18 20:37:20 1997 Olaf Weber <infovore@xs4all.nl>
+
+ * texmfmp.c: Change spelling of -maketex option to -mktex.
+
+Fri Dec 12 10:22:52 1997 Olaf Weber <infovore@xs4all.nl>
+
+ * openclose.c (open_output): Don't use TEXMFOUTPUT value if it is
+ the empty string.
+
+ * texmfmp.c (openoutnameok): Rewritten to support three levels of
+ permissiveness.
+ (main): Assignment to shellenabledp has been rewritten: we now
+ enable only if certain values are found.
+
+Mon Dec 1 19:05:06 1997 Olaf Weber <infovore@xs4all.nl>
+
+ * texmfmp.c (maybe_set_dump_default_from_input): Reset the program
+ name if the dump_name changes.
+
+ * texmfmp.c [WIN32 && !NO_MF_ASM]: Include "lib/mfmpw32.c" instead
+ of "../win32/mfmpi386.c".
+
+ * texmfmp.c (main, parse_options): Add support for --interaction
+ option.
+
+ * texmfmp.c (main) [eTeX]: Make sure calling e-TeX as initex or
+ virtex works as it should.
+
+Sat Nov 29 13:06:53 1997 Olaf Weber <infovore@xs4all.nl>
+
+ * texmfmp.c (main): We assume "plain" for the dump_name iff the
+ program was called as ini* or vir*. And in the case of ini*, the
+ file name will override this anyway.
+
+ * texmfmp.c (callmakempx): Add xstrdup, because we end up
+ potentially freeing a static string otherwise. From Fabrice
+ Popineau.
+
+Sun Nov 23 19:43:57 1997 Olaf Weber <infovore@xs4all.nl>
+
+ * texmfmp.c (openoutnameok): When we're trying to be safe, add
+ some extra paranoia supplied by Charles Karney <karney@pppl.gov>.
+
+Sat Nov 22 19:26:13 1997 Olaf Weber <infovore@xs4all.nl>
+
+ * texmfmp.c (main): Use kpse_set_program_name and
+ kpse_program_name instead of kpse_set_progname and
+ program_invocation_short_name.
+
+Sat Nov 15 21:27:23 1997 Olaf Weber <infovore@xs4all.nl>
+
+ * texmfmp.c: Various changes to support Omega.
+
+Fri Nov 14 16:43:28 1997 Olaf Weber <infovore@xs4all.nl>
+
+ * texmfmp.c [eTeX,PDFTeX]: Inclusion of header file with
+ appropriate banner.
+
+Fri Oct 24 13:41:56 1997 Olaf Weber <infovore@xs4all.nl>
+
+ * texmfmp.c: Prototypes for the mf_*_{blankrectangle,paintrow}
+ functions.
+
+Mon Oct 20 08:16:40 1997 Olaf Weber <infovore@xs4all.nl>
+
+ * texmfmp.c [WIN32]: Added support for WIN32WIN. Added suppport
+ for redirection of stderr to a logfile. Added support for asm
+ routines. Prototyped mainbody.
+ (setupboudvariable): Don't try to free expansion if it is NULL.
+ From Fabrice Popineau.
+
+ * main.c (main): Prototype mainbody. From Fabrice Popineau.
+
+Sun Oct 19 10:57:43 1997 Olaf Weber <infovore@xs4all.nl>
+
+ * printversion.c (printversionandexit): Removed web2c maintainer's
+ name from version info.
+
+Fri Oct 17 10:33:06 1997 Olaf Weber <infovore@xs4all.nl>
+
+ * texmfmp.c: Correct prototypes for all the varieties of
+ ...initscreen and ...updatescreen. No prototypes for
+ ...blankrectangle and ...paintrow.
+
+ * texmfmp.c (main) [MSDOS, WIN32]: Use case-insensitive comparison
+ for filenames on MS-DOS/MS-Windows.
+ (openoutnameok): When testing for `unix' make sure `MSDOS' is NOT
+ defined since DJGPP defines both.
+ (initscreen): Use "mftalk" for DJGPP as well.
+ From Eli Zaretskii <eliz@is.elta.co.il>.
+
+Thu Oct 16 20:34:25 1997 Olaf Weber <infovore@xs4all.nl>
+
+ * texmfmp.c (parseoptions [TeX], main): Remove everything related
+ to the -extend-jobname option.
+
+Fri Oct 3 11:46:15 1997 Olaf Weber <infovore@xs4all.nl>
+
+ * texmfmp.c: Add prototypes for the mf_trap_* functions. After
+ Fabrice Popineau.
+
+Thu Oct 2 18:07:24 1997 Olaf Weber <infovore@xs4all.nl>
+
+ * texmfmp.c (main): Added locale support. From Bernd Raichle
+ <raichle@informatik.uni-stuttgart.de>.
+
+Tue Sep 30 12:00:13 1997 Olaf Weber <infovore@xs4all.nl>
+
+ * version.c: use version string from c-auto.h.
+
+ * texmfmp.c: Changed return type of main int.
+
+Fri Mar 21 16:38:48 1997 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (struct msg): Do not try to declare the zero-length
+ array, just leave it out.
+ Bug from: jumper@lens.sri.com (Greg Jumper)
+
+Wed Feb 12 08:18:07 1997 Fabrice POPINEAU <popineau@ese-metz.fr>
+
+ * texmfmp.c (catch_interrupt): Win32, differentiate between user
+ interrupt and console closing.
+
+Mon Feb 3 18:01:42 1997 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (parse_options): Check for -1, not EOF,
+ per new getopt.
+
+Mon Jan 27 22:44:29 1997 Ulrik vieth <vieth@thphy.uni-duesseldorf.de>
+
+ * texmfmp.c (BANNER) [MP]: Update to version 0.632.
+
+Sat Jan 18 13:04:34 1997 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c: Update len.
+ From: Gregor Hoffleit <flight@mathi.uni-heidelberg.de>.
+
+Thu Jan 16 14:29:50 1997 Karl Berry <karl@cs.umb.edu>
+
+ * alloca.c: New version from /gd/gnu/lib.
+
+ * texmfmp.c (funny_core_dump): Move to new file.
+ * coredump.c: New file.
+ * Makefile.in (objects): Add coredump.o.
+ This makes it possible for BibTeX to find the function
+ (not that it needs it).
+ From: Richard Walker <Richard.Walker@cs.anu.edu.au>
+
+Sun Jan 5 16:11:12 1997 Karl Berry <karl@cs.umb.edu>
+
+ * printversion.c: It's 1997 now.
+
+Sun Dec 29 17:11:03 1996 Karl Berry <karl@cs.umb.edu>
+
+ * basechsuffix.c (basenamechangesuffix): Filename comparison may
+ be case-insensitive. From Fabrice.
+
+Sat Dec 28 17:37:14 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (ipcpage): Pass the whole DVI filename to the other
+ end of the connection, not just the relative name. (It may have
+ been already started up.)
+
+Sun Dec 15 16:50:25 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c: #if 0-out all the TCX file stuff.
+ Suggested by David Carlisle et al.
+
+Sun Dec 8 16:40:57 1996 Karl Berry <karl@cs.umb.edu>
+
+ * openclose.c (standardinput, standardoutput): Remove these;
+ make them globals in bibtex.ch itself.
+
+ * printversion.c, texmfmp.c, usage.c: WIN32 changes.
+ From Fabrice.
+
+Sat Dec 7 11:10:39 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (topenin): Rewrite to avoid strcat, for Omega.
+ From: John Plaice <plaice@iad.ift.ulaval.ca>.
+
+Fri Dec 6 17:44:45 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (main) [TeX && Omega]: Initialize MakeTeX{OCP,OFM}.
+ * openclose.c (ocptemp): New global.
+ (open_input): Read ahead in ofm and ocp files.
+
+Tue Dec 3 15:15:14 1996 Ulrik Vieth <vieth@thphy.uni-duesseldorf.de>
+
+ * Makefile.in: Remove spurious targets for wsun.c and wx11.c.
+
+Tue Dec 3 15:15:14 1996 Ulrik Vieth <vieth@thphy.uni-duesseldorf.de>
+
+ * texmfmp.c (long_options): mpost -T or -troff doesn't take an
+ optional argument.
+
+ * Makefile.in: Remove spurious targets for wsun.c and wx11.c.
+
+Wed Nov 27 10:02:21 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (NO_MF_ASM) [__sun__]: Define; our assembler code
+ doesn't work with the Solaris/x86 assembler.
+ * mfmpi386.asm: Doc fix.
+
+Sat Nov 23 14:42:53 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (openoutok): Allow .tex as a special case.
+
+Fri Nov 15 16:15:32 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (openoutnameok): Do not free the result of basename;
+ it's never dynamically allocated anyway.
+
+Sun Nov 10 16:37:19 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c: Check for inimpost and virmpost instead of
+ inimp and virmp.
+
+Mon Oct 14 17:27:34 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (DUMP_EXT) [DOS]: Only truncate to .bas if DOS,
+ not DOSISH; WinNT/Win95 support long filenames (at long last).
+ (initscreen) [WIN32]: Use mftalk a la OS2.
+ (get_date_and_time): Include parameter in old_handler decl.
+
+Mon Oct 7 12:49:38 1996 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in (objects): Include printversion.o.
+ * printversion.c: New file.
+
+ * texmfmp.c: Oops, iniversion doesn't it, it's global.
+ (parse_options): Call printversionandexit.
+
+Sun Oct 6 10:17:00 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (main): Initialize iniversion and virversion.
+
+Sat Sep 7 16:14:41 1996 Karl Berry <karl@cs.umb.edu>
+
+ * usage.c: Include the bug reporting address.
+
+Sun Aug 4 15:48:03 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (parse_options): Print the Kpathsea version string, too.
+ * version.c: Do `Web2c VERSION' instead of `C version VERSION'.
+
+Fri Jul 26 15:47:29 1996 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in: Remove co.make.
+
+Sat Jun 1 13:17:09 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (openoutnameok): Change #ifdef to TeX || MP.
+
+Fri May 24 11:38:59 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (main): Initialize extend_jobname.
+ (parse_options) [TeX]: New option -extend-jobname.
+
+Sun Apr 28 15:13:22 1996 Karl Berry <karl@cs.umb.edu>
+
+ * mfmpi386.asm [ASM_NEEDS_UNDERSCORE]: #ifdef labels on new
+ configure condition.
+ From: Peter Breitenlohner <peb@MPPMU.MPG.DE>.
+
+Tue Apr 23 08:26:11 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (callmakempx): Always pass -troff, even if we got the
+ command name from texmf.cnf.
+
+Sun Apr 21 16:59:44 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (parse_options): New options -maketex and -no-maketex
+ for TeX and MF.
+
+Sat Apr 20 17:55:37 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c [IPC_DEBUG]: Text changes.
+
+Fri Mar 22 15:30:45 1996 Karl Berry <karl@cs.umb.edu>
+
+ * Remove GPL from these files; Web2c proper can stay p.d.
+
+Sun Mar 10 16:12:14 1996 Karl Berry <karl@cs.umb.edu>
+
+ * openclose.c: Oops, forgot to #include variable.h.
+
+Fri Mar 8 16:00:20 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (init_maketex): Remove this; we will do it in Kpathsea
+ instead now, in the format initialization tex-file.c.
+
+ * openclose.c (open_output): Look for TEXMFOUTPUT in texmf.cnf.
+
+Wed Feb 21 11:45:02 1996 Karl Berry <karl@cs.umb.edu>
+
+ * openclose.c: Don't abort if the TFM file is empty.
+
+Sat Feb 17 15:22:52 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (openoutnameok): New function.
+
+Fri Feb 16 17:51:53 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (long_options) [NONASCII]: Include --translate
+ conditionally. (Really should change the help message, too.)
+
+Sat Feb 10 15:22:59 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (parse_options): Make DUMP_OPTION also set the user
+ progname, since -progname sets the dump name.
+
+Fri Dec 29 17:16:42 1995 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in: misc.make is now clean.make.
+
+Sun Dec 17 15:09:44 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (long_options): New option --debug-format, suggested
+ by David Carlisle.
+
+Sun Dec 10 16:13:46 1995 Karl Berry <karl@cs.umb.edu>
+
+ * mfmpi386.asm: Remove _'s. From Wayne.
+
+ * texmfmp.c (PROGRAM_VERSION) [MP]: Now at 0.631.
+ [TeX] No asm stuff. From Gregor Hoffleit, et al.
+
+Sun Nov 26 13:39:00 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (main): Enable mltex extensions if --mltex option or
+ the program name is mltex.
+
+Fri Nov 17 14:35:45 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (-program): New option for TeX, MF, MP. Suggested by Bernd.
+
+Thu Nov 16 16:20:03 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (argv, argc): Do not define as static, as we declare
+ them extern in cpascal.h. From Andreas Scherer.
+
+Sun Nov 12 16:32:27 1995 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in (sysopt_o): Remove this stuff. From Wayne.
+ * texmfmp.c [i386 && GNUC && !NO_MF_ASM]: #include mfmpi386.asm
+ instead of using the C code.
+
+ * texmfmp.c: Disable shell escapes by default.
+
+Fri Oct 6 16:23:03 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (maybe_set_dump_default_from_input): Make %&ini set
+ iniversion. Suggested by Wayne.
+
+Mon Oct 2 15:48:21 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (init_maketex): Really disable if the value is zero.
+
+Sat Sep 30 16:02:56 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (main) [TeX]: Look up the `noshell' config variable.
+ (parse_options): No options -noshell and -output-comment.
+
+Sat Sep 23 15:04:54 1995 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in (objects): Remove strtol.o, this is in kpathsea now.
+
+Fri Sep 22 15:51:13 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (init_maketex): New routine.
+ (main): Call it, instead of repeating the weird code.
+
+Mon Sep 4 17:16:06 1995 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in (objects): Remove xopenfile.o.
+ * xopenfile.c: Move to kpathsea.
+
+Thu Aug 31 13:35:47 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c [!MF_ASM_FRACTION] (takefraction, ...): Conditionalize
+ the floating-point definitions on this, too.
+ * Makefile.in (optx86.o): New target.
+ * optx86.s: New file.
+
+Tue Aug 22 14:11:27 1995 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in: Include rdepend.make, instead of repeating the code.
+
+Mon Jul 31 17:46:31 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (setupboundvariable): Call kpse_var_value, so we don't
+ have to pass in the $. Similarly everywhere else.
+
+Sat Jul 29 19:26:33 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (callmakempx): Rewrite to pass -troff flag, instead of
+ invoking troff script. And use new kpse_var_value.
+
+Fri Jul 28 11:10:26 1995 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in (depend): Comment out this target in the
+ distribution, it doesn't work when $srcdir != build-dir.
+
+ * texmfmp.c (callmakempx): Don't call anything if the command is
+ `none'.
+
+Tue Jul 25 13:39:04 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (callmakempx): Free the variable expansion.
+
+Mon Jul 24 11:48:35 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (callmakempx): New fn.
+
+Sun Jul 23 11:39:51 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (edit_value): Remove this #define.
+ (calledit): Call kpse_var_expand for TEXEDIT et al., instead of
+ just getenv.
+ (ztakefraction, zmakefraction, ztakescaled, zmakescaled): Include
+ Hobby's C code from mpmath.c.
+
+Sat Jul 22 14:20:38 1995 Karl Berry <karl@cs.umb.edu>
+
+ * openclose.c (open_input) [FUNNY_CORE_DUMP]: Recognize
+ HackyInput... for MetaPost. Doc fixes.
+
+ * texmf.c: Rename to texmfmp.c for MetaPost support.
+ (long_options) [MP]: Add -T and -troff.
+
+Thu Jul 20 13:40:39 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmf.c (setupboundvariable) [TeX]: Remove conditional, since MF
+ sets a couple simple variables dynamically now.
+ (initscreen): Get MFTERM from texmf.cnf file if it's there,
+ instead of just calling getenv.
+
+Tue Jul 18 13:40:25 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmf.c (initscreen): Give warning if they're using X, but there
+ is no X support.
+
+Mon Jul 17 13:10:37 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmf.c (NO_FMTBASE_SHARE): Rename to NO_DUMP_SHARE.
+ [MF]: Declare return types for window routines.
+ Also, move trap support to another file, window/trap.c.
+
+Sun Jul 16 14:35:33 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmf.c (main): Rewrite enabling of MakeTeX* to match new
+ configure stuff.
+
+Sat Jul 15 16:05:37 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmf.c: Doc fix.
+
+Fri Jul 14 14:31:57 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmf.c (read_char_translation_file): Compute `charssavedbycharset'.
+ (setupcharset): Do not allow dynamic translation in initex.
+
+Thu Jul 13 14:05:24 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmf.c (setupcharset, read_char_translation_file,
+ tcx_get_num): New functions to implement dynamic char translations.
+ (parse_options): Add -translate-file option.
+
+Sun Jul 9 15:28:09 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmf.c (maybe_set_dump_default_from_input): Don't index
+ argv[optind] if optind is >= argc.
+
+Tue Jul 4 16:58:54 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmf.c (maybe_set_dump_default_from_input): Finish implementing
+ this (%&FNAME on first line => use FNAME for dump file).
+
+Thu Jun 29 17:50:38 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmf.c (parse_options) [TeX && IPC]: Concatenate TEX_IPC_HELP
+ to the help string.
+
+ * openclose.c (open_input): Detect nonexistent files correctly again.
+
+Wed Jun 21 15:54:45 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmf.c (parse_options): Add --fmt (TeX) and --base (MF).
+ (DUMP_OPTION): #ifdef'd #define to determine which.
+
+Mon Jun 19 20:09:34 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmf.c: Add IPC support.
+ From: Shamim Mohamed <shamim@howland.isu.edu>
+ From: Tomas G. Rokicki <rokicki@CS.Stanford.EDU>
+
+Sat Jun 10 16:06:06 1995 Karl Berry <karl@cs.umb.edu>
+
+ * openclose.c: Doc fix.
+
+Fri Jun 9 19:36:12 1995 Karl Berry <karl@cs.umb.edu>
+
+ * main.c, texmf.c (main) [__EMX__]: Add _wildcard and _response calls.
+ * texmf.c: Add mftalk support.
+ (funny_core_dump, catch_interrupt) [__EMX__]: OS2 support.
+ From: rs@purple.in-ulm.de (Ralph Schleicher).
+
+Sun Jun 4 10:30:36 1995 Karl Berry <karl@cs.umb.edu>
+
+ * eofeoln.c (eof): Return true if the file doesn't exist.
+
+ * texmf.c: Add support for AMIGAWIN. From Andreas Scherer.
+
+ * alloca.c (NULL, xmalloc): Do not define these here, they're
+ (indirectly) in config.h. From Andreas Scherer.
+
+ * texmf.c (setupboundvariable): Don't complain about 0 in the cnf
+ file if the default is also 0.
+
+Sat Jun 3 11:54:28 1995 Karl Berry <karl@cs.umb.edu>
+
+ * xopenfile.c: Include the program name in the error message.
+
+ * texmf.c (setupboundvariable): If the variable is unset in
+ texmf.cnf, the expansion is the empty string, not NULL. Also, free
+ the expansion.
+
+Fri Jun 2 13:41:41 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmf.c (DUMP_EXT) [DOSISH]: Must be `.bas'. From Wayne.
+ (input_line): Cast buf_size in printf to avoid warning.
+ (setupboundvariable): New routine for lookup of dynamic bounds.
+
+Sun May 28 17:41:49 1995 Karl Berry <karl@cs.umb.edu>
+
+ * zround.c: Compare against TeX's boundary integers (as floating
+ point constants), instead of INTEGER_{MIN,MAX}.
+
+Fri May 26 17:47:47 1995 Karl Berry <karl@cs.umb.edu>
+
+ * strtol.c: New file, from textutils.
+ * Makefile.in (objects): Add strtol.o.
+
+Wed May 24 17:07:39 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmf.c (parse_options): New routine for TeX & MF.
+ (PROGRAM_VERSION, PROGRAM_HELP): Define these.
+ (main): Call it.
+
+Sat May 20 17:28:51 1995 Karl Berry <karl@cs.umb.edu>
+
+ * xopenfile.c: Do perror if we had a full filename to try.
+
+ * basechsuffix.c: Take old suffix, and only do the change if the
+ old suffix matches.
+
+ * usage.c (usage): If bad status, construct the --help message.
+
+Tue May 9 15:46:25 1995 Karl Berry <karl@cs.umb.edu>
+
+ * usage.c: Doc fix.
+
+Sat May 6 11:23:23 1995 Karl Berry <karl@cs.umb.edu>
+
+ * usage.c: New file.
+ * Makefile.in (objects): Add it.
+
+Tue Apr 25 14:02:10 1995 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in (library): Set to lib instead of lib.a, to match the
+ other Makefile conventions.
+
+Sun Apr 23 10:54:35 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmf.c: Have to include {tex,mf}d.h before #ifdef TeX, so do it
+ from the Makefile.
+
+Sat Apr 22 10:26:10 1995 Karl Berry <karl@cs.umb.edu>
+
+ * main.c (main): Call mainbody, not main_body.
+
+ * openclose.c (aclose): Don't complain if the file is already closed.
+ (texinputtype): Define this.
+
+ * texmf.c (main): Do program_name stuff unconditionally, not just
+ in vir*, and rewrite it to use program_invocation_short_name.
+
+Fri Apr 21 11:39:14 1995 Karl Berry <karl@cs.umb.edu>
+
+ * main.c: Doc fix.
+
+ * input2int.c: Split off from inputint.c.
+
+Sun Apr 16 11:47:37 1995 Karl Berry <karl@cs.umb.edu>
+
+ * openclose.c (open_input, open_output): Retrieve and store the
+ filename from name_of_file + 1, not name_of_file, to avoid extra
+ hassles in the change files.
+
+Fri Apr 14 15:28:47 1995 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in (objects): Include openclose.o.
+ * openclose.c: New file, from openinout.c.
+
+Tue Feb 21 13:51:58 1995 Karl Berry <karl@cs.umb.edu>
+
+ * xopenfile.c: Have to take another arg, the original name.
+
+Mon Feb 20 17:18:59 1995 Karl Berry <karl@cs.umb.edu>
+
+ * xopenfile.c: New file.
+ * Makefile.in (objects): Add it, and remove xfopen-pas.o.
+
+Sun Feb 5 15:33:29 1995 Karl Berry <karl@cs.umb.edu>
+
+ * basechsuffix.c: New file.
+ * Makefile.in (objects): Add it.
+
+Tue Jan 10 13:20:47 1995 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in (objects): Remove strpascal.o (no longer needed) and
+ getopt.o (in kpathsea).
+
+Sun Dec 18 16:38:03 1994 Karl Berry <karl@cs.umb.edu>
+
+ * strpascal.c (errprintpascalstring, etc.): Don't need these any more?
+
+Sat Dec 17 13:42:03 1994 Karl Berry <karl@cs.umb.edu>
+
+ * mksuffixchar.c: This was short-lived.
+ * chartostring.c: This replaces it.
+ * Makefile.in (objects): Ditto. Also remove ourpaths.o.
+
+Mon Nov 14 15:13:50 1994 Karl Berry <karl@cs.umb.edu>
+
+ * mksuffixchar.c: New file.
+ * Makefile.in (objects): Add it.
+
+Sun Nov 13 16:43:40 1994 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in (objects): Add w*.o.
+ (wsun.c, wx11.c): Add links for these.
+
+Fri Oct 28 11:14:08 1994 Karl Berry <karl@cs.umb.edu>
+
+ * strpascal.c (extendfilename): Remove this.
+
+Thu Oct 27 17:59:07 1994 Karl Berry <karl@cs.umb.edu>
+
+ * main.c (argv): Return a regular C string, instead of a Pascal string.
+
+Fri May 27 09:50:14 1994 Karl Berry (karl@cs.umb.edu)
+
+ * texmf.c (main): Don't look for USE_MAKETEX*.
+
+ * c-auto.h.top, texmf.c (NO_FMTBASE_SHARE): Rename from
+ NO_FMTBASE_SWAP.
+
+Thu May 26 20:37:24 1994 Karl Berry (karl@cs.umb.edu)
+
+ * c-auto.h.top: Why did I take out the #ifndef's? Put them back.
+
+Tue May 24 14:43:12 1994 Karl Berry (karl@cs.umb.edu)
+
+ * texmf.c (funny_core_dump): No need to declare, since we define
+ it later in this file.
+
+Mon Apr 18 17:31:59 1994 Karl Berry (karl@ra.cs.umb.edu)
+
+ * c-auto.h.top: Rename from c-auto.h.in for autoheader convention,
+ and don't #ifndef the #undef's.
+ * Makefile.in: autoheader/autoconf changes.
+
+Thu Feb 24 11:00:53 1994 Karl Berry (karl@cs.umb.edu)
+
+ * ourpaths.c: Include tex-file.h instead of init-path.h.
+
+Mon Feb 21 14:29:52 1994 Karl Berry (karl@cs.umb.edu)
+
+ * Makefile.in: srcdir changes from simon.
+
+ * gftodmem.h: Move here from fontutil, to simplify srcdir stuff.
+
+Wed Feb 2 11:00:47 1994 Karl Berry (karl@cs.umb.edu)
+
+ * Version 6.1.
+
+Tue Feb 1 11:25:44 1994 Karl Berry (karl@cs.umb.edu)
+
+ * Makefile.in (c-auto.h.in): New target.
+
+ * common.defines (rh): Declare as a field, for TeX--Xet.
+
+Mon Jan 24 07:33:49 1994 Karl Berry (karl@cs.umb.edu)
+
+ * Version 6.0.
+
+Thu Jan 20 14:22:07 1994 Karl Berry (karl@cs.umb.edu)
+
+ * c-auto.h.in: Doc fix.
+
+ * MakeTeX{TFM,MF}: Include these as samples, from
+ pnoma@wk.estec.esa.nl.
+
+Fri Dec 24 13:48:46 1993 Karl Berry (karl@cs.umb.edu)
+
+ * getopt.c (_NO_PROTO): Define before including config.h.
+
+Tue Dec 7 10:23:59 1993 Karl Berry (karl@cs.umb.edu)
+
+ * Makefile.in (objs): Ah, flexfatal is in the library now.
+
+Sun Dec 5 15:23:47 1993 Karl Berry (karl@cs.umb.edu)
+
+ * ourpaths.c (setpaths): Remove the KPSE_MAKE_* enables, this file
+ is not compiled in the tex/mf/bibtex directories.
+ * texmf.c (main): Set them here.
+
+ * c-auto.h.in (XVIEWWIN): Remove this, as x11-Xt should work
+ with OpenWindows. (But leave it in configure, just for old-times'
+ sake.)
+
+Sat Dec 4 11:29:57 1993 Karl Berry (karl@cs.umb.edu)
+
+ * flexfatal.c: New file.
+ * Makefile.in (flexfatal.o): New target.
+ (objs): Include it.
+
+ * texmf.h (NO_DEBUG) [!TEXMF_DEBUG]: Define this.
+
+ * openinout.c (make_tex_file): Pass address of nameoffile, as required.
+
+Sun Nov 14 02:30:34 1993 Karl Berry (karl@cs.umb.edu)
+
+ * version.c (VERSION_STRING) [!VERSION_STRING]: Define and protect.
+
+Fri Nov 12 19:38:26 1993 Karl Berry (karl@cs.umb.edu)
+
+ * cpascal.h (reset, rewrite): Use FOPEN_[RW]BIN_MODE instead of
+ "r" and "w". Still not 100% right, but at least something of an
+ improvement.
+
+Sun Nov 7 14:17:24 1993 Karl Berry (karl@cs.umb.edu)
+
+ * Makefile.in (.c.o): Use $< instead of $*.c; maybe it will help
+ with $(srcdir) stuff?
+
+ * texmf.c (input_line): Trim trailing spaces, tabs, and \r's.
+
+ * lib.h: Remove, this is in Kpathsea now.
+
+ * config.h (INTEGER_TYPE) [LONG_64_BITS && !NO_FMTBASE_SWAP]:
+ Define as int in this case.
+ (INTEGER_MAX,INTEGER_MIN): Define these as well.
+ * zround.c (zround): Use INTEGER_{MAX,MIN}.
+ From raichle@informatik.uni-stuttgart.de.
+
+Sat Nov 6 13:21:11 1993 Karl Berry (karl@cs.umb.edu)
+
+ * c-auto.h.in (NEXTWIN, REGISWIN): #undef by default.
+ * texmf.c (mfwin_sw): Add cases for regis and next.
+ (mf_{next,regis}_*) [NEXT,REGISWIN]: Declare.
+
+Tue Oct 12 14:03:23 1993 Karl Berry (karl@cs.umb.edu)
+
+ * openinout.c (open_input): Allow HackyCoreDump's for MF, too.
+
+ * ourpaths.c (testreadaccess): Update fontmap stuff, use it for GF
+ and PK as well as TFM.
+
+ * texmf.c: Doc fix.
+
+ * common.defines (cinttype): Declare.
+ * cpascal.h (cinttype): Define.
+
+Sun Oct 10 16:17:48 1993 Karl Berry (karl@cs.umb.edu)
+
+ * ourpaths.c: Rewrite for new kpathsea facilities.
+
+Sun Oct 3 13:49:40 1993 Karl Berry (karl@cs.umb.edu)
+
+ * ourpaths.c: kpathsea/pathsrch.h has been renamed to pathsearch.h.
+
+ * config.h [ibm032]: Remove all this stuff; I don't think it's
+ needed any longer.
+
+ * Makefile.in (*clean): Include standard targets.
+
+Mon Jun 7 08:29:45 1993 Karl Berry (karl@cs.umb.edu)
+
+ * cpascal.h (addressofint): Do not cast to int first.
+
+Mon May 31 09:40:00 1993 Karl Berry (karl@cs.umb.edu)
+
+ * config.h (EXIT_SUCCESS): Move to c-std.h.
+
+Tue May 25 14:37:16 1993 Karl Berry (karl@cs.umb.edu)
+
+ * config.h (EXIT_SUCCESS): Rename from EXIT_SUCCESS_CODE.
+ Change callers in various files.
+
+Fri May 21 11:56:02 1993 Karl Berry (karl@cs.umb.edu)
+
+ * texmf.c (paintrow): Put args in the printf for paintrow.
+
+ * texmf.c (custom_default) [INI]: Declare conditionally, since
+ it's used conditionally.
+ (main): Declare as void.
+
+ * openinout.c (open_input): Rename IS_PATH_SEP to IS_DIR_SEP.
+
+ * alloca.c: Replace with version from gcc 2.4.0.
+
+ * config.h (testreadaccess): Declare.
+
+ * xfopen-pas.c: Remove unused variable `cp'.
+
+ * main.c (main): Return 0 instead of using uexit.
+
+Tue May 18 13:43:07 1993 Karl Berry (karl@cs.umb.edu)
+
+ * texmf.c (do_undump) [VMS]: Remove this. barabash says it works ok.
+
+Thu May 13 16:53:47 1993 Karl Berry (karl@cs.umb.edu)
+
+ * getopt.c (my_index): Return const char *, and change callers.
+
+ * Not quite all of Bill's changes below have been merged (not the
+ new descrip.mms or convert.com files, in particular), but just to
+ get the gist, I'll include the whole log.
+
+Wed Mar 24 12:28:25 1993 Bill Barabash (barabash@ops5.lmo.dec.com)
+
+ * c-auto.h : It's too complicated to convert the big hairy config
+ shell script; I just created a VMS-acceptable c-auto.h manually.
+
+ * c-std.h : Declare VMS's unix-compatibillity routines by including
+ <unixlib.h> and <unixio.h>; don't declare popen() on VMS.
+
+ * common.h : Declare EXIT_SUCCESS_CODE to be 1 on VMS, 0 elsewhere.
+ Throw away the VMS system library's getname() declaration, it steps
+ on a WEB procedure and is not needed. Declare routines eof(),
+ testreadaccess(), zinput2ints(), extendfilename(), and uexit().
+
+ * convert.com : VMS command procedure based on the shell script
+ "convert" (new file).
+
+ * descrip.mms : VMS equivalent of makefile (new file).
+
+ * dirio.h : Don't declare xopendir and xclosedir on VMS.
+
+ * getopt.h : Make my_index accept and return a const character
+ pointer. Have it return NULL instead of 0 when necessary.
+
+ * main.c : Add function prototype for main_body().
+
+ * openinout.c, pascal.h, c-auto.h : For BibTeX, use stdin and stdout
+ on VMS (standardinput and standardoutput become macros).
+
+ * pascal.h : On VMS use system-defined abs() and fabs().
+
+ * paths.h : Hand-coded for VMS.
+
+ * pathsrch.c : On VMS, don't compile routine expand_subdir(), and
+ look in current directory for input file if path searching fails.
+ Routine absolute_p() can now deal with VMS directory specifications.
+
+ * texmf.c : Declare argc so that it links cleanly. Add an unused
+ formal parameter to catch_interrupt so that it can be passed to
+ signal without the compiler complaining. Cast argument to time()
+ as a (time_t *) rather than as a (long *). Get rid of the VMS
+ undump code contributed by joe%ril3.decnet@hydra.tamri.com -- it
+ causes the TRAP test to fail.
+
+ * texmf.h : Add function prototypes for routines in texmf.c and
+ openinout.c.
+
+Thu May 13 14:43:42 1993 Karl Berry (karl@cs.umb.edu)
+
+ * cpascal.h (fabs) [fabs]: Undefine if it's already defined.
+
+Sun May 9 09:53:05 1993 Karl Berry (karl@cs.umb.edu)
+
+ * convert: Redirect error echo to stderr; exit 0 if no error.
+
+ * config.h: Changes for kpathsea. Toss volatile defn.
+
+ * Makefile.in (objs): Remove kpathsea files.
+
+Fri Apr 30 15:06:29 1993 Karl Berry (karl@cs.umb.edu)
+
+ * openinout.c (make_tex_file): Free cmd.
+
+Fri Apr 16 19:42:15 1993 Karl Berry (karl@cs.umb.edu)
+
+ * find-suffix.c: Declare arg and return string const.
+ * lib.h (find_suffix): Change decl.
+
+ * c-pathch.h (IS_PATH_SEP) [DOS & otherwise]: New defn.
+ * pathsrch.c, openinout.c, find-suffix.c: Consequent changes.
+
+Mon Apr 12 06:14:42 1993 Karl Berry (karl@cs.umb.edu)
+
+ * Makefile.in (clean): Remove core here.
+
+Sat Apr 10 15:20:25 1993 Karl Berry (karl@cs.umb.edu)
+
+ * openinout.c (make_tex_file): Throw away all output.
+
+ * texmf.c (swap_items): Add case for 16-byte items.
+ (From james@miller.cs.uwm.edu.)
+
+ * texmf.c (get_date_and_time): Cast arg to time_t *, not long *.
+ (From james@miller.cs.uwm.edu.)
+
+ * texmf.c (get_date_and_time) [SA_INTERRUPT]: Add code for SunOS
+ 4.1, from ken@cs.toronto.edu.
+
+ * pathsrch.c (expand_subdir) [UNIX_ST_NLINK]: Don't check st_link
+ if we don't have Unix semantics.
+ * c-auto.h.in (UNIX_ST_NLINK): Define if not DOS or VMS or VMCMS.
+ (Suggested by buers@dg1.chemie.uni-konstanz.de.)
+
+ * texmf.c (catch_interrupt): Declare a(n unused) parameter `arg'
+ (from beebe).
+ (get_date_and_time): Don't do assignment in if condition.
+
+Fri Apr 9 16:10:06 1993 Karl Berry (karl@cs.umb.edu)
+
+ * xrealloc.c (xrealloc): Don't print old_ptr.
+
+ * c-std.h (stddef.h): Don't include.
+
+ * openinout.c (make_tex_file): cmd is a string, not a character.
+
+Mon Mar 29 08:33:51 1993 Karl Berry (karl@cs.umb.edu)
+
+ * cpascal.h (abs) [abs]: Undef.
+
+Sat Mar 13 10:22:54 1993 Karl Berry (karl@cs.umb.edu)
+
+ * Makefile.in (CPPFLAGS): Add @DEFS@, for -DHAVE_CONFIG_H.
+
+ * texmf.h: Include cpascal.h instead of config.h.
+
+ * common.h: Merge into config.h and remove.
+
+ * common.h (pascal.h): Don't include this.
+ * cpascal.h: Rename from pascal.h.
+
+ * convert: Exit with bad status if the pipeline failed; use
+ cpascal.h instead of config.h.
+
+ * openinout.c (make_tex_file): Call xmalloc instead of declaring
+ an array; put quotes around the arg of sh -c.
+
+Sun Feb 28 11:10:48 1993 Karl Berry (karl@cs.umb.edu)
+
+ * c-auto.h.in (MAKE_TEX_*): Replace single NO_MAKETEX with
+ individual symbols.
+
+ * openinout.c (maketex*) [MAKE_TEX*]: Make them individually
+ selectable.
+
+Sun Feb 21 08:28:06 1993 Karl Berry (karl@cs.umb.edu)
+
+ * Version 5.851d.
+
+ * common.defines (maketexmf): New defn.
+
+ * Makefile.in (.c.o): Put $(CFLAGS) after $(CPPFLAGS).
+
+ * openinout.c: Include c-namemx.h.
+
+Tue Feb 16 17:53:54 1993 Karl Berry (karl@cs.umb.edu)
+
+ * Makefile.in (install-exec, install-data): New targets.
+
+Mon Feb 15 10:19:02 1993 Karl Berry (karl@cs.umb.edu)
+
+ * c-auto.h.in (NO_MAKETEX): New #define for installers.
+
+ * openinout.c (maketex*): New routines, rewrite from yesterday.
+
+ * common.defines (maketextex): Define.
+
+Sun Feb 14 11:54:30 1993 Karl Berry (karl@cs.umb.edu)
+
+ * openinout.c (open_input) [BibTeX]: Only do NO_FILE_PATH stuff if
+ we are BibTeX; declare tfmtemp only when we need it, instead of at
+ the outer level; add support for MakeTeX{TeX,MF,TFM}.
+
+Fri Feb 12 07:33:49 1993 Karl Berry (karl@cs.umb.edu)
+
+ * c-auto.h.in (const): Add defn for Autoconf to use.
+
+ * paths.h.in (TEXFORMATS): Only define once.
+
+Sat Jan 30 09:46:04 1993 Karl Berry (karl@cs.umb.edu)
+
+ * fontmap.c (map_lookup): Only extend the filename if we have one.
+
+Tue Jan 26 16:07:21 1993 Karl Berry (karl@cs.umb.edu)
+
+ * version.c: New file to define web2c version.
+ * common.h (versionstring): Declare it here.
+ * common.defines (versionstring): And here.
+ * Makefile.in (objs): Add it.
+
+ * c-auto.h.in (X11WIN) [XVIEWWIN]: Undefine.
+
+Mon Jan 25 12:04:28 1993 Karl Berry (karl@cs.umb.edu)
+
+ * ourpaths.c (testreadaccess.c): Don't free `found' after copying,
+ as it might not be malloc-ed.
+
+Sun Jan 24 11:04:37 1993 Karl Berry (karl@cs.umb.edu)
+
+ * lib.h (FATAL*, WARNING*): Use `str' instead of `s' for macro formals.
+
+ * xcalloc.c: Remove prototypes.
+ * remove-suffx.c, line.c, fontmap.c: Cast *alloc calls to avoid
+ silly warnings.
+
+ * texmf.c (swap_items): Rewrite as four while loops, since `size'
+ is invariant. (From Tom.)
+
+Sat Jan 23 10:13:51 1993 Karl Berry (karl@cs.umb.edu)
+
+ * remove-suffx.c: New file.
+
+Thu Jan 21 11:21:14 1993 Karl Berry (karl@cs.umb.edu)
+
+ * Makefile.in (objs5): New variable.
+ ($(lib)): Include it in the archive.
+
+ * extend-fname.c, find-suffix.c, xfopen.c, fontmap.[ch]: New files.
+
+ * ourpaths.c, fontmap.[ch]: Implement a mapping file.
+
+Sat Jan 16 08:36:36 1993 Karl Berry (karl@cs.umb.edu)
+
+ * c-auto.h.in, paths.h.in: Doc fix.
+
+Sun Jan 3 13:27:37 1993 Karl Berry (karl@cs.umb.edu)
+
+ * config.h: Move some includes to c-std.h.
+
+ * xcalloc.c: New file.
+ * Makefile.in (objs): Add it.
+
+ * Makefile.in (distclean): Remove Makefile; depend on clean.
+
+Fri Jan 1 14:17:37 1993 Karl Berry (karl@cs.umb.edu)
+
+ * c-auto.h.in, c-memstr.h, dirio.h: Changes for new Autoconf.
+
+ * texmf.c (RETSIGTYPE): Don't default to void.
+
+Fri Dec 18 13:16:47 1992 Karl Berry (karl@cs.umb.edu)
+
+ * strpascal.c (makesuffixpas): Rename to `extendfilename'.
+ * common.defines (extendfilename): Declare.
+
+Wed Dec 16 18:12:51 1992 Karl Berry (karl@cs.umb.edu)
+
+ * common.defines (atoi): Declare.
+
+Mon Dec 14 07:25:03 1992 Karl Berry (karl@cs.umb.edu)
+
+ * ourpaths.c: Include paths.h.
+
+Sun Dec 13 17:06:15 1992 Karl Berry (karl@cs.umb.edu)
+
+ * c-auto.h.in: Merge stuff from site.h.
+ * site.h: Delete.
+ * config.h: Don't include site.h.
+
+Sat Dec 12 13:08:52 1992 Karl Berry (karl@cs.umb.edu)
+
+ * Makefile.in: Rewrite from Makefile.
+
+ * openinout.c (open_{in,out}put): Take an extra arg for the fopen mode.
+ * texmf.h ([bw]open{in,out}): Use appropriate fopen modes.
+ * pascal.h (aopen{in,out}): Likewise.
+
+Fri Dec 11 15:19:25 1992 Karl Berry (karl@cs.umb.edu)
+
+ * texmf.c: Change ctype references to use uppercase macros.
+
+Sat Dec 5 15:21:24 1992 Karl Berry (karl@cs.umb.edu)
+
+ * texmf.h (writedvi, writegf): Check the return status of the write.
+
+ * config.h (UNSIGNED_SHORT_STRING): Toss; I think everyone
+ understands `unsigned short' now.
+
+Thu Dec 3 13:21:06 1992 Karl Berry (karl@cs.umb.edu)
+
+ * texmf.c: include c-pathch.h.
+
+Sun Nov 29 14:50:04 1992 Karl Berry (karl@cs.umb.edu)
+
+ * strpascal.c: include c-pathch.h.
+
+Mon Nov 16 08:12:16 1992 Karl Berry (karl@cs.umb.edu)
+
+ * openinout.c: include c-pathch.h.
+
+Tue Nov 10 06:49:33 1992 Karl Berry (karl@cs.umb.edu)
+
+ * texmf.c (main): Change '/' to PATH_SEP.
+ * openinout.c (open_input): Likewise.
+ * strpascal.c (makesuffixpas): And here.
+
+Mon Nov 9 09:38:58 1992 Karl Berry (karl@cs.umb.edu)
+
+ * openinout.c (open_input): Use FOPEN_RBIN_MODE instead of simply "r".
+ (open_output): Analogously.
+
+ * c-auto.h.in (DOS): New definition, #undef'd by default.
+
+Fri Nov 6 14:52:34 1992 Karl Berry (karl@cs.umb.edu)
+
+ * Makefile (lib): Use $(AR) and $(ARFLAGS) several times.
+ (AR, ARFLAGS): New variables.
+ (objs1..4): New variables, breaking up the old $(objs).
+
+Tue Oct 27 08:16:41 1992 Karl Berry (karl@cs.umb.edu)
+
+ * openinout.c (open_output): Remove `openable', just use *f !=
+ NULL; also, don't chdir to the envvar's directory, just prepend
+ the value and change nameoffile.
+
+ * site.h (TEXPOOLNAME): More instructions for MLTeX.
+
+Sun Oct 25 06:26:22 1992 Karl Berry (karl@cs.umb.edu)
+
+ * getopt.c: New version.
+
+Tue Oct 6 08:17:45 1992 Karl Berry (karl@cs.umb.edu)
+
+ * site.h.in: Doc fix.
+
+Thu Sep 24 11:06:14 1992 Karl Berry (karl@cs.umb.edu)
+
+ * site.h.in: change instructions for OpenWindows. (mroth@afit.af.mil)
+
+Thu Sep 17 08:29:53 1992 Karl Berry (karl@hayley)
+
+ * texmf.c (initscreen): if DISPLAY is set, assume we're running
+ under X11 for MF online output.
+
+ * texmf.c: remove BibTeX conditionals.
+
+Tue Sep 8 17:06:54 1992 Karl Berry (karl@hayley)
+
+ * c-auto.h.in (_MINIX, _{ALL,POSIX,POSIX_1}_SOURCE): add #undef's
+ for configure to define.
+
+Fri Sep 4 09:01:59 1992 Karl Berry (karl@hayley)
+
+ * Makefile (extraclean): new target.
+
+Fri Aug 14 07:02:41 1992 Karl Berry (karl@hayley)
+
+ * ourpaths.h (path_constant_type): remove trailing comma from
+ enum, since ANSI stupidly disallows this.
+
+Wed Aug 12 16:20:10 1992 Karl Berry (karl@hayley)
+
+ * texmf.c (catch_interrupt): change return type to `RETSIGTYPE'.
+
+ * config.h: remove conditional include of c-memstr if `index' is
+ defined.
+
+Sat Aug 8 10:11:18 1992 Karl Berry (karl@hayley)
+
+ * openinout.c (EXTERN) [!BibTeX]: define as `extern'. How did
+ this ever work?
+
+Fri Jul 3 11:23:32 1992 Karl Berry (karl@hayley)
+
+ * texmf.c (input_line): ignore \r's at the end of the line.
+
+ * site.h.in (XVIEWWIN): undef by default.
+ * texmf.c (X11WIN) [MF && (TRAP || INI)]: #undef.
+
+Thu Jul 2 16:11:46 1992 Karl Berry (karl@hayley)
+
+ * Makefile (CPPFLAGS): new variable
+ (.c.o): use it.
+ (cflags): change to CFLAGS.
+
+Tue Jun 23 09:09:49 1992 Karl Berry (karl@hayley)
+
+ * Makefile (CC): change default to `gcc -posix'.
+
+ * site.h.in (NONASCII): document that xord and xchr are ignored
+ unless this is defined.
+
+Thu Jun 11 09:20:51 1992 Karl Berry (karl@hayley)
+
+ * zround.c (zround): return LONG_MAX or LONG_MIN if the double
+ being rounded is outside the range of `integer'.
+ * c-minmax.h (LONG_{MIN,MAX}): define these if they aren't defined
+ by the system.
+
+Fri May 15 10:23:47 1992 Karl Berry (karl@hayley)
+
+ * getopt.[ch]: new versions.
+
+Thu May 14 19:21:40 1992 Karl Berry (karl@claude.cs.umb.edu)
+
+ * Version 5.851c.
+
+Wed May 13 14:32:14 1992 Karl Berry (karl@hayley)
+
+ * pathsrch.c (initalize_path_list): initialize path to the
+ original path.
+
+Mon May 4 14:50:20 1992 Karl Berry (karl@hayley)
+
+ * c-auto.h.in: doc fix.
+
+Sun May 3 08:06:07 1992 Karl Berry (karl@hayley)
+
+ * main.c (argv): use a prototype if possibile.
+
+ * texmf.ch (*dumpthings): parenthesize `len'.
+
+Wed Apr 29 16:07:52 1992 Karl Berry (karl@hayley)
+
+ * texmfmem.h (memoryword): had mutually exclusive #if's.
+ (twohalves.u): don't need junk at the end?
+
+Sat Apr 25 08:55:34 1992 Karl Berry (karl@hayley)
+
+ * c-auto.h.in (__CHAR_UNSIGNED__): protect with #ifndef.
+
+ * site.h.in: remove #ifndef's from around the #define's. I don't
+ think these help anything.
+
+Thu Apr 23 07:49:18 1992 Karl Berry (karl@hayley)
+
+ * c-auto.h.in: new file.
+
+Wed Apr 22 12:43:30 1992 Karl Berry (karl@hayley)
+
+ * texmf.c: SIGTYPE is now RETSIGTYPE.
+
+Sun Apr 19 10:26:16 1992 Karl Berry (karl@hayley)
+
+ * texmf.c: had sense of tests on FMTBASE_SWAP reversed.
+
+Thu Apr 16 13:49:36 1992 Karl Berry (karl@ra.cs.umb.edu)
+
+ * Version 5.851b.
+
+Tue Apr 14 17:06:57 1992 Karl Berry (karl@hayley)
+
+ * common.defines (BSTINPUTPATHBIT): define.
+
+Sun Apr 12 11:42:14 1992 Karl Berry (karl@hayley)
+
+ * common.defines (BSTINPUTPATH): define.
+ * ourpaths.h (path_constant_type): add BSTINPUTPATH.
+ (BSTINPUTPATHBIT): define.
+ * site.h-dist (BSTINPUTS): default is TEXINPUTS.
+ * ourpaths.c (setpaths): add stuff for BSTINPUTS.
+
+Sat Apr 11 09:26:55 1992 Karl Berry (karl@hayley)
+
+ * uexit.c: include config.h, for EXIT_SUCCESS_CODE.
+
+Fri Apr 10 16:56:18 1992 Karl Berry (karl@hayley)
+
+ * ourpaths.c (setpaths): don't pass cwd to initialize_path_list.
+
+ * site.h-dist (*INPUTS, TEXFONTS): add . to these paths.
+
+Wed Apr 8 15:34:21 1992 Karl Berry (karl@hayley)
+
+ * texmf.c [FMTBASE_SWAP]: make swapping conditional.
+ * site.h-dist: add it here for configuration.
+
+ * main.c (do_undump) [VMS]: add code from joe.
+
+ * main.c: use exit, not exit.
+
+ * Makefile (objs): add uexit.o.
+ * uexit.c: new file.
+ * pascal.h (uexit): remove this, as it's now a function.
+
+Fri Apr 3 09:55:00 1992 Karl Berry (karl at hayley)
+
+ * Version 5.851a.
+
+Thu Apr 2 11:57:06 1992 Karl Berry (karl at apollo.cs.umb.edu)
+
+ * c-memstr.h (memcpy) [!NEED_MEMORY_H]: conditionalize.
+
+Thu Apr 2 10:51:11 1992 Karl Berry (karl at ra.cs.umb.edu)
+
+ * xstat.c (xlstat): (un)prototype-ize.
+
+ * c-limits.h: test for FLOAT_H_MISSING instead of relying on
+ _POSIX_VERSION to include <float.h>.
+
+ * c-pathmx.h [_POSIX_VERSION]: don't do pathconf stuff.
+
+Wed Apr 1 16:57:30 1992 Karl Berry (karl at hayley)
+
+ * common.h (FATAL): use `str' as the arg name, not `s', since we
+ need to do `%s'.
+
+ * xopendir.c (xclosedir): prototype-ize it.
+
+ * dir-p (leaf_dir_p): don't initialize a structure (!).
+
+ * {concat,pathsrch,texmf,xmalloc,xstrdup,xrealloc}.c: cast results from
+ xmalloc/malloc/realloc (argh).
+
+ * alloca.c: comment things after #endif.
+
+ * site.h-dist (REGFIX): put this back.
+
+ * c-proto.h (P5C) [!__STDC__]: insert missing backslash.
+
+Mon Mar 30 07:28:25 1992 Karl Berry (karl at hayley)
+
+ * texmfmem.h (u, v, twohalves) [big MF]: define the halfword junks
+ again.
+
+Sun Mar 29 15:33:29 1992 Karl Berry (karl at hayley)
+
+ * alloca.c: new version from gcc 2.1.
+
+Sat Mar 28 09:46:53 1992 Karl Berry (karl at hayley)
+
+ * main.c (main): return int, exit (EXIT_SUCCESS_CODE).
+ * texmf.c (main): likewise.
+
+ * config.h (SCHAR_TYPE): use `__CHAR_UNSIGNED__' again.
+
+Thu Mar 26 06:57:38 1992 Karl Berry (karl at hayley)
+
+ * Makefile (clean, realclean): depend on mostlyclean.
+
+Sun Mar 22 09:16:04 1992 Karl Berry (karl at hayley)
+
+ * common.h [BibTeX]: remove the include of <setjmp.h>, as
+ bibtex/convert does it.
+
+Sat Mar 21 11:09:55 1992 Karl Berry (karl at hayley)
+
+ * common.defines (input2ints): for patgen2.
+ * inputint.c (zinput2ints): new routine.
+ * pascal.h (input2ints): new macro to call it.
+
+ * config.h: include c-pathmx.h.
+
+ * common.defines (TEXPOOLNAME): declare as a constant.
+
+Fri Mar 20 16:10:44 1992 Karl Berry (karl at hayley)
+
+ * paths.h: new file.
+
+ * config.h: update for new files c-*.h.
+ * common.h: remove stuff that is now in lib.h.
+
+Thu Mar 19 11:52:17 1992 Karl Berry (karl at hayley)
+
+ * ourpaths.c (append_path_list): remove this.
+
+ * ourpaths.c (setpaths): use the envvar TEXFONTS if VFFONTS isn't set.
+
+Tue Feb 11 10:27:38 1992 Karl Berry (karl at hayley)
+
+ * config.h [NEED_MEMORY_H]: include <memory.h>.
+
+ * config.h [LIMITS_H_MISSING]: include <sys/param.h>.
+
+Sun Feb 2 07:54:53 1992 Karl Berry (karl at hayley)
+
+ * pathsearch.c (parse_envpath): remove the second / before doing
+ subdirectories.
+
+ * pascal.h (optiontable): remove, as getopt no longer has a global
+ table for the long options.
+
+Sat Feb 1 15:32:50 1992 Karl Berry (karl at hayley)
+
+ * ourpaths.c (setpaths): use TEXFONTS if PKFONTS/GFFONTS is not
+ set for GF/PK files, as the documentation claims.
+
+ * ourpaths.c (setpaths): remove subdirectory stuff.
+ * pathsearch.[ch]: new versions to integrate subdirectories into
+ the main paths.
+
+ * texmf{,mem}.c (WEB2C_BIGENDIAN): rename to WORDS_BIGENDIAN.
+
+Fri Jan 31 11:54:46 1992 Karl Berry (karl at hayley)
+
+ * strpascal.c ({null,space}_terminate): do not translate using
+ xord/xchr (from raichle@azu.informatik.uni-stuttgart.de).
+
+Fri Jan 24 07:14:05 1992 Karl Berry (karl at hayley)
+
+ * Makefile (cflags): don't include -I../config.
+
+ * config.h (__CHAR_UNSIGNED__) [CHAR_UNSIGNED]: define as autoconf
+ uses the latter and gcc sometimes the former.
+
+ * config.h: move from config.
+
+ * openinout.c (extensionirrelevantp): new function.
+ * common.defines: declare it.
+
+ * ourpaths.h (path_constant_type): rename from `path_constants'.
+ * openinout.c (open_input): use it for the path arg.
+
+Wed Jan 15 11:13:45 1992 Karl Berry (karl at hayley)
+
+ * xgetcwd.c, xchdir.c: don't need these.
+ * Makefile (objs): remove from list.
+ * dirio.h: remove decls.
+
+ * pathsearch.c (check_subdir): do not cd to the directory we're
+ testing.
+ (add_directory): test if the name is a directory before adding it
+ to the list.
+ (parse_envpath): don't test if the names are directories here.
+ (initialize_path_list): don't find and cd to the current directory
+ between each subdirectory.
+
+Tue Jan 14 16:06:24 1992 Karl Berry (karl at hayley)
+
+ * texmf.c: do not include <sys/types.h>; it's in config.h now.
+ * types.h: likewise.
+
+Sun Jan 12 07:41:34 1992 Karl Berry (karl at hayley)
+
+ * pathsearch.c (initialize_path_list): cd back to . after checking
+ each subdirectory.
+
+ * dirio.h: change directory header stuff as suggested in the
+ autoconf manual.
+
+ * ourpaths.h: make the path list an enumeration type.
+
+ * openinout.c (open_input): correctly compute namelength.
+
+ * texmfmem.h (memoryword) [TeX]: make declaration of `glueratio'
+ conditional.
+
+ * openinout.c: rearrange ifdefs for coherency.
+
+ * ourpaths.c (append_path_list): overwrite the null in the first
+ list.
+
+ * pathsearch.c (initialize_path_list): unconditionally call
+ parse_envpath.
+ (parse_envpath): if the envvar name is null, don't call getenv.
+ If both args are null, do nothing.
+
+ * ourpaths.c (setpaths): initialize the TFM path.
+
+ * common.h (FATAL*): new macros.
+
+ * pascal.h (real): define to be `double'.
+
+ * xfopen-pas.c: new file.
+
+ * eofeoln.c (test_eof): rename to `eof'.
+ * pascal.h (eof): remove.
+
+ * pascal.h (reset, rewrite): `checked_fopen' => `xfopen_pas'.
+
+ * common.h (link): define as `link_var', to avoid conflicts
+ between the system call and the web var.
+
+ * common.defines (FILENAMESIZE): rename to `PATHMAX'.
+
+Tue Jan 7 11:26:02 1992 Karl Berry (karl at hayley)
+
+ * getopt*: new versions.
+
+ * extra.c (getwd) [GETWD_MISSING]: conditionalize.
+
+ * extra.c (zinput3ints): new implementation, from jmr@nada.kth.se.
+
+ * texmf.c (swap_items) [!WEB2C_BIG_ENDIAN]: ifdef on this.
+ * texmfmem.h (twohalves, fourquarters): incorporate changes from
+ raichle@azu.informatik.uni-stuttgart.de which he says make
+ format files finally work.
+
+ * common.h (SCHAR_TYPE): use `signed_char' if ANSI, `short' if
+ char is unsigned, otherwise `char'.
+
diff --git a/Build/source/texk/web2c/lib/Makefile.am b/Build/source/texk/web2c/lib/Makefile.am
new file mode 100644
index 00000000000..927a2d7c976
--- /dev/null
+++ b/Build/source/texk/web2c/lib/Makefile.am
@@ -0,0 +1,48 @@
+## Makefile.am for the TeX Live subdirectory texk/web2c/lib/
+##
+## Copyright (C) 2009-2012 Peter Breitenlohner <tex-live@tug.org>
+## You may freely use, modify and/or distribute this file.
+##
+AM_CPPFLAGS = -I$(top_srcdir) $(KPATHSEA_INCLUDES)
+AM_CFLAGS = $(WARNING_CFLAGS)
+
+## Rebuild libkpathsea
+@KPATHSEA_RULE@
+
+noinst_LIBRARIES = lib.a
+if PTEX
+noinst_LIBRARIES += libp.a
+endif PTEX
+EXTRA_LIBRARIES = libp.a
+
+## We don't compile `texmfmp.c'; this file is included from 'texextra.c'
+## for TeX, 'mfextra.c' for Metafont, ...
+lib_a_SOURCES = \
+ basechsuffix.c \
+ chartostring.c \
+ coredump.c \
+ eofeoln.c \
+ fprintreal.c \
+ inputint.c \
+ input2int.c \
+ lib.h \
+ main.c \
+ openclose.c \
+ printversion.c \
+ setupvar.c \
+ uexit.c \
+ usage.c \
+ version.c \
+ zround.c
+
+## Replacements for pTeX.
+##
+libp_a_CPPFLAGS = -DPTEX $(PTEXENC_INCLUDES) $(AM_CPPFLAGS)
+libp_a_SOURCES = \
+ openclose.c \
+ printversion.c
+
+## Not yet used
+##
+EXTRA_DIST = alloca.c
+
diff --git a/Build/source/texk/web2c/lib/Makefile.in b/Build/source/texk/web2c/lib/Makefile.in
new file mode 100644
index 00000000000..b8f2f542fb8
--- /dev/null
+++ b/Build/source/texk/web2c/lib/Makefile.in
@@ -0,0 +1,876 @@
+# Makefile.in generated by automake 1.16.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2020 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+@PTEX_TRUE@am__append_1 = libp.a
+subdir = lib
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/web2c-disable.m4 \
+ $(top_srcdir)/../../m4/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/../../m4/kpse-asm.m4 \
+ $(top_srcdir)/../../m4/kpse-cairo-flags.m4 \
+ $(top_srcdir)/../../m4/kpse-common.m4 \
+ $(top_srcdir)/../../m4/kpse-cross.m4 \
+ $(top_srcdir)/../../m4/kpse-cxx-hack.m4 \
+ $(top_srcdir)/../../m4/kpse-fontconfig-flags.m4 \
+ $(top_srcdir)/../../m4/kpse-freetype2-flags.m4 \
+ $(top_srcdir)/../../m4/kpse-gmp-flags.m4 \
+ $(top_srcdir)/../../m4/kpse-graphite2-flags.m4 \
+ $(top_srcdir)/../../m4/kpse-harfbuzz-flags.m4 \
+ $(top_srcdir)/../../m4/kpse-icu-flags.m4 \
+ $(top_srcdir)/../../m4/kpse-kpathsea-flags.m4 \
+ $(top_srcdir)/../../m4/kpse-lex.m4 \
+ $(top_srcdir)/../../m4/kpse-lib-version.m4 \
+ $(top_srcdir)/../../m4/kpse-libpng-flags.m4 \
+ $(top_srcdir)/../../m4/kpse-lt-hack.m4 \
+ $(top_srcdir)/../../m4/kpse-lua52-flags.m4 \
+ $(top_srcdir)/../../m4/kpse-lua53-flags.m4 \
+ $(top_srcdir)/../../m4/kpse-luajit-flags.m4 \
+ $(top_srcdir)/../../m4/kpse-macos-framework.m4 \
+ $(top_srcdir)/../../m4/kpse-mpfr-flags.m4 \
+ $(top_srcdir)/../../m4/kpse-pixman-flags.m4 \
+ $(top_srcdir)/../../m4/kpse-pplib-flags.m4 \
+ $(top_srcdir)/../../m4/kpse-ptexenc-flags.m4 \
+ $(top_srcdir)/../../m4/kpse-socket-libs.m4 \
+ $(top_srcdir)/../../m4/kpse-teckit-flags.m4 \
+ $(top_srcdir)/../../m4/kpse-warnings.m4 \
+ $(top_srcdir)/../../m4/kpse-web2c.m4 \
+ $(top_srcdir)/../../m4/kpse-win32.m4 \
+ $(top_srcdir)/../../m4/kpse-xpdf-flags.m4 \
+ $(top_srcdir)/../../m4/kpse-zlib-flags.m4 \
+ $(top_srcdir)/../../m4/kpse-zziplib-flags.m4 \
+ $(top_srcdir)/../../m4/libtool.m4 \
+ $(top_srcdir)/../../m4/ltoptions.m4 \
+ $(top_srcdir)/../../m4/ltsugar.m4 \
+ $(top_srcdir)/../../m4/ltversion.m4 \
+ $(top_srcdir)/../../m4/lt~obsolete.m4 \
+ $(top_srcdir)/../../version.ac $(top_srcdir)/ac/web2c.ac \
+ $(top_srcdir)/synctexdir/ac/synctex.ac \
+ $(top_srcdir)/synctexdir/synctex_parser_api_level.txt \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/w2c/c-auto.h \
+ $(top_builddir)/ff-config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+AM_V_AR = $(am__v_AR_@AM_V@)
+am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@)
+am__v_AR_0 = @echo " AR " $@;
+am__v_AR_1 =
+lib_a_AR = $(AR) $(ARFLAGS)
+lib_a_LIBADD =
+am_lib_a_OBJECTS = basechsuffix.$(OBJEXT) chartostring.$(OBJEXT) \
+ coredump.$(OBJEXT) eofeoln.$(OBJEXT) fprintreal.$(OBJEXT) \
+ inputint.$(OBJEXT) input2int.$(OBJEXT) main.$(OBJEXT) \
+ openclose.$(OBJEXT) printversion.$(OBJEXT) setupvar.$(OBJEXT) \
+ uexit.$(OBJEXT) usage.$(OBJEXT) version.$(OBJEXT) \
+ zround.$(OBJEXT)
+lib_a_OBJECTS = $(am_lib_a_OBJECTS)
+libp_a_AR = $(AR) $(ARFLAGS)
+libp_a_LIBADD =
+am_libp_a_OBJECTS = libp_a-openclose.$(OBJEXT) \
+ libp_a-printversion.$(OBJEXT)
+libp_a_OBJECTS = $(am_libp_a_OBJECTS)
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/w2c -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/../../build-aux/depcomp
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/basechsuffix.Po \
+ ./$(DEPDIR)/chartostring.Po ./$(DEPDIR)/coredump.Po \
+ ./$(DEPDIR)/eofeoln.Po ./$(DEPDIR)/fprintreal.Po \
+ ./$(DEPDIR)/input2int.Po ./$(DEPDIR)/inputint.Po \
+ ./$(DEPDIR)/libp_a-openclose.Po \
+ ./$(DEPDIR)/libp_a-printversion.Po ./$(DEPDIR)/main.Po \
+ ./$(DEPDIR)/openclose.Po ./$(DEPDIR)/printversion.Po \
+ ./$(DEPDIR)/setupvar.Po ./$(DEPDIR)/uexit.Po \
+ ./$(DEPDIR)/usage.Po ./$(DEPDIR)/version.Po \
+ ./$(DEPDIR)/zround.Po
+am__mv = mv -f
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = $(lib_a_SOURCES) $(libp_a_SOURCES)
+DIST_SOURCES = $(lib_a_SOURCES) $(libp_a_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+am__DIST_COMMON = $(srcdir)/Makefile.in \
+ $(top_srcdir)/../../build-aux/depcomp ChangeLog README
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CAIRO_DEPEND = @CAIRO_DEPEND@
+CAIRO_INCLUDES = @CAIRO_INCLUDES@
+CAIRO_LIBS = @CAIRO_LIBS@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CTANGLE = @CTANGLE@
+CTANGLEBOOT = @CTANGLEBOOT@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CXXLD = @CXXLD@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FONTCONFIG_INCLUDES = @FONTCONFIG_INCLUDES@
+FONTCONFIG_LIBS = @FONTCONFIG_LIBS@
+FREETYPE2_DEPEND = @FREETYPE2_DEPEND@
+FREETYPE2_INCLUDES = @FREETYPE2_INCLUDES@
+FREETYPE2_LIBS = @FREETYPE2_LIBS@
+FT2_CONFIG = @FT2_CONFIG@
+GMP_DEPEND = @GMP_DEPEND@
+GMP_INCLUDES = @GMP_INCLUDES@
+GMP_LIBS = @GMP_LIBS@
+GRAPHITE2_DEPEND = @GRAPHITE2_DEPEND@
+GRAPHITE2_INCLUDES = @GRAPHITE2_INCLUDES@
+GRAPHITE2_LIBS = @GRAPHITE2_LIBS@
+GREP = @GREP@
+HARFBUZZ_DEPEND = @HARFBUZZ_DEPEND@
+HARFBUZZ_INCLUDES = @HARFBUZZ_INCLUDES@
+HARFBUZZ_LIBS = @HARFBUZZ_LIBS@
+HAVE_CXX11 = @HAVE_CXX11@
+ICU_CONFIG = @ICU_CONFIG@
+ICU_DEPEND = @ICU_DEPEND@
+ICU_INCLUDES = @ICU_INCLUDES@
+ICU_LIBS = @ICU_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KPATHSEA_DEPEND = @KPATHSEA_DEPEND@
+KPATHSEA_INCLUDES = @KPATHSEA_INCLUDES@
+KPATHSEA_LIBS = @KPATHSEA_LIBS@
+KPATHSEA_PATHS_H = @KPATHSEA_PATHS_H@
+KPSEWHICH = @KPSEWHICH@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBOBJS = @LIBOBJS@
+LIBPNG_DEPEND = @LIBPNG_DEPEND@
+LIBPNG_INCLUDES = @LIBPNG_INCLUDES@
+LIBPNG_LIBS = @LIBPNG_LIBS@
+LIBS = @LIBS@
+LIBSYNCTEX = @LIBSYNCTEX@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LTLIBSYNCTEX = @LTLIBSYNCTEX@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+LUA52_DEFINES = @LUA52_DEFINES@
+LUA52_DEPEND = @LUA52_DEPEND@
+LUA52_INCLUDES = @LUA52_INCLUDES@
+LUA52_LIBS = @LUA52_LIBS@
+LUA53_DEFINES = @LUA53_DEFINES@
+LUA53_DEPEND = @LUA53_DEPEND@
+LUA53_INCLUDES = @LUA53_INCLUDES@
+LUA53_LIBS = @LUA53_LIBS@
+LUAJIT_DEFINES = @LUAJIT_DEFINES@
+LUAJIT_DEPEND = @LUAJIT_DEPEND@
+LUAJIT_INCLUDES = @LUAJIT_INCLUDES@
+LUAJIT_LDEXTRA = @LUAJIT_LDEXTRA@
+LUAJIT_LIBS = @LUAJIT_LIBS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+MPFR_DEPEND = @MPFR_DEPEND@
+MPFR_INCLUDES = @MPFR_INCLUDES@
+MPFR_LIBS = @MPFR_LIBS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJCXX = @OBJCXX@
+OBJCXXDEPMODE = @OBJCXXDEPMODE@
+OBJCXXFLAGS = @OBJCXXFLAGS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTANGLE = @OTANGLE@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PIXMAN_DEPEND = @PIXMAN_DEPEND@
+PIXMAN_INCLUDES = @PIXMAN_INCLUDES@
+PIXMAN_LIBS = @PIXMAN_LIBS@
+PKG_CONFIG = @PKG_CONFIG@
+PPLIB_DEPEND = @PPLIB_DEPEND@
+PPLIB_INCLUDES = @PPLIB_INCLUDES@
+PPLIB_LIBS = @PPLIB_LIBS@
+PTEXENC_DEPEND = @PTEXENC_DEPEND@
+PTEXENC_INCLUDES = @PTEXENC_INCLUDES@
+PTEXENC_LIBS = @PTEXENC_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+SYNCTEXVERSION = @SYNCTEXVERSION@
+SYNCTEX_LT_VERSINFO = @SYNCTEX_LT_VERSINFO@
+TANGLE = @TANGLE@
+TANGLEBOOT = @TANGLEBOOT@
+TECKIT_DEPEND = @TECKIT_DEPEND@
+TECKIT_INCLUDES = @TECKIT_INCLUDES@
+TECKIT_LIBS = @TECKIT_LIBS@
+TIE = @TIE@
+VERSION = @VERSION@
+WARNING_CFLAGS = @WARNING_CFLAGS@
+WARNING_CXXFLAGS = @WARNING_CXXFLAGS@
+WARNING_OBJCXXFLAGS = @WARNING_OBJCXXFLAGS@
+WEB2CVERSION = @WEB2CVERSION@
+XMKMF = @XMKMF@
+XPDF_DEPEND = @XPDF_DEPEND@
+XPDF_INCLUDES = @XPDF_INCLUDES@
+XPDF_LIBS = @XPDF_LIBS@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+ZLIB_DEPEND = @ZLIB_DEPEND@
+ZLIB_INCLUDES = @ZLIB_INCLUDES@
+ZLIB_LIBS = @ZLIB_LIBS@
+ZZIPLIB_DEPEND = @ZZIPLIB_DEPEND@
+ZZIPLIB_INCLUDES = @ZZIPLIB_INCLUDES@
+ZZIPLIB_LIBS = @ZZIPLIB_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_OBJCXX = @ac_ct_OBJCXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+ipc_socketlibs = @ipc_socketlibs@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lua_socketlibs = @lua_socketlibs@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+subdirs = @subdirs@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+wlibs = @wlibs@
+x_ext_lib = @x_ext_lib@
+x_tool_libs = @x_tool_libs@
+AM_CPPFLAGS = -I$(top_srcdir) $(KPATHSEA_INCLUDES)
+AM_CFLAGS = $(WARNING_CFLAGS)
+noinst_LIBRARIES = lib.a $(am__append_1)
+EXTRA_LIBRARIES = libp.a
+lib_a_SOURCES = \
+ basechsuffix.c \
+ chartostring.c \
+ coredump.c \
+ eofeoln.c \
+ fprintreal.c \
+ inputint.c \
+ input2int.c \
+ lib.h \
+ main.c \
+ openclose.c \
+ printversion.c \
+ setupvar.c \
+ uexit.c \
+ usage.c \
+ version.c \
+ zround.c
+
+libp_a_CPPFLAGS = -DPTEX $(PTEXENC_INCLUDES) $(AM_CPPFLAGS)
+libp_a_SOURCES = \
+ openclose.c \
+ printversion.c
+
+EXTRA_DIST = alloca.c
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lib/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign lib/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+
+lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES) $(EXTRA_lib_a_DEPENDENCIES)
+ $(AM_V_at)-rm -f lib.a
+ $(AM_V_AR)$(lib_a_AR) lib.a $(lib_a_OBJECTS) $(lib_a_LIBADD)
+ $(AM_V_at)$(RANLIB) lib.a
+
+libp.a: $(libp_a_OBJECTS) $(libp_a_DEPENDENCIES) $(EXTRA_libp_a_DEPENDENCIES)
+ $(AM_V_at)-rm -f libp.a
+ $(AM_V_AR)$(libp_a_AR) libp.a $(libp_a_OBJECTS) $(libp_a_LIBADD)
+ $(AM_V_at)$(RANLIB) libp.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basechsuffix.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chartostring.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/coredump.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eofeoln.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fprintreal.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/input2int.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inputint.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libp_a-openclose.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libp_a-printversion.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/openclose.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printversion.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setupvar.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uexit.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usage.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zround.Po@am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+ @$(MKDIR_P) $(@D)
+ @echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+
+libp_a-openclose.o: openclose.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libp_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libp_a-openclose.o -MD -MP -MF $(DEPDIR)/libp_a-openclose.Tpo -c -o libp_a-openclose.o `test -f 'openclose.c' || echo '$(srcdir)/'`openclose.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libp_a-openclose.Tpo $(DEPDIR)/libp_a-openclose.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='openclose.c' object='libp_a-openclose.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libp_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libp_a-openclose.o `test -f 'openclose.c' || echo '$(srcdir)/'`openclose.c
+
+libp_a-openclose.obj: openclose.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libp_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libp_a-openclose.obj -MD -MP -MF $(DEPDIR)/libp_a-openclose.Tpo -c -o libp_a-openclose.obj `if test -f 'openclose.c'; then $(CYGPATH_W) 'openclose.c'; else $(CYGPATH_W) '$(srcdir)/openclose.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libp_a-openclose.Tpo $(DEPDIR)/libp_a-openclose.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='openclose.c' object='libp_a-openclose.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libp_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libp_a-openclose.obj `if test -f 'openclose.c'; then $(CYGPATH_W) 'openclose.c'; else $(CYGPATH_W) '$(srcdir)/openclose.c'; fi`
+
+libp_a-printversion.o: printversion.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libp_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libp_a-printversion.o -MD -MP -MF $(DEPDIR)/libp_a-printversion.Tpo -c -o libp_a-printversion.o `test -f 'printversion.c' || echo '$(srcdir)/'`printversion.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libp_a-printversion.Tpo $(DEPDIR)/libp_a-printversion.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='printversion.c' object='libp_a-printversion.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libp_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libp_a-printversion.o `test -f 'printversion.c' || echo '$(srcdir)/'`printversion.c
+
+libp_a-printversion.obj: printversion.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libp_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libp_a-printversion.obj -MD -MP -MF $(DEPDIR)/libp_a-printversion.Tpo -c -o libp_a-printversion.obj `if test -f 'printversion.c'; then $(CYGPATH_W) 'printversion.c'; else $(CYGPATH_W) '$(srcdir)/printversion.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libp_a-printversion.Tpo $(DEPDIR)/libp_a-printversion.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='printversion.c' object='libp_a-printversion.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libp_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libp_a-printversion.obj `if test -f 'printversion.c'; then $(CYGPATH_W) 'printversion.c'; else $(CYGPATH_W) '$(srcdir)/printversion.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -f ./$(DEPDIR)/basechsuffix.Po
+ -rm -f ./$(DEPDIR)/chartostring.Po
+ -rm -f ./$(DEPDIR)/coredump.Po
+ -rm -f ./$(DEPDIR)/eofeoln.Po
+ -rm -f ./$(DEPDIR)/fprintreal.Po
+ -rm -f ./$(DEPDIR)/input2int.Po
+ -rm -f ./$(DEPDIR)/inputint.Po
+ -rm -f ./$(DEPDIR)/libp_a-openclose.Po
+ -rm -f ./$(DEPDIR)/libp_a-printversion.Po
+ -rm -f ./$(DEPDIR)/main.Po
+ -rm -f ./$(DEPDIR)/openclose.Po
+ -rm -f ./$(DEPDIR)/printversion.Po
+ -rm -f ./$(DEPDIR)/setupvar.Po
+ -rm -f ./$(DEPDIR)/uexit.Po
+ -rm -f ./$(DEPDIR)/usage.Po
+ -rm -f ./$(DEPDIR)/version.Po
+ -rm -f ./$(DEPDIR)/zround.Po
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f ./$(DEPDIR)/basechsuffix.Po
+ -rm -f ./$(DEPDIR)/chartostring.Po
+ -rm -f ./$(DEPDIR)/coredump.Po
+ -rm -f ./$(DEPDIR)/eofeoln.Po
+ -rm -f ./$(DEPDIR)/fprintreal.Po
+ -rm -f ./$(DEPDIR)/input2int.Po
+ -rm -f ./$(DEPDIR)/inputint.Po
+ -rm -f ./$(DEPDIR)/libp_a-openclose.Po
+ -rm -f ./$(DEPDIR)/libp_a-printversion.Po
+ -rm -f ./$(DEPDIR)/main.Po
+ -rm -f ./$(DEPDIR)/openclose.Po
+ -rm -f ./$(DEPDIR)/printversion.Po
+ -rm -f ./$(DEPDIR)/setupvar.Po
+ -rm -f ./$(DEPDIR)/uexit.Po
+ -rm -f ./$(DEPDIR)/usage.Po
+ -rm -f ./$(DEPDIR)/version.Po
+ -rm -f ./$(DEPDIR)/zround.Po
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
+ clean-generic clean-libtool clean-noinstLIBRARIES \
+ cscopelist-am ctags ctags-am distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags tags-am uninstall uninstall-am
+
+.PRECIOUS: Makefile
+
+
+@KPATHSEA_RULE@
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/Build/source/texk/web2c/lib/README b/Build/source/texk/web2c/lib/README
new file mode 100644
index 00000000000..8cd3761bef9
--- /dev/null
+++ b/Build/source/texk/web2c/lib/README
@@ -0,0 +1,2 @@
+This directory contains the web2c library, just a few functions mostly
+common to both the TeX programs and the web2c conversion itself.
diff --git a/Build/source/texk/web2c/lib/alloca.c b/Build/source/texk/web2c/lib/alloca.c
new file mode 100644
index 00000000000..1e48c11c505
--- /dev/null
+++ b/Build/source/texk/web2c/lib/alloca.c
@@ -0,0 +1,504 @@
+/* alloca.c -- allocate automatically reclaimed memory
+ (Mostly) portable public-domain implementation -- D A Gwyn
+
+ This implementation of the PWB library alloca function,
+ which is used to allocate space off the run-time stack so
+ that it is automatically reclaimed upon procedure exit,
+ was inspired by discussions with J. Q. Johnson of Cornell.
+ J.Otto Tennant <jot@cray.com> contributed the Cray support.
+
+ There are some preprocessor constants that can
+ be defined when compiling for your specific system, for
+ improved efficiency; however, the defaults should be okay.
+
+ The general concept of this implementation is to keep
+ track of all alloca-allocated blocks, and reclaim any
+ that are found to be deeper in the stack than the current
+ invocation. This heuristic does not reclaim storage as
+ soon as it becomes invalid, but it will do so eventually.
+
+ As a special case, alloca(0) reclaims storage without
+ allocating any. It is a good idea to use alloca(0) in
+ your main control loop, etc. to force garbage collection. */
+
+#ifdef HAVE_CONFIG_H
+#include <w2c/config.h>
+#endif
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#ifdef emacs
+#include "blockinput.h"
+#endif
+
+/* If compiling with GCC 2, this file's not needed. */
+#if !defined (__GNUC__) || __GNUC__ < 2
+
+/* If someone has defined alloca as a macro,
+ there must be some other way alloca is supposed to work. */
+#ifndef alloca
+
+#ifdef emacs
+#ifdef static
+/* actually, only want this if static is defined as ""
+ -- this is for usg, in which emacs must undefine static
+ in order to make unexec workable
+ */
+#ifndef STACK_DIRECTION
+you
+lose
+-- must know STACK_DIRECTION at compile-time
+#endif /* STACK_DIRECTION undefined */
+#endif /* static */
+#endif /* emacs */
+
+/* If your stack is a linked list of frames, you have to
+ provide an "address metric" ADDRESS_FUNCTION macro. */
+
+#if defined (CRAY) && defined (CRAY_STACKSEG_END)
+long i00afunc ();
+#define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
+#else
+#define ADDRESS_FUNCTION(arg) &(arg)
+#endif
+
+#if __STDC__
+typedef void *pointer;
+#else
+typedef char *pointer;
+#endif
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+/* Different portions of Emacs need to call different versions of
+ malloc. The Emacs executable needs alloca to call xmalloc, because
+ ordinary malloc isn't protected from input signals. On the other
+ hand, the utilities in lib-src need alloca to call malloc; some of
+ them are very simple, and don't have an xmalloc routine.
+
+ Non-Emacs programs expect this to call use xmalloc.
+
+ Callers below should use malloc. */
+
+#ifndef emacs
+#define malloc xmalloc
+#endif
+extern pointer malloc ();
+
+/* Define STACK_DIRECTION if you know the direction of stack
+ growth for your system; otherwise it will be automatically
+ deduced at run-time.
+
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown */
+
+#ifndef STACK_DIRECTION
+#define STACK_DIRECTION 0 /* Direction unknown. */
+#endif
+
+#if STACK_DIRECTION != 0
+
+#define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
+
+#else /* STACK_DIRECTION == 0; need run-time code. */
+
+static int stack_dir; /* 1 or -1 once known. */
+#define STACK_DIR stack_dir
+
+static void
+find_stack_direction ()
+{
+ static char *addr = NULL; /* Address of first `dummy', once known. */
+ auto char dummy; /* To get stack address. */
+
+ if (addr == NULL)
+ { /* Initial entry. */
+ addr = ADDRESS_FUNCTION (dummy);
+
+ find_stack_direction (); /* Recurse once. */
+ }
+ else
+ {
+ /* Second entry. */
+ if (ADDRESS_FUNCTION (dummy) > addr)
+ stack_dir = 1; /* Stack grew upward. */
+ else
+ stack_dir = -1; /* Stack grew downward. */
+ }
+}
+
+#endif /* STACK_DIRECTION == 0 */
+
+/* An "alloca header" is used to:
+ (a) chain together all alloca'ed blocks;
+ (b) keep track of stack depth.
+
+ It is very important that sizeof(header) agree with malloc
+ alignment chunk size. The following default should work okay. */
+
+#ifndef ALIGN_SIZE
+#define ALIGN_SIZE sizeof(double)
+#endif
+
+typedef union hdr
+{
+ char align[ALIGN_SIZE]; /* To force sizeof(header). */
+ struct
+ {
+ union hdr *next; /* For chaining headers. */
+ char *deep; /* For stack depth measure. */
+ } h;
+} header;
+
+static header *last_alloca_header = NULL; /* -> last alloca header. */
+
+/* Return a pointer to at least SIZE bytes of storage,
+ which will be automatically reclaimed upon exit from
+ the procedure that called alloca. Originally, this space
+ was supposed to be taken from the current stack frame of the
+ caller, but that method cannot be made to work for some
+ implementations of C, for example under Gould's UTX/32. */
+
+pointer
+alloca (size)
+ unsigned size;
+{
+ auto char probe; /* Probes stack depth: */
+ register char *depth = ADDRESS_FUNCTION (probe);
+
+#if STACK_DIRECTION == 0
+ if (STACK_DIR == 0) /* Unknown growth direction. */
+ find_stack_direction ();
+#endif
+
+ /* Reclaim garbage, defined as all alloca'd storage that
+ was allocated from deeper in the stack than currently. */
+
+ {
+ register header *hp; /* Traverses linked list. */
+
+#ifdef emacs
+ BLOCK_INPUT;
+#endif
+
+ for (hp = last_alloca_header; hp != NULL;)
+ if ((STACK_DIR > 0 && hp->h.deep > depth)
+ || (STACK_DIR < 0 && hp->h.deep < depth))
+ {
+ register header *np = hp->h.next;
+
+ free ((pointer) hp); /* Collect garbage. */
+
+ hp = np; /* -> next header. */
+ }
+ else
+ break; /* Rest are not deeper. */
+
+ last_alloca_header = hp; /* -> last valid storage. */
+
+#ifdef emacs
+ UNBLOCK_INPUT;
+#endif
+ }
+
+ if (size == 0)
+ return NULL; /* No allocation required. */
+
+ /* Allocate combined header + user data storage. */
+
+ {
+ register pointer newm = malloc (sizeof (header) + size);
+ /* Address of header. */
+
+ if (newm == 0)
+ abort();
+
+ ((header *) newm)->h.next = last_alloca_header;
+ ((header *) newm)->h.deep = depth;
+
+ last_alloca_header = (header *) newm;
+
+ /* User storage begins just after header. */
+
+ return (pointer) ((char *) newm + sizeof (header));
+ }
+}
+
+#if defined (CRAY) && defined (CRAY_STACKSEG_END)
+
+#ifdef DEBUG_I00AFUNC
+#include <stdio.h>
+#endif
+
+#ifndef CRAY_STACK
+#define CRAY_STACK
+#ifndef CRAY2
+/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
+struct stack_control_header
+ {
+ long shgrow:32; /* Number of times stack has grown. */
+ long shaseg:32; /* Size of increments to stack. */
+ long shhwm:32; /* High water mark of stack. */
+ long shsize:32; /* Current size of stack (all segments). */
+ };
+
+/* The stack segment linkage control information occurs at
+ the high-address end of a stack segment. (The stack
+ grows from low addresses to high addresses.) The initial
+ part of the stack segment linkage control information is
+ 0200 (octal) words. This provides for register storage
+ for the routine which overflows the stack. */
+
+struct stack_segment_linkage
+ {
+ long ss[0200]; /* 0200 overflow words. */
+ long sssize:32; /* Number of words in this segment. */
+ long ssbase:32; /* Offset to stack base. */
+ long:32;
+ long sspseg:32; /* Offset to linkage control of previous
+ segment of stack. */
+ long:32;
+ long sstcpt:32; /* Pointer to task common address block. */
+ long sscsnm; /* Private control structure number for
+ microtasking. */
+ long ssusr1; /* Reserved for user. */
+ long ssusr2; /* Reserved for user. */
+ long sstpid; /* Process ID for pid based multi-tasking. */
+ long ssgvup; /* Pointer to multitasking thread giveup. */
+ long sscray[7]; /* Reserved for Cray Research. */
+ long ssa0;
+ long ssa1;
+ long ssa2;
+ long ssa3;
+ long ssa4;
+ long ssa5;
+ long ssa6;
+ long ssa7;
+ long sss0;
+ long sss1;
+ long sss2;
+ long sss3;
+ long sss4;
+ long sss5;
+ long sss6;
+ long sss7;
+ };
+
+#else /* CRAY2 */
+/* The following structure defines the vector of words
+ returned by the STKSTAT library routine. */
+struct stk_stat
+ {
+ long now; /* Current total stack size. */
+ long maxc; /* Amount of contiguous space which would
+ be required to satisfy the maximum
+ stack demand to date. */
+ long high_water; /* Stack high-water mark. */
+ long overflows; /* Number of stack overflow ($STKOFEN) calls. */
+ long hits; /* Number of internal buffer hits. */
+ long extends; /* Number of block extensions. */
+ long stko_mallocs; /* Block allocations by $STKOFEN. */
+ long underflows; /* Number of stack underflow calls ($STKRETN). */
+ long stko_free; /* Number of deallocations by $STKRETN. */
+ long stkm_free; /* Number of deallocations by $STKMRET. */
+ long segments; /* Current number of stack segments. */
+ long maxs; /* Maximum number of stack segments so far. */
+ long pad_size; /* Stack pad size. */
+ long current_address; /* Current stack segment address. */
+ long current_size; /* Current stack segment size. This
+ number is actually corrupted by STKSTAT to
+ include the fifteen word trailer area. */
+ long initial_address; /* Address of initial segment. */
+ long initial_size; /* Size of initial segment. */
+ };
+
+/* The following structure describes the data structure which trails
+ any stack segment. I think that the description in 'asdef' is
+ out of date. I only describe the parts that I am sure about. */
+
+struct stk_trailer
+ {
+ long this_address; /* Address of this block. */
+ long this_size; /* Size of this block (does not include
+ this trailer). */
+ long unknown2;
+ long unknown3;
+ long link; /* Address of trailer block of previous
+ segment. */
+ long unknown5;
+ long unknown6;
+ long unknown7;
+ long unknown8;
+ long unknown9;
+ long unknown10;
+ long unknown11;
+ long unknown12;
+ long unknown13;
+ long unknown14;
+ };
+
+#endif /* CRAY2 */
+#endif /* not CRAY_STACK */
+
+#ifdef CRAY2
+/* Determine a "stack measure" for an arbitrary ADDRESS.
+ I doubt that "lint" will like this much. */
+
+static long
+i00afunc (long *address)
+{
+ struct stk_stat status;
+ struct stk_trailer *trailer;
+ long *block, size;
+ long result = 0;
+
+ /* We want to iterate through all of the segments. The first
+ step is to get the stack status structure. We could do this
+ more quickly and more directly, perhaps, by referencing the
+ $LM00 common block, but I know that this works. */
+
+ STKSTAT (&status);
+
+ /* Set up the iteration. */
+
+ trailer = (struct stk_trailer *) (status.current_address
+ + status.current_size
+ - 15);
+
+ /* There must be at least one stack segment. Therefore it is
+ a fatal error if "trailer" is null. */
+
+ if (trailer == 0)
+ abort ();
+
+ /* Discard segments that do not contain our argument address. */
+
+ while (trailer != 0)
+ {
+ block = (long *) trailer->this_address;
+ size = trailer->this_size;
+ if (block == 0 || size == 0)
+ abort ();
+ trailer = (struct stk_trailer *) trailer->link;
+ if ((block <= address) && (address < (block + size)))
+ break;
+ }
+
+ /* Set the result to the offset in this segment and add the sizes
+ of all predecessor segments. */
+
+ result = address - block;
+
+ if (trailer == 0)
+ {
+ return result;
+ }
+
+ do
+ {
+ if (trailer->this_size <= 0)
+ abort ();
+ result += trailer->this_size;
+ trailer = (struct stk_trailer *) trailer->link;
+ }
+ while (trailer != 0);
+
+ /* We are done. Note that if you present a bogus address (one
+ not in any segment), you will get a different number back, formed
+ from subtracting the address of the first block. This is probably
+ not what you want. */
+
+ return (result);
+}
+
+#else /* not CRAY2 */
+/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
+ Determine the number of the cell within the stack,
+ given the address of the cell. The purpose of this
+ routine is to linearize, in some sense, stack addresses
+ for alloca. */
+
+static long
+i00afunc (long address)
+{
+ long stkl = 0;
+
+ long size, pseg, this_segment, stack;
+ long result = 0;
+
+ struct stack_segment_linkage *ssptr;
+
+ /* Register B67 contains the address of the end of the
+ current stack segment. If you (as a subprogram) store
+ your registers on the stack and find that you are past
+ the contents of B67, you have overflowed the segment.
+
+ B67 also points to the stack segment linkage control
+ area, which is what we are really interested in. */
+
+ stkl = CRAY_STACKSEG_END ();
+ ssptr = (struct stack_segment_linkage *) stkl;
+
+ /* If one subtracts 'size' from the end of the segment,
+ one has the address of the first word of the segment.
+
+ If this is not the first segment, 'pseg' will be
+ nonzero. */
+
+ pseg = ssptr->sspseg;
+ size = ssptr->sssize;
+
+ this_segment = stkl - size;
+
+ /* It is possible that calling this routine itself caused
+ a stack overflow. Discard stack segments which do not
+ contain the target address. */
+
+ while (!(this_segment <= address && address <= stkl))
+ {
+#ifdef DEBUG_I00AFUNC
+ fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
+#endif
+ if (pseg == 0)
+ break;
+ stkl = stkl - pseg;
+ ssptr = (struct stack_segment_linkage *) stkl;
+ size = ssptr->sssize;
+ pseg = ssptr->sspseg;
+ this_segment = stkl - size;
+ }
+
+ result = address - this_segment;
+
+ /* If you subtract pseg from the current end of the stack,
+ you get the address of the previous stack segment's end.
+ This seems a little convoluted to me, but I'll bet you save
+ a cycle somewhere. */
+
+ while (pseg != 0)
+ {
+#ifdef DEBUG_I00AFUNC
+ fprintf (stderr, "%011o %011o\n", pseg, size);
+#endif
+ stkl = stkl - pseg;
+ ssptr = (struct stack_segment_linkage *) stkl;
+ size = ssptr->sssize;
+ pseg = ssptr->sspseg;
+ result += size;
+ }
+ return (result);
+}
+
+#endif /* not CRAY2 */
+#endif /* CRAY */
+
+#endif /* no alloca */
+#endif /* not GCC version 2 */
diff --git a/Build/source/texk/web2c/lib/basechsuffix.c b/Build/source/texk/web2c/lib/basechsuffix.c
new file mode 100644
index 00000000000..cd17d5c45ac
--- /dev/null
+++ b/Build/source/texk/web2c/lib/basechsuffix.c
@@ -0,0 +1,43 @@
+/* basechsuffix.c: replace the last bit of a filename with something else.
+
+ Written in 1995 by Karl Berry. Public domain. */
+
+#include <w2c/config.h>
+#include "lib.h"
+
+/* Return the basename of NAME, with trailing characters OLD replaced by
+ NEW. (If last characters in NAME are not OLD, just append NEW.)
+ Since this is used to turn, e.g., foo/cmr10.300pk -> cmr10.300gf,
+ don't assume a `.' preceding OLD or NEW.
+
+ In other words, we're implementing `basename NAME OLD`NEW. */
+
+string
+basenamechangesuffix (const_string name, const_string old_suffix,
+ const_string new_suffix)
+{
+ string answer;
+ unsigned c;
+ const_string base = xbasename (name);
+ unsigned base_len = strlen (base);
+ unsigned copy_limit = base_len;
+ unsigned old_suffix_len = strlen (old_suffix);
+
+ if (old_suffix_len <= base_len) {
+ for (c = 0; c < old_suffix_len; c++) {
+ if (!FILECHARCASEEQ (old_suffix[old_suffix_len - c - 1],
+ base[base_len - c - 1]))
+ break;
+ }
+ if (c == old_suffix_len) {
+ copy_limit -= old_suffix_len;
+ }
+ }
+
+ answer = xmalloc (copy_limit + strlen (new_suffix) + 1);
+ strncpy (answer, base, copy_limit);
+ answer[copy_limit] = 0;
+ strcat (answer, new_suffix);
+
+ return answer;
+}
diff --git a/Build/source/texk/web2c/lib/chartostring.c b/Build/source/texk/web2c/lib/chartostring.c
new file mode 100644
index 00000000000..7b34e694241
--- /dev/null
+++ b/Build/source/texk/web2c/lib/chartostring.c
@@ -0,0 +1,23 @@
+/* chartostring.c: change a character (i.e., an integer) to a
+ one-character string.
+
+Written in 1994 by Karl Berry. Public domain. */
+
+#include <w2c/config.h>
+#include "lib.h"
+
+/* This is needed because web2c turns the Pascal construct 'x' into the
+ C character constant 'x', not the string "x". And we need to keep it
+ that way because that's how xord is initialized, etc. But sometimes
+ we want one-character strings -- e.g., in tangle.ch and weave.ch.
+ There's no real alternative to wasting the two bytes of memory (plus
+ malloc overhead) here, but it doesn't matter. */
+
+string
+chartostring (char ch)
+{
+ string str = xmalloc (2);
+ str[0] = ch;
+ str[1] = 0;
+ return str;
+}
diff --git a/Build/source/texk/web2c/lib/coredump.c b/Build/source/texk/web2c/lib/coredump.c
new file mode 100644
index 00000000000..cf883bf7166
--- /dev/null
+++ b/Build/source/texk/web2c/lib/coredump.c
@@ -0,0 +1,58 @@
+/* coredump.c. Public domain.
+
+ This procedure is due to Chris Torek, chris@umd.edu. It makes a core
+ dump without any sort of error status (abort(2) does return an error
+ status, so we don't want to use that). It is used only when making a
+ preloaded TeX from virtex, and is triggered by a magic file name
+ requested as input (see `open_input', above). Finding a way to
+ reconstitute the core dump into a binary (i.e., with undump) is up to
+ you. Perl has some things to say about these days. */
+
+#include <w2c/config.h>
+
+/* Do not try to compile this Unix-y unportable stuff unless it's needed. */
+
+#ifdef FUNNY_CORE_DUMP
+#include <signal.h>
+#include <sys/wait.h>
+
+void
+funny_core_dump (void)
+{
+#ifdef __EMX__
+ {
+ int handle = open ("core", O_WRONLY | O_CREAT | O_TRUNC | O_BINARY);
+ if (handle >= 0 && _core (handle) == 0)
+ exit (0);
+ (void) write (2, "attempt to dump core failed\n", 28);
+ exit (1);
+ }
+#else /* !__EMX__ */
+ int pid, w;
+ union wait status;
+
+ switch (pid = fork ())
+ {
+ case -1: /* failed */
+ perror ("vfork");
+ exit (-1);
+ /*NOTREACHED*/
+
+ case 0: /* child */
+ (void) signal (SIGQUIT, SIG_DFL);
+ (void) kill (getpid (), SIGQUIT);
+ (void) write (2, "how did we get here?\n", 21);
+ _exit (1);
+ /*NOTREACHED*/
+
+ default: /* parent */
+ while ((w = wait (&status)) != pid && w != -1)
+ ;
+ if (status.w_coredump)
+ exit (0);
+ (void) write (2, "attempt to dump core failed\n", 28);
+ exit (1);
+ }
+#endif /* not __EMX__ */
+}
+#endif /* FUNNY_CORE_DUMP */
diff --git a/Build/source/texk/web2c/lib/eofeoln.c b/Build/source/texk/web2c/lib/eofeoln.c
new file mode 100644
index 00000000000..1930df9051a
--- /dev/null
+++ b/Build/source/texk/web2c/lib/eofeoln.c
@@ -0,0 +1,65 @@
+/* eofeoln.c: implement Pascal's ideas for end-of-file and end-of-line
+ testing. Public domain. */
+
+#include <w2c/config.h>
+#include "lib.h"
+
+/* Return true if we're at the end of FILE, else false. This implements
+ Pascal's `eof' builtin. */
+
+boolean
+eof (FILE *file)
+{
+ register int c;
+
+ /* If FILE doesn't exist, return true. This happens, for example,
+ when a user does `mft foo.mf' -- there's no change file,
+ so we never open it, so we end up calling this with a null pointer. */
+ if (!file)
+ return true;
+
+ /* Maybe we're already at the end? */
+ if (feof (file))
+ return true;
+
+ if ((c = getc (file)) == EOF)
+ return true;
+
+ /* We weren't at the end. Back up. */
+ (void) ungetc (c, file);
+
+ return false;
+}
+
+
+/* Return true on end-of-line in FILE or at the end of FILE, else false. */
+/* Accept both CR and LF as end-of-line. */
+
+boolean
+eoln (FILE *file)
+{
+ register int c;
+
+ if (feof (file))
+ return true;
+
+ c = getc (file);
+
+ if (c != EOF)
+ (void) ungetc (c, file);
+
+ return c == '\n' || c == '\r' || c == EOF;
+}
+
+/* Consume input up and including the first eol encountered. */
+/* Handle CRLF as a single end-of-line. */
+
+void
+readln (FILE *f)
+{
+ int c;
+ while ((c = getc (f)) != '\n' && c != '\r' && c != EOF)
+ ;
+ if (c == '\r' && (c = getc (f)) != '\n' && c != EOF)
+ ungetc (c, f);
+}
diff --git a/Build/source/texk/web2c/lib/fprintreal.c b/Build/source/texk/web2c/lib/fprintreal.c
new file mode 100644
index 00000000000..c65e4b277ff
--- /dev/null
+++ b/Build/source/texk/web2c/lib/fprintreal.c
@@ -0,0 +1,15 @@
+/* fprintreal.c: print the real number R in the Pascal format N:M on the
+ file F. Public domain. */
+
+#include <w2c/config.h>
+#include "lib.h"
+
+void
+fprintreal (FILE *f, double r, int n, int m)
+{
+ char fmt[50]; /* Surely enough, since N and M won't be more than 25
+ digits each! */
+
+ sprintf (fmt, "%%%d.%dlf", n, m);
+ fprintf (f, fmt, r);
+}
diff --git a/Build/source/texk/web2c/lib/input2int.c b/Build/source/texk/web2c/lib/input2int.c
new file mode 100644
index 00000000000..5bd42016b4e
--- /dev/null
+++ b/Build/source/texk/web2c/lib/input2int.c
@@ -0,0 +1,48 @@
+/* input2int.c: read two or three integers from text files. These
+ routines are only used in patgen. Public domain. */
+
+#include <w2c/config.h>
+#include "lib.h"
+
+#ifdef INTEGER_IS_INT
+#define SCAN2INT "%d %d"
+#define SCAN3INT "%d %d %d"
+#else
+#define SCAN2INT "%ld %ld"
+#define SCAN3INT "%ld %ld %ld"
+#endif
+
+/* Read two integers from stdin. */
+
+void
+zinput2ints (integer *a, integer *b)
+{
+ int ch;
+
+ while (scanf (SCAN2INT, a, b) != 2)
+ {
+ while ((ch = getchar ()) != EOF && ch != '\n');
+ if (ch == EOF) return;
+ fprintf (stderr, "Please enter two integers.\n");
+ }
+
+ while ((ch = getchar ()) != EOF && ch != '\n');
+}
+
+
+/* Read three integers from stdin. */
+
+void
+zinput3ints (integer *a, integer *b, integer *c)
+{
+ int ch;
+
+ while (scanf (SCAN3INT, a, b, c) != 3)
+ {
+ while ((ch = getchar ()) != EOF && ch != '\n');
+ if (ch == EOF) return;
+ fprintf (stderr, "Please enter three integers.\n");
+ }
+
+ while ((ch = getchar ()) != EOF && ch != '\n');
+}
diff --git a/Build/source/texk/web2c/lib/inputint.c b/Build/source/texk/web2c/lib/inputint.c
new file mode 100644
index 00000000000..d27bb6a148c
--- /dev/null
+++ b/Build/source/texk/web2c/lib/inputint.c
@@ -0,0 +1,20 @@
+/* inputint.c: read integers from text files. These routines are only
+ used for debugging and such, so perfect error checking isn't
+ necessary. Public domain. */
+
+#include <w2c/config.h>
+#include "lib.h"
+
+/* Read an integer from the file F, reading past the subsequent end of
+ line. */
+
+integer
+inputint (FILE *f)
+{
+ char buffer[MAX_INT_LENGTH]; /* Long enough for anything reasonable. */
+
+ return
+ fgets (buffer, sizeof (buffer), f)
+ ? atoi (buffer)
+ : 0;
+}
diff --git a/Build/source/texk/web2c/lib/lib.h b/Build/source/texk/web2c/lib/lib.h
new file mode 100644
index 00000000000..366af21485a
--- /dev/null
+++ b/Build/source/texk/web2c/lib/lib.h
@@ -0,0 +1,73 @@
+/* lib.h: declare prototypes for functions in lib.a.
+ Public domain. */
+
+#ifndef LIB_LIB_H
+#define LIB_LIB_H
+
+/* basechsuffix.c */
+extern string basenamechangesuffix (const_string, const_string, const_string);
+
+/* chartostring.c */
+extern string chartostring (char);
+
+/* eofeoln.c */
+/*
+ * definition of eof() contradicts corecrt_io.h in Visual Studio 2019.
+ *
+ */
+#if defined(_MSC_VER) && _MSC_VER > 1916
+#define eof(x) myeof(x)
+#endif /* _MSC_VER */
+extern boolean eof (FILE *);
+extern boolean eoln (FILE *);
+extern void readln (FILE *);
+
+/* fprintreal.c */
+extern void fprintreal (FILE *, double, int, int);
+
+/* inputint.c */
+extern integer inputint (FILE *);
+
+/* input2int.c */
+extern void zinput2ints (integer *, integer *);
+extern void zinput3ints (integer *, integer *, integer *);
+
+/* main.c (or win32main.c or texmfmp.c) */
+#ifndef NOT_WEB2C
+/* Only used in Web2C programs and possibly harmful otherwise. */
+extern int argc;
+extern string *argv;
+extern string cmdline (int);
+extern void mainbody (void); /* generated by web2c */
+#endif
+
+/* openclose.c */
+extern boolean open_input (FILE **, int, const_string fopen_mode);
+extern boolean open_output (FILE **, const_string fopen_mode);
+extern boolean open_input_with_dirname (FILE **, int, const char *);
+extern void close_file (FILE *);
+extern void recorder_change_filename (string);
+extern void recorder_record_input (const_string);
+extern void recorder_record_output (const_string);
+
+extern string fullnameoffile;
+extern boolean recorder_enabled;
+extern string output_directory;
+
+/* printversion.c */
+extern void printversionandexit (const_string, const_string, const_string, const_string);
+
+/* setupvar.c */
+/* Set an array size from texmf.cnf. */
+extern void setupboundvariable (integer *, const_string, integer);
+
+/* texmfmp.c */
+extern boolean texmf_yesno(const_string);
+
+/* version.c */
+extern const char *versionstring;
+
+/* zround.c */
+extern integer zround (double);
+
+#endif /* not LIB_LIB_H */
diff --git a/Build/source/texk/web2c/lib/main.c b/Build/source/texk/web2c/lib/main.c
new file mode 100644
index 00000000000..d3f5a45aa43
--- /dev/null
+++ b/Build/source/texk/web2c/lib/main.c
@@ -0,0 +1,45 @@
+/* main.c -- the main program for everything but TeX & MF. */
+/* Public domain. */
+
+#include <w2c/config.h>
+#include "lib.h"
+
+/* These variables are referenced from the change files. */
+char **argv;
+int argc;
+
+/* The entry point for all the programs except TeX and Metafont, which
+ have more to do. We just have to set up the command line. web2c
+ transforms Pascal's main block into a procedure `main_body'. */
+int
+main (int ac, string* av)
+{
+#ifdef __EMX__
+ _wildcard (&ac, &av);
+ _response (&ac, &av);
+#endif
+
+#ifdef WIN32
+ _setmaxstdio(2048);
+#endif
+
+ argc = ac;
+ argv = av;
+ mainbody ();
+ return EXIT_SUCCESS;
+}
+
+
+/* Return the Nth (counted as in C) argument from the command line. */
+
+string
+cmdline (int n)
+{
+ if (n >= argc)
+ { /* This error message should never happen, because the callers
+ should always check they've got the arguments they expect. */
+ fprintf (stderr, "%s: Oops; not enough arguments.\n", argv[0]);
+ uexit (1);
+ }
+ return argv[n];
+}
diff --git a/Build/source/texk/web2c/lib/mfmpi386.asm b/Build/source/texk/web2c/lib/mfmpi386.asm
new file mode 100644
index 00000000000..cc356d5f825
--- /dev/null
+++ b/Build/source/texk/web2c/lib/mfmpi386.asm
@@ -0,0 +1,145 @@
+/* i386 assembly routines for inner loop fraction routines in Metafont
+ and MetaPost. Public domain. Included in texmfmp.c.
+ By Wayne Sullivan <wgs@maths.ucd.ie>. */
+
+asm(".text\n"
+" .align 4\n"
+#ifdef ASM_NEEDS_UNDERSCORE
+".globl _ztakefraction\n"
+"_ztakefraction:\n"
+#else
+".globl ztakefraction\n"
+"ztakefraction:\n"
+#endif
+" pushl %ebp\n"
+" movl %esp,%ebp\n"
+" xorl %ecx,%ecx\n"
+" movl 8(%ebp),%eax\n"
+" cmpl $0x80000000,%eax\n"
+" jz LL5\n"
+" imull 12(%ebp)\n"
+" orl %edx,%edx\n"
+" jns LL2\n"
+" negl %edx\n"
+" negl %eax\n"
+" sbbl %ecx,%edx\n"
+" incl %ecx\n"
+"LL2:\n"
+" addl $0x08000000,%eax\n"
+" adcl $0,%edx\n"
+" cmpl $0x07ffffff,%edx\n"
+" ja LL3\n"
+" shrd $28, %edx,%eax\n"
+"LL1: jecxz LL4\n"
+" negl %eax\n"
+"LL4:\n"
+" movl %ebp,%esp\n"
+" popl %ebp\n"
+" ret\n"
+"LL5: incl %ecx\n"
+"LL3: movl $0x7fffffff,%eax\n"
+#ifdef ASM_NEEDS_UNDERSCORE
+" movb $1,_aritherror\n"
+#else
+" movb $1,aritherror\n"
+#endif
+" jmp LL1\n"
+" .align 4, 0x90\n"
+#ifdef ASM_NEEDS_UNDERSCORE
+".globl _ztakescaled\n"
+"_ztakescaled:\n"
+#else
+".globl ztakescaled\n"
+"ztakescaled:\n"
+#endif
+" pushl %ebp\n"
+" movl %esp,%ebp\n"
+" movl 8(%ebp),%eax\n"
+" xorl %ecx,%ecx\n"
+" cmpl $0x80000000,%eax\n"
+" jz LL5\n"
+" imull 12(%ebp)\n"
+" orl %edx,%edx\n"
+" jns LL12\n"
+" negl %edx\n"
+" negl %eax\n"
+" sbbl %ecx,%edx\n"
+" incl %ecx\n"
+"LL12:\n"
+" addl $0x00008000,%eax\n"
+" adcl $0,%edx\n"
+" cmpl $0x00007fff,%edx\n"
+" ja LL3\n"
+" shrd $16, %edx,%eax\n"
+" jecxz LL4\n"
+" negl %eax\n"
+" jmp LL4\n"
+" .align 4, 0x90\n"
+#ifdef ASM_NEEDS_UNDERSCORE
+".globl _zmakescaled\n"
+".globl _zmakefraction\n"
+"_zmakescaled:\n"
+#else
+".globl zmakescaled\n"
+".globl zmakefraction\n"
+"zmakescaled:\n"
+#endif
+" movb $16,%cl\n"
+" jmp LL30\n"
+" .align 4, 0x90\n"
+#ifdef ASM_NEEDS_UNDERSCORE
+"_zmakefraction:\n"
+#else
+"zmakefraction:\n"
+#endif
+" movb $4,%cl\n"
+"LL30:\n"
+" movb $0,%ch\n"
+" pushl %ebp\n"
+" movl %esp,%ebp\n"
+" pushl %ebx\n"
+" movl 8(%ebp),%edx\n"
+" xorl %eax,%eax\n"
+" orl %edx,%edx\n"
+" jns LL32\n"
+" inc %ch\n"
+" negl %edx\n"
+"LL32:\n"
+" movl 12(%ebp),%ebx\n"
+" orl %ebx,%ebx\n"
+" jns LL33\n"
+" dec %ch\n"
+" negl %ebx\n"
+" orl %ebx,%ebx\n"
+" js LL34\n"
+"LL33:\n"
+" orl %edx,%edx\n"
+" js LL34\n"
+" shrd %cl,%edx,%eax\n"
+" shrl %cl,%edx\n"
+" cmpl %ebx,%edx\n"
+" jae LL34\n"
+" divl %ebx\n"
+" addl %edx,%edx\n"
+" incl %edx\n"
+" subl %edx,%ebx\n"
+" adcl $0,%eax\n"
+" jc LL34\n"
+" cmpl $0x7fffffff,%eax\n"
+" ja LL34\n"
+"LL31: or %ch,%ch\n"
+" jz LL35\n"
+" negl %eax\n"
+"LL35:\n"
+" popl %ebx\n"
+" movl %ebp,%esp\n"
+" popl %ebp\n"
+" ret\n"
+"LL34: movl $0x7fffffff,%eax\n"
+#ifdef ASM_NEEDS_UNDERSCORE
+" movb $1,_aritherror\n"
+#else
+" movb $1,aritherror\n"
+#endif
+" jmp LL31\n");
+
diff --git a/Build/source/texk/web2c/lib/mfmpw32.c b/Build/source/texk/web2c/lib/mfmpw32.c
new file mode 100644
index 00000000000..de065fd96e2
--- /dev/null
+++ b/Build/source/texk/web2c/lib/mfmpw32.c
@@ -0,0 +1,189 @@
+/* i386 assembly routines for inner loop fraction routines in Metafont
+ and MetaPost. Included from texmfmp.c. By Wayne Sullivan
+ <wgs@maths.ucd.ie>. */
+
+/*
+ Converted to inline assembler for Visual C++ [45].xx
+ by Fabrice Popineau <Fabrice.Popineau@supelec.fr> */
+
+__declspec(naked) fraction __stdcall ztakefraction(integer p, integer q) {
+__asm {
+ push ebp
+ mov ebp,esp
+ xor ecx,ecx
+ mov eax, p
+; mov eax, [ebp+8]
+ cmp eax, 0x80000000
+ jz LL5
+ imul q
+ or edx,edx
+ jns LL2
+ neg edx
+ neg eax
+ sbb edx, ecx
+ inc ecx
+LL2:
+ add eax, 0x08000000
+ adc edx, 0
+ cmp edx, 0x07ffffff
+ ja LL3
+ shrd eax,edx,28
+LL1:
+ jecxz LL4
+ neg eax
+LL4:
+ mov esp,ebp
+ pop ebp
+ ret 8
+LL5:
+ inc ecx
+LL3:
+ mov eax, 0x7fffffff
+ mov aritherror, 1
+ jmp LL1
+}
+}
+
+__declspec(naked) integer __stdcall ztakescaled(integer p, scaled q) {
+__asm {
+ push ebp
+ mov ebp,esp
+; mov eax, [ebp+8]
+ xor ecx,ecx
+ mov eax, p
+ cmp eax, 0x80000000
+ jz LL5
+ imul q
+ or edx,edx
+ jns LL12
+ neg edx
+ neg eax
+ sbb edx,ecx
+ inc ecx
+LL12:
+ add eax, 0x00008000
+ adc edx, 0x0
+ cmp edx, 0x00007fff
+ ja LL3
+ shrd eax,edx,16
+LL1:
+ jecxz LL4
+ neg eax
+LL4:
+ mov esp,ebp
+ pop ebp
+ ret 8
+LL5:
+ inc ecx
+LL3:
+ mov eax, 0x7fffffff
+ mov aritherror, 1
+ jmp LL1
+ }
+}
+
+__declspec(naked) scaled __stdcall zmakescaled(integer p, integer q) {
+ __asm {
+ mov cx, 16
+ push ebp
+ mov ebp,esp
+ push ebx
+; mov edx, [ebp+8]
+ mov edx, p
+ xor eax,eax
+ or edx,edx
+ jns LL32
+ inc ch
+ neg edx
+LL32:
+; mov ebx, [ebp+12]
+ mov ebx,q
+ or ebx,ebx
+ jns LL33
+ dec ch
+ neg ebx
+ or ebx,ebx
+ js LL34
+LL33:
+ or edx,edx
+ js LL34
+ shrd eax,edx,cl
+ shr edx,cl
+ cmp edx,ebx
+ jae LL34
+ div ebx
+ add edx,edx
+ inc edx
+ sub ebx,edx
+ adc eax, 0
+ jc LL34
+ cmp eax, 0x7fffffff
+ ja LL34
+LL31: or ch,ch
+ jz LL35
+ neg eax
+LL35:
+ pop ebx
+ mov esp, ebp
+ pop ebp
+ ret 8
+LL34:
+ mov eax, 0x7fffffff
+ mov aritherror, 1
+ jmp LL31
+ }
+}
+
+__declspec(naked) fraction __stdcall zmakefraction(integer p, integer q) {
+ __asm {
+ mov cx, 4
+ push ebp
+ mov ebp,esp
+ push ebx
+ mov edx, p
+; mov [ebp+8],edx
+ xor eax,eax
+ or edx,edx
+ jns LL32
+ inc ch
+ neg edx
+LL32:
+; mov [ebp+12],ebx
+ mov ebx, q
+ or ebx,ebx
+ jns LL33
+ dec ch
+ neg ebx
+ or ebx,ebx
+ js LL34
+LL33:
+ or edx,edx
+ js LL34
+ shrd eax,edx, cl
+ shr edx,cl
+ cmp edx,ebx
+ jae LL34
+ div ebx
+ add edx,edx
+ inc edx
+ sub ebx,edx
+ adc eax, 0
+ jc LL34
+ cmp eax, 0x7fffffff
+ ja LL34
+LL31: or ch,ch
+ jz LL35
+ neg eax
+LL35:
+ pop ebx
+ mov esp, ebp
+ pop ebp
+ ret 8
+LL34:
+ mov eax, 0x7fffffff
+ mov aritherror, 1
+ jmp LL31
+ }
+}
+
+
diff --git a/Build/source/texk/web2c/lib/openclose.c b/Build/source/texk/web2c/lib/openclose.c
new file mode 100644
index 00000000000..63fa0393528
--- /dev/null
+++ b/Build/source/texk/web2c/lib/openclose.c
@@ -0,0 +1,471 @@
+/* openclose.c: open and close files for TeX, Metafont, and BibTeX.
+
+ Written 1995 Karl Berry. Public domain. */
+
+#include <w2c/config.h>
+#include "lib.h"
+#include <kpathsea/c-pathch.h>
+#include <kpathsea/tex-file.h>
+#include <kpathsea/variable.h>
+#include <kpathsea/absolute.h>
+#ifdef PTEX
+#include <ptexenc/ptexenc.h>
+#endif
+
+#ifdef _WIN32
+static int fsyscp_remove(char *s)
+{
+ wchar_t *sw = NULL;
+ int ret;
+
+ if(!file_system_codepage)
+ return remove(s);
+
+ sw = get_wstring_from_fsyscp(s, sw);
+ ret = _wremove(sw);
+ if(sw) free(sw);
+ return ret;
+}
+
+static int fsyscp_rename(char *s1, char *s2)
+{
+ wchar_t *sw1 = NULL, *sw2 = NULL;
+ int ret;
+
+ if(!file_system_codepage)
+ return rename(s1, s2);
+
+ sw1 = get_wstring_from_fsyscp(s1, sw1);
+ sw2 = get_wstring_from_fsyscp(s2, sw2);
+ ret = _wrename(sw1, sw2);
+ if(sw1) free(sw1);
+ if(sw2) free(sw2);
+ return ret;
+}
+
+FILE *f_fsyscp_fopen(const char *filename, const char *mode)
+{
+ if(!file_system_codepage)
+ return fopen(filename, mode);
+
+ return fsyscp_fopen(filename, mode);
+}
+
+FILE *f_fsyscp_xfopen(const char *filename, const char *mode)
+{
+ if(!file_system_codepage)
+ return xfopen(filename, mode);
+
+ return fsyscp_xfopen(filename, mode);
+}
+#undef fopen
+#undef xfopen
+#define fopen f_fsyscp_fopen
+#define xfopen f_fsyscp_xfopen
+#define rename fsyscp_rename
+#define remove fsyscp_remove
+#endif /* _WIN32 */
+
+/* The globals we use to communicate. */
+extern string nameoffile;
+extern unsigned namelength;
+
+/* Define some variables. */
+/* For "file:line:error" style error messages. */
+string fullnameoffile; /* Defaults to NULL. */
+static string recorder_name; /* Defaults to NULL. */
+static FILE *recorder_file; /* Defaults to NULL. */
+/* For the filename recorder. */
+boolean recorder_enabled; /* Defaults to false. */
+/* For the output-dir option. */
+string output_directory; /* Defaults to NULL. */
+
+/* For TeX and MetaPost. See below. Always defined so we don't have to
+ #ifdef, and thus this file can be compiled once and go in lib.a. */
+int tfmtemp;
+int ocptemp;
+int texinputtype;
+
+/* Helpers for the filename recorder... */
+/* Start the recorder */
+static void
+recorder_start(void)
+{
+ /* Alas, while we'd like to use mkstemp it is not portable,
+ and doing the autoconfiscation (and providing fallbacks) is more
+ than we want to cope with. So we have to be content with using a
+ default name. Throw in the pid so at least parallel builds might
+ work (Debian bug 575731). */
+ string cwd;
+ char pid_str[MAX_INT_LENGTH];
+
+ /* Windows (MSVC) seems to have no pid_t, so instead of storing the
+ value returned by getpid() we immediately consume it. */
+ sprintf (pid_str, "%ld", (long) getpid());
+ recorder_name = concat3(kpse_program_name, pid_str, ".fls");
+
+ /* If an output directory was specified, use it instead of cwd. */
+ if (output_directory) {
+ string temp = concat3(output_directory, DIR_SEP_STRING, recorder_name);
+ free(recorder_name);
+ recorder_name = temp;
+ }
+
+ recorder_file = xfopen(recorder_name, FOPEN_W_MODE);
+
+ cwd = xgetcwd();
+ fprintf(recorder_file, "PWD %s\n", cwd);
+ free(cwd);
+}
+
+/* Change the name of the recorder file after we know the log file to
+ the usual thing -- no pid integer and the document file name instead
+ of the program name. Unfortunately, we have to explicitly take
+ -output-directory into account (again), since the NEW_NAME we are
+ called with does not; it is just the log file name with .log replaced
+ by .fls. */
+
+void
+recorder_change_filename (string new_name)
+{
+ string temp = NULL;
+
+ if (!recorder_file)
+ return;
+
+ /* On windows, an opened file cannot be renamed. */
+#if defined(_WIN32)
+ fclose (recorder_file);
+#endif /* _WIN32 */
+
+ /* If an output directory was specified, use it. */
+ if (output_directory) {
+ temp = concat3(output_directory, DIR_SEP_STRING, new_name);
+ new_name = temp;
+ }
+
+ /* On windows, renaming fails if a file with new_name exists. */
+#if defined(_WIN32)
+ remove (new_name);
+#endif /* _WIN32 */
+
+ rename(recorder_name, new_name);
+ free(recorder_name);
+ recorder_name = xstrdup(new_name);
+
+ /* reopen the recorder file by FOPEN_A_MODE. */
+#if defined(_WIN32)
+ recorder_file = xfopen (recorder_name, FOPEN_A_MODE);
+#endif /* _WIN32 */
+
+ if (temp)
+ free (temp);
+}
+
+/* helper for recorder_record_* */
+static void
+recorder_record_name (const_string prefix, const_string name)
+{
+ if (recorder_enabled) {
+ if (!recorder_file)
+ recorder_start();
+ fprintf(recorder_file, "%s %s\n", prefix, name);
+ fflush(recorder_file);
+ }
+}
+
+/* record an input file name */
+void
+recorder_record_input (const_string name)
+{
+ recorder_record_name ("INPUT", name);
+}
+
+/* record an output file name */
+void
+recorder_record_output (const_string name)
+{
+ recorder_record_name ("OUTPUT", name);
+}
+
+/* Open input file *F_PTR, using the kpathsea format FILEFMT and passing
+ FOPEN_MODE to fopen. The filename is in `nameoffile+1'. We return
+ whether or not the open succeeded. If it did, `nameoffile' is set to
+ the full filename opened, and `namelength' to its length. */
+
+boolean
+open_input (FILE **f_ptr, int filefmt, const_string fopen_mode)
+{
+ string fname = NULL;
+#if defined(PTEX) && !defined(WIN32)
+ string fname0;
+#endif
+#ifdef FUNNY_CORE_DUMP
+ /* This only applies if a preloaded TeX/Metafont is being made;
+ it allows automatic creation of the core dump (typing ^\ loses
+ since that requires manual intervention). */
+ if ((filefmt == kpse_tex_format || filefmt == kpse_mf_format
+ || filefmt == kpse_mp_format)
+ && STREQ (nameoffile + 1, "HackyInputFileNameForCoreDump.tex"))
+ funny_core_dump ();
+#endif
+
+ /* We havent found anything yet. */
+ *f_ptr = NULL;
+ if (fullnameoffile)
+ free(fullnameoffile);
+ fullnameoffile = NULL;
+
+ /* Look in -output-directory first, if the filename is not
+ absolute. This is because .aux and other such files will get
+ written to the output directory, and we have to be able to read
+ them from there. We only look for the name as-is. */
+
+#if defined(PTEX) && !defined(WIN32)
+ fname0 = ptenc_from_internal_enc_string_to_utf8(nameoffile + 1);
+ if (fname0) {
+ free (nameoffile);
+ namelength = strlen (fname0);
+ nameoffile = xmalloc (namelength + 2);
+ strcpy (nameoffile + 1, fname0);
+ free (fname0);
+ }
+#endif
+ if (output_directory && !kpse_absolute_p (nameoffile+1, false)) {
+ fname = concat3 (output_directory, DIR_SEP_STRING, nameoffile + 1);
+ *f_ptr = fopen (fname, fopen_mode);
+#if !defined(_WIN32)
+/*
+ if fname is a directory, discard it.
+*/
+ if (*f_ptr && dir_p (fname)) {
+ fclose (*f_ptr);
+ *f_ptr = NULL;
+ }
+#endif
+ if (*f_ptr) {
+#if defined(PTEX) && !defined(WIN32)
+ fname0 = ptenc_from_utf8_string_to_internal_enc(fname);
+ if (fname0) {
+ free (fname);
+ fname = fname0;
+ }
+#endif
+ free (nameoffile);
+ namelength = strlen (fname);
+ nameoffile = xmalloc (namelength + 2);
+ strcpy (nameoffile + 1, fname);
+ fullnameoffile = fname;
+ } else {
+ free (fname);
+ }
+ }
+
+ /* No file means do the normal search. */
+ if (*f_ptr == NULL) {
+ /* A negative FILEFMT means don't use a path. */
+ if (filefmt < 0) {
+ /* no_file_path, for BibTeX .aux files and MetaPost things. */
+ *f_ptr = fopen(nameoffile + 1, fopen_mode);
+ /* FIXME... fullnameoffile = xstrdup(nameoffile + 1); */
+ } else {
+ /* The only exception to `must_exist' being true is \openin, for
+ which we set `tex_input_type' to 0 in the change file. */
+ /* According to the pdfTeX people, pounding the disk for .vf files
+ is overkill as well. A more general solution would be nice. */
+ boolean must_exist;
+ must_exist = (filefmt != kpse_tex_format || texinputtype)
+ && (filefmt != kpse_vf_format);
+ fname = kpse_find_file (nameoffile + 1,
+ (kpse_file_format_type)filefmt,
+ must_exist);
+ if (fname) {
+ fullnameoffile = xstrdup(fname);
+ /* If we found the file in the current directory, don't leave
+ the `./' at the beginning of `nameoffile', since it looks
+ dumb when `tex foo' says `(./foo.tex ... )'. On the other
+ hand, if the user said `tex ./foo', and that's what we
+ opened, then keep it -- the user specified it, so we
+ shouldn't remove it. */
+ if (fname[0] == '.' && IS_DIR_SEP (fname[1])
+ && (nameoffile[1] != '.' || !IS_DIR_SEP (nameoffile[2])))
+ {
+ unsigned i = 0;
+ while (fname[i + 2] != 0) {
+ fname[i] = fname[i + 2];
+ i++;
+ }
+ fname[i] = 0;
+ }
+
+ /* This fopen is not allowed to fail. */
+#if defined(PTEX) && !defined(WIN32)
+ if (filefmt == kpse_tex_format ||
+ filefmt == kpse_bib_format) {
+ *f_ptr = nkf_open (fname, fopen_mode);
+ } else
+#endif
+ *f_ptr = xfopen (fname, fopen_mode);
+
+ /* kpse_find_file always returns a new string. */
+#if defined(PTEX) && !defined(WIN32)
+ fname0 = ptenc_from_utf8_string_to_internal_enc(fname);
+ if (fname0) {
+ free (fname);
+ fname = fname0;
+ }
+#endif
+ free (nameoffile);
+ namelength = strlen (fname);
+ nameoffile = xmalloc (namelength + 2);
+ strcpy (nameoffile + 1, fname);
+ free (fname);
+ }
+ }
+ }
+
+ if (*f_ptr) {
+ recorder_record_input (nameoffile + 1);
+
+ /* If we just opened a TFM file, we have to read the first
+ byte, to pretend we're Pascal. See tex.ch and mp.ch.
+ Ditto for the ocp/ofm Omega file formats. */
+ if (filefmt == kpse_tfm_format) {
+ tfmtemp = getc (*f_ptr);
+ /* We intentionally do not check for EOF here, i.e., an
+ empty TFM file. TeX will see the 255 byte and complain
+ about a bad TFM file, which is what we want. */
+ } else if (filefmt == kpse_ocp_format) {
+ ocptemp = getc (*f_ptr);
+ } else if (filefmt == kpse_ofm_format) {
+ tfmtemp = getc (*f_ptr);
+ }
+ }
+
+ return *f_ptr != NULL;
+}
+
+
+/* Open input file *F_PTR (of type FILEFMT), prepending the directory
+ part of the string FNAME to `nameoffile'+1, unless that is already
+ kpse_absolute_p. This is called from BibTeX, to open subsidiary .aux
+ files, with FNAME set to the top-level aux file. The idea is that if
+ we're invoked as bibtex somedir/foo.aux, and foo.aux has an
+ \@input{bar} statement, we should look for somedir/bar.aux too. (See
+ bibtex-auxinclude.test.) */
+
+boolean
+open_input_with_dirname (FILE **f_ptr, int filefmt, const char *fname)
+{
+ boolean ret = false;
+ char *top_dir = xdirname (fname);
+
+ if (top_dir && *top_dir && !STREQ (top_dir, ".")
+ && !kpse_absolute_p (nameoffile+1, true)) {
+ char *newname = concat3 (top_dir, DIR_SEP_STRING, nameoffile+1);
+ free (nameoffile);
+ nameoffile = xmalloc (strlen (newname) + 2);
+ strcpy (nameoffile + 1, newname);
+ ret = open_input (f_ptr, filefmt, FOPEN_RBIN_MODE);
+ free (newname);
+ }
+
+ free (top_dir);
+ return ret;
+}
+
+
+/* Open an output file F either in the current directory or in
+ $TEXMFOUTPUT/F, if the environment variable `TEXMFOUTPUT' exists.
+ (Actually, this also applies to the BibTeX and MetaPost output files,
+ but `TEXMFMPBIBOUTPUT' was just too long.) The filename is in the
+ global `nameoffile' + 1. We return whether or not the open
+ succeeded. If it did, `nameoffile' is reset to the name opened if
+ necessary, and `namelength' to its length. */
+
+boolean
+open_output (FILE **f_ptr, const_string fopen_mode)
+{
+ string fname;
+#if defined(PTEX) && !defined(WIN32)
+ string fname0;
+#endif
+ boolean absolute = kpse_absolute_p(nameoffile+1, false);
+
+ /* If we have an explicit output directory, use it. */
+ if (output_directory && !absolute) {
+ fname = concat3(output_directory, DIR_SEP_STRING, nameoffile + 1);
+ } else {
+ fname = nameoffile + 1;
+ }
+#if defined(PTEX) && !defined(WIN32)
+ fname0 = ptenc_from_internal_enc_string_to_utf8(fname);
+ if (fname0) {
+ if (fname != nameoffile + 1) free(fname);
+ fname = fname0;
+ }
+#endif
+
+ /* Is the filename openable as given? */
+ *f_ptr = fopen (fname, fopen_mode);
+
+ if (!*f_ptr) {
+ /* Can't open as given. Try the envvar. */
+ string texmfoutput = kpse_var_value("TEXMFOUTPUT");
+
+ if (texmfoutput && *texmfoutput && !absolute) {
+ if (fname != nameoffile + 1)
+ free(fname);
+ fname = concat3(texmfoutput, DIR_SEP_STRING, nameoffile+1);
+ *f_ptr = fopen(fname, fopen_mode);
+ }
+ }
+ /* If this succeeded, change nameoffile accordingly. */
+ if (*f_ptr) {
+ if (fname != nameoffile + 1) {
+#if defined(PTEX) && !defined(WIN32)
+ fname0 = ptenc_from_utf8_string_to_internal_enc(fname);
+ if (fname0) {
+ free(fname);
+ fname = fname0;
+ }
+#endif
+ free (nameoffile);
+ namelength = strlen (fname);
+ nameoffile = xmalloc (namelength + 2);
+ strcpy (nameoffile + 1, fname);
+ }
+ recorder_record_output (fname);
+ }
+ if (fname != nameoffile +1)
+ free(fname);
+ return *f_ptr != NULL;
+}
+
+/* Close F. */
+
+void
+close_file (FILE *f)
+{
+ /* If F is null, just return. bad_pool might close a file that has
+ never been opened. */
+ if (!f)
+ return;
+
+#ifdef PTEX
+#ifdef WIN32
+ clear_infile_enc (f);
+ if (fclose (f) == EOF) {
+#else
+ if (nkf_close (f) == EOF) {
+#endif
+#else
+ if (fclose (f) == EOF) {
+#endif
+ /* It's not always nameoffile, we might have opened something else
+ in the meantime. And it's not easy to extract the filenames out
+ of the pool array. So just punt on the filename. Sigh. This
+ probably doesn't need to be a fatal error. */
+ perror ("fclose");
+ }
+}
diff --git a/Build/source/texk/web2c/lib/printversion.c b/Build/source/texk/web2c/lib/printversion.c
new file mode 100644
index 00000000000..8716e6db994
--- /dev/null
+++ b/Build/source/texk/web2c/lib/printversion.c
@@ -0,0 +1,78 @@
+/* printversion.c: Output for the standard GNU option --version.
+
+ Written in 1996 by Karl Berry. Public domain. */
+
+#include <w2c/config.h>
+#include "lib.h"
+#include <kpathsea/version.h>
+#ifdef PTEX
+#include <ptexenc/ptexenc.h>
+#endif
+
+/* We're passed in the original WEB banner string, which has the form
+This is PROGRAM, Version VERSION-NUMBER
+ We parse the PROGRAM and VERSION-NUMBER out of this.
+
+ If COPYRIGHT_HOLDER is specified and AUTHOR isn't, then use the
+ former for the latter. If AUTHOR is specified and COPYRIGHT_HOLDER
+ isn't, it means the original program is public domain.
+
+ Maybe I should have just done it all inline in each individual
+ program, but tangle doesn't allow multiline string constants ... */
+
+void
+printversionandexit (const_string banner,
+ const_string copyright_holder,
+ const_string author,
+ const_string extra_info)
+{
+ string prog_name;
+ unsigned len;
+ const_string prog_name_start;
+ const_string prog_name_end = strchr (banner, ',');
+ const_string prog_version = strrchr (banner, ' ');
+ assert (prog_name_end && prog_version);
+ prog_version++;
+
+ len = prog_name_end - banner;
+ prog_name = xmalloc (len + 1);
+ strncpy (prog_name, banner, len);
+ prog_name[len] = 0;
+
+ prog_name_start = strrchr (prog_name, ' ');
+ assert (prog_name_start);
+ prog_name_start++;
+
+ /* The Web2c version string starts with a space. */
+#ifdef PTEX
+ printf ("%s %s (%s)%s\n", prog_name_start, prog_version, get_enc_string(),
+ versionstring);
+#else
+ printf ("%s %s%s\n", prog_name_start, prog_version, versionstring);
+#endif
+ puts (kpathsea_version_string);
+#ifdef PTEX
+ puts (ptexenc_version_string);
+#endif
+
+ if (copyright_holder) {
+ printf ("Copyright 2021 %s.\n", copyright_holder);
+ if (!author)
+ author = copyright_holder;
+ }
+
+ puts ("There is NO warranty. Redistribution of this software is");
+ fputs ("covered by the terms of ", stdout);
+ printf ("both the %s copyright and\n", prog_name_start);
+ puts ("the Lesser GNU General Public License.");
+ puts ("For more information about these matters, see the file");
+ printf ("named COPYING and the %s source.\n", prog_name_start);
+ printf ("Primary author of %s: %s.\n", prog_name_start, author);
+
+ if (extra_info)
+ fputs (extra_info, stdout);
+
+ free (prog_name);
+
+ uexit (0);
+}
diff --git a/Build/source/texk/web2c/lib/setupvar.c b/Build/source/texk/web2c/lib/setupvar.c
new file mode 100644
index 00000000000..b44ddc7e71c
--- /dev/null
+++ b/Build/source/texk/web2c/lib/setupvar.c
@@ -0,0 +1,33 @@
+/* setupvar.c: Look up a value in texmf.cnf or use default.
+
+ Adapted in 2010 by Peter Breitenlohner. Public domain.
+ Written in 1995 by Karl Berry. Public domain. */
+
+#include <w2c/config.h>
+#include "lib.h"
+#include <kpathsea/variable.h>
+
+/* Look up VAR_NAME in texmf.cnf; assign either the value found there or
+ DFLT to *VAR. */
+
+void
+setupboundvariable (integer *var, const_string var_name, integer dflt)
+{
+ string expansion = kpse_var_value (var_name);
+ *var = dflt;
+
+ if (expansion) {
+ integer conf_val = atoi (expansion);
+ /* It's ok if the cnf file specifies 0 for extra_mem_{top,bot}, etc.
+ But negative numbers are always wrong. */
+ if (conf_val < 0 || (conf_val == 0 && dflt > 0)) {
+ fprintf (stderr,
+ "%s: Bad value (%ld) in environment or texmf.cnf for %s, keeping %ld.\n",
+ kpse_invocation_name,
+ (long) conf_val, var_name, (long) dflt);
+ } else {
+ *var = conf_val; /* We'll make further checks later. */
+ }
+ free (expansion);
+ }
+}
diff --git a/Build/source/texk/web2c/lib/texmfmp.c b/Build/source/texk/web2c/lib/texmfmp.c
new file mode 100644
index 00000000000..8b898176e8a
--- /dev/null
+++ b/Build/source/texk/web2c/lib/texmfmp.c
@@ -0,0 +1,4036 @@
+/* texmfmp.c: Hand-coded routines for TeX or Metafont in C. Originally
+ written by Tim Morgan, drawing from other Unix ports of TeX. This is
+ a collection of miscellany, everything that's easier (or only
+ possible) to do in C.
+
+ This file is public domain. */
+
+/* This file is included from, e.g., texextra.c after
+ #define EXTERN
+ #include <texd.h>
+ to instantiate data from texd.h here. The ?d.h file is what
+ #defines TeX or MF, which avoids the need for a special
+ Makefile rule. */
+
+#include <kpathsea/config.h>
+#include <kpathsea/c-ctype.h>
+#include <kpathsea/cnf.h>
+#include <kpathsea/line.h>
+#include <kpathsea/readable.h>
+#include <kpathsea/variable.h>
+#include <kpathsea/absolute.h>
+#ifdef WIN32
+#include <kpathsea/concatn.h>
+#endif
+
+#if defined (HAVE_SYS_TIME_H)
+#include <sys/time.h>
+#elif defined (HAVE_SYS_TIMEB_H)
+#include <sys/timeb.h>
+#endif
+#include <time.h> /* For `struct tm'. Moved here for Visual Studio 2005. */
+
+#if defined(__STDC__)
+#include <locale.h>
+#endif
+
+#include <signal.h> /* Catch interrupts. */
+
+#include <texmfmp-help.h>
+
+/* {tex,mf}d.h defines TeX, MF, INI, and other such symbols.
+ Unfortunately there's no way to get the banner into this code, so
+ just repeat the text. */
+/* We also define predicates, e.g., IS_eTeX for all e-TeX like engines, so
+ the rest of this file can remain unchanged when adding a new engine. */
+#ifdef TeX
+#if defined(XeTeX)
+#define IS_eTeX 1
+#include <xetexdir/xetexextra.h>
+#elif defined (eTeX)
+#define IS_eTeX 1
+#include <etexdir/etexextra.h>
+#elif defined (pdfTeX)
+#define IS_eTeX 1
+#include <pdftexdir/pdftexextra.h>
+#include <pdftexdir/ptexlib.h>
+#elif defined (Aleph)
+#define IS_eTeX 1
+#include <alephdir/alephextra.h>
+#elif defined (pTeX)
+#define IS_pTeX 1
+#include <ptexdir/ptexextra.h>
+#elif defined (epTeX)
+#define IS_eTeX 1
+#define IS_pTeX 1
+#include <eptexdir/eptexextra.h>
+#elif defined (upTeX)
+#define IS_pTeX 1
+#define IS_upTeX 1
+#include <uptexdir/uptexextra.h>
+#elif defined (eupTeX)
+#define IS_eTeX 1
+#define IS_pTeX 1
+#define IS_upTeX 1
+#include <euptexdir/euptexextra.h>
+#else
+#define BANNER "This is TeX, Version 3.141592653"
+#define COPYRIGHT_HOLDER "D.E. Knuth"
+#define AUTHOR NULL
+#define PROGRAM_HELP TEXHELP
+#define BUG_ADDRESS "tex-k@tug.org"
+#define DUMP_VAR TEXformatdefault
+#define DUMP_LENGTH_VAR formatdefaultlength
+#define DUMP_OPTION "fmt"
+#define DUMP_EXT ".fmt"
+#define INPUT_FORMAT kpse_tex_format
+#define INI_PROGRAM "initex"
+#define VIR_PROGRAM "virtex"
+#endif
+#define edit_var "TEXEDIT"
+#endif /* TeX */
+#ifdef MF
+#if defined(MFLua)
+#include <mfluadir/mfluaextra.h>
+#elif defined(MFLuaJIT)
+#include <mfluajitdir/mfluajitextra.h>
+#else
+#define BANNER "This is Metafont, Version 2.71828182"
+#define COPYRIGHT_HOLDER "D.E. Knuth"
+#define AUTHOR NULL
+#define PROGRAM_HELP MFHELP
+#define BUG_ADDRESS "tex-k@tug.org"
+#define DUMP_VAR MFbasedefault
+#define DUMP_LENGTH_VAR basedefaultlength
+#define DUMP_OPTION "base"
+#ifdef DOS
+#define DUMP_EXT ".bas"
+#else
+#define DUMP_EXT ".base"
+#endif
+#define INPUT_FORMAT kpse_mf_format
+#define INI_PROGRAM "inimf"
+#define VIR_PROGRAM "virmf"
+#endif
+#define edit_var "MFEDIT"
+#endif /* MF */
+
+#if !defined(IS_eTeX)
+# define IS_eTeX 0
+#endif
+#if !defined(IS_pTeX)
+# define IS_pTeX 0
+#endif
+#if !defined(IS_upTeX)
+# define IS_upTeX 0
+#endif
+
+#if defined(__SyncTeX__)
+/*
+ SyncTeX file name should be full path in the case where
+ --output-directory option is given.
+ Borrowed from LuaTeX.
+*/
+#if defined(_WIN32)
+#if defined(pdfTeX) || defined(upTeX) || defined(eupTeX) || defined(XeTeX)
+#define W32USYNCTEX 1
+#endif
+#endif
+
+char *
+generic_synctex_get_current_name (void)
+{
+ char *pwdbuf, *ret;
+#if defined(W32USYNCTEX)
+ wchar_t *wpwd;
+#endif /* W32USYNCTEX */
+ if (!fullnameoffile) {
+ ret = xstrdup("");
+ return ret;
+ }
+ if (kpse_absolute_p(fullnameoffile, false)) {
+ return xstrdup(fullnameoffile);
+ }
+ pwdbuf = xgetcwd();
+#if defined(W32USYNCTEX)
+ if (file_system_codepage != 0 && file_system_codepage != win32_codepage) {
+ wpwd = get_wstring_from_mbstring(win32_codepage, pwdbuf, wpwd=NULL);
+ free (pwdbuf);
+ pwdbuf = get_mbstring_from_wstring(file_system_codepage, wpwd, pwdbuf=NULL);
+ free (wpwd);
+ }
+#endif /* W32USYNCTEX */
+ ret = concat3(pwdbuf, DIR_SEP_STRING, fullnameoffile);
+ free(pwdbuf) ;
+ return ret;
+}
+#endif
+
+#ifdef _WIN32
+#if !IS_pTeX
+FILE *Poptr;
+#endif
+#undef fopen
+#undef xfopen
+#define fopen fsyscp_fopen
+#define xfopen fsyscp_xfopen
+#include <wchar.h>
+int
+fsyscp_stat(const char *path, struct stat *buffer)
+{
+ wchar_t *wpath;
+ int ret;
+ wpath = get_wstring_from_mbstring(file_system_codepage,
+ path, wpath = NULL);
+ if (wpath == NULL)
+ return -1;
+ ret = _wstat(wpath, buffer);
+ free(wpath);
+ return ret;
+}
+#include <sys/stat.h>
+int
+fsyscp_dir_p(char *path)
+{
+ struct stat stats;
+ int ret;
+
+ ret = fsyscp_stat(path, &stats) == 0 && S_ISDIR (stats.st_mode);
+ return ret;
+}
+int
+fsyscp_access(const char *path, int mode)
+{
+ wchar_t *wpath;
+ int ret;
+ wpath = get_wstring_from_mbstring(file_system_codepage,
+ path, wpath = NULL);
+ if (wpath == NULL)
+ return -1;
+ ret = _waccess(wpath, mode);
+ free(wpath);
+ return ret;
+}
+#endif /* _WIN32 */
+
+#if defined(TeX) || (defined(MF) && defined(WIN32))
+static int
+Isspace (char c)
+{
+ return (c == ' ' || c == '\t');
+}
+#endif /* TeX || (MF && WIN32) */
+
+#ifdef TeX
+
+/* Shell escape.
+
+ If shellenabledp == 0, all shell escapes are forbidden.
+ If (shellenabledp == 1 && restrictedshell == 0), any command
+ is allowed for a shell escape.
+ If (shellenabledp == 1 && restrictedshell == 1), only commands
+ given in the configuration file as
+ shell_escape_commands = kpsewhich,ebb,extractbb,mpost,metafun,...
+ (no spaces between commands) in texmf.cnf are allowed for a shell
+ escape in a restricted form: command name and arguments should be
+ separated by a white space. The first word should be a command
+ name. The quotation character for an argument with spaces,
+ including a pathname, should be ". ' should not be used.
+
+ Internally, all arguments are quoted by ' (Unix) or " (Windows)
+ before calling the system() function in order to forbid execution
+ of any embedded command.
+
+ If the --shell-escape option is given, we set
+ shellenabledp = 1 and restrictedshell = 0, i.e., any command is allowed.
+ If the --shell-restricted option is given, we set
+ shellenabledp = 1 and restrictedshell = 1, i.e., only given cmds allowed.
+ If the --no-shell-escape option is given, we set
+ shellenabledp = -1 (and restrictedshell is irrelevant).
+ If none of these option are given, there are three cases:
+ (1) In the case where
+ shell_escape = y or
+ shell_escape = t or
+ shell_escape = 1
+ it becomes shellenabledp = 1 and restrictedshell = 0,
+ that is, any command is allowed.
+ (2) In the case where
+ shell_escape = p
+ it becomes shellenabledp = 1 and restrictedshell = 1,
+ that is, restricted shell escape is allowed.
+ (3) In all other cases, shellenabledp = 0, that is, shell
+ escape is forbidden. The value of restrictedshell is
+ irrelevant if shellenabledp == 0.
+*/
+
+/* cmdlist is a list of allowed commands which are given like this:
+ shell_escape_commands = kpsewhich,ebb,extractbb,mpost,metafun
+ in texmf.cnf. */
+
+static char **cmdlist = NULL;
+
+static void
+mk_shellcmdlist (char *v)
+{
+ char **p;
+ char *q, *r;
+ size_t n;
+
+ q = v;
+ n = 1;
+
+/* analyze the variable shell_escape_commands = foo,bar,...
+ spaces before and after (,) are not allowed. */
+
+ while ((r = strchr (q, ',')) != 0) {
+ n++;
+ q = r + 1;
+ }
+ if (*q)
+ n++;
+ cmdlist = xmalloc (n * sizeof (char *));
+ p = cmdlist;
+ q = v;
+ while ((r = strchr (q, ',')) != 0) {
+ *r = '\0';
+ *p++ = xstrdup (q);
+ q = r + 1;
+ }
+ if (*q)
+ *p++ = xstrdup (q);
+ *p = NULL;
+}
+
+static void
+init_shell_escape (void)
+{
+ if (shellenabledp < 0) { /* --no-shell-escape on cmd line */
+ shellenabledp = 0;
+
+ } else {
+ if (shellenabledp == 0) { /* no shell options on cmd line, check cnf */
+ char *v1 = kpse_var_value ("shell_escape");
+ if (v1) {
+ if (*v1 == 't' || *v1 == 'y' || *v1 == '1') {
+ shellenabledp = 1;
+ } else if (*v1 == 'p') {
+ shellenabledp = 1;
+ restrictedshell = 1;
+ }
+ free (v1);
+ }
+ }
+
+ /* If shell escapes are restricted, get allowed cmds from cnf. */
+ if (shellenabledp && restrictedshell == 1) {
+ char *v2 = kpse_var_value ("shell_escape_commands");
+ if (v2) {
+ mk_shellcmdlist (v2);
+ free (v2);
+ }
+ }
+ }
+}
+
+#ifdef WIN32
+#define QUOTE '"'
+#else
+#define QUOTE '\''
+#endif
+
+#if 0
+#ifdef WIN32
+static int
+char_needs_quote (int c)
+{
+/* special characters of cmd.exe */
+
+ return (c == '&' || c == '|' || c == '%' || c == '<' ||
+ c == '>' || c == ';' || c == ',' || c == '(' ||
+ c == ')');
+}
+#endif
+#endif
+
+/* return values:
+ -1 : invalid quotation of an argument
+ 0 : command is not allowed
+ 2 : restricted shell escape, CMD is allowed.
+
+ We set *SAFECMD to a safely-quoted version of *CMD; this is what
+ should get executed. And we set CMDNAME to its first word; this is
+ what is checked against the shell_escape_commands list. */
+
+static int
+shell_cmd_is_allowed (const char *cmd, char **safecmd, char **cmdname)
+{
+ char **p;
+ char *buf;
+ char *c, *d;
+ const char *s;
+ int pre, spaces;
+ int allow = 0;
+
+ /* pre == 1 means that the previous character is a white space
+ pre == 0 means that the previous character is not a white space */
+ buf = xmalloc (strlen (cmd) + 1);
+ strcpy (buf, cmd);
+ c = buf;
+ while (Isspace (*c))
+ c++;
+ d = c;
+ while (!Isspace(*d) && *d)
+ d++;
+ *d = '\0';
+
+ /* *cmdname is the first word of the command line. For example,
+ *cmdname == "kpsewhich" for
+ \write18{kpsewhich --progname=dvipdfm --format="other text files" config}
+ */
+ *cmdname = xstrdup (c);
+ free (buf);
+
+ /* Is *cmdname listed in a texmf.cnf vriable as
+ shell_escape_commands = foo,bar,... ? */
+ p = cmdlist;
+ if (p) {
+ while (*p) {
+ if (strcmp (*p, *cmdname) == 0) {
+ /* *cmdname is found in the list, so restricted shell escape
+ is allowed */
+ allow = 2;
+ break;
+ }
+ p++;
+ }
+ }
+ if (allow == 2) {
+ spaces = 0;
+ for (s = cmd; *s; s++) {
+ if (Isspace (*s))
+ spaces++;
+ }
+
+ /* allocate enough memory (too much?) */
+#ifdef WIN32
+ *safecmd = xmalloc (2 * strlen (cmd) + 3 + 2 * spaces);
+#else
+ *safecmd = xmalloc (strlen (cmd) + 3 + 2 * spaces);
+#endif
+
+ /* make a safe command line *safecmd */
+ s = cmd;
+ while (Isspace (*s))
+ s++;
+ d = *safecmd;
+ while (!Isspace (*s) && *s)
+ *d++ = *s++;
+
+ pre = 1;
+ while (*s) {
+ /* Quotation given by a user. " should always be used; we
+ transform it below. If ' is used, simply immediately
+ return a quotation error. */
+ if (*s == '\'') {
+ return -1;
+ }
+
+ if (*s == '"') {
+ /* All arguments are quoted as 'foo' (Unix) or "foo" (Windows)
+ before calling system(). Therefore closing QUOTE is necessary
+ if the previous character is not a white space.
+ example:
+ --format="other text files" becomes
+ '--format=''other text files' (Unix)
+ "--format"="other text files" (Windows) */
+
+ if (pre == 0) {
+#ifdef WIN32
+ if (*(s-1) == '=') {
+ *(d-1) = QUOTE;
+ *d++ = '=';
+ } else {
+ *d++ = QUOTE;
+ }
+#else
+ *d++ = QUOTE;
+#endif
+ }
+ pre = 0;
+ /* output the quotation mark for the quoted argument */
+ *d++ = QUOTE;
+ s++;
+
+ while (*s != '"') {
+ /* Illegal use of ', or closing quotation mark is missing */
+ if (*s == '\'' || *s == '\0')
+ return -1;
+#if 0
+/*
+ The following in WIN32 may not be necessary, because
+ all arguments are quoted.
+*/
+#ifdef WIN32
+ if (char_needs_quote (*s))
+ *d++ = '^';
+#endif
+#endif
+ *d++ = *s++;
+ }
+
+ /* Closing quotation mark will be output afterwards, so
+ we do nothing here */
+ s++;
+
+ /* The character after the closing quotation mark
+ should be a white space or NULL */
+ if (!Isspace (*s) && *s)
+ return -1;
+
+ /* Beginning of a usual argument */
+ } else if (pre == 1 && !Isspace (*s)) {
+ pre = 0;
+ *d++ = QUOTE;
+#if 0
+/*
+ The following in WIN32 may not be necessary, because
+ all arguments are quoted.
+*/
+#ifdef WIN32
+ if (char_needs_quote (*s))
+ *d++ = '^';
+#endif
+#endif
+ *d++ = *s++;
+ /* Ending of a usual argument */
+
+ } else if (pre == 0 && Isspace (*s)) {
+ pre = 1;
+ /* Closing quotation mark */
+ *d++ = QUOTE;
+ *d++ = *s++;
+ } else {
+ /* Copy a character from cmd to *safecmd. */
+#if 0
+/*
+ The following in WIN32 may not be necessary, because
+ all arguments are quoted.
+*/
+#ifdef WIN32
+ if (char_needs_quote (*s))
+ *d++ = '^';
+#endif
+#endif
+ *d++ = *s++;
+ }
+ }
+ /* End of the command line */
+ if (pre == 0) {
+ *d++ = QUOTE;
+ }
+ *d = '\0';
+#ifdef WIN32
+ {
+ char *p, *q, *r;
+ p = *safecmd;
+ if (strlen (p) > 2 && p[1] == ':' && !IS_DIR_SEP (p[2])) {
+ q = xmalloc (strlen (p) + 2);
+ q[0] = p[0];
+ q[1] = p[1];
+ q[2] = '/';
+ q[3] = '\0';
+ strcat (q, (p + 2));
+ free (*safecmd);
+ *safecmd = q;
+ } else if (!IS_DIR_SEP (p[0]) && !(p[1] == ':' && IS_DIR_SEP (p[2]))) {
+ p = kpse_var_value ("SELFAUTOLOC");
+ if (p) {
+ r = *safecmd;
+ while (*r && !Isspace(*r))
+ r++;
+ if (*r == '\0')
+ q = concatn ("\"", p, "/", *safecmd, "\"", NULL);
+ else {
+ *r = '\0';
+ r++;
+ while (*r && Isspace(*r))
+ r++;
+ if (*r)
+ q = concatn ("\"", p, "/", *safecmd, "\" ", r, NULL);
+ else
+ q = concatn ("\"", p, "/", *safecmd, "\"", NULL);
+ }
+ free (p);
+ free (*safecmd);
+ *safecmd = q;
+ }
+ }
+ }
+#endif
+ }
+
+ return allow;
+}
+
+/* We should only be called with shellenabledp == 1.
+ Return value:
+ -1 if a quotation syntax error.
+ 0 if CMD is not allowed; given shellenabledp==1, this is because
+ shell escapes are restricted and CMD is not allowed.
+ 1 if shell escapes are not restricted, hence any command is allowed.
+ 2 if shell escapes are restricted and CMD is allowed (possibly after
+ quoting). */
+
+#ifdef WIN32
+#undef system
+#define system fsyscp_system
+#if ENABLE_PIPES
+#undef popen
+#define popen fsyscp_popen
+#endif /* ENABLE_PIPES */
+#endif /* WIN32 */
+
+int
+runsystem (const char *cmd)
+{
+ int allow = 0;
+ char *safecmd = NULL;
+ char *cmdname = NULL;
+ int status = 0;
+
+ if (shellenabledp <= 0) {
+ return 0;
+ }
+
+ /* If restrictedshell == 0, any command is allowed. */
+ if (restrictedshell == 0)
+ allow = 1;
+ else
+ allow = shell_cmd_is_allowed (cmd, &safecmd, &cmdname);
+
+ if (allow == 1)
+ status = system (cmd);
+ else if (allow == 2)
+ status = system (safecmd);
+
+ /* Not really meaningful, but we have to manage the return value of system. */
+ if (status != 0)
+ fprintf(stderr,"system returned with code %d\n", status);
+
+ if (safecmd)
+ free (safecmd);
+ if (cmdname)
+ free (cmdname);
+
+ return allow;
+}
+#endif /* TeX */
+
+#if ENABLE_PIPES
+/* Like runsystem(), the runpopen() function is called only when
+ shellenabledp == 1. Unlike runsystem(), here we write errors to
+ stderr, since we have nowhere better to use; and of course we return
+ a file handle (or NULL) instead of a status indicator. */
+
+static FILE *
+runpopen (char *cmd, const char *mode)
+{
+ FILE *f = NULL;
+ char *safecmd = NULL;
+ char *cmdname = NULL;
+ int allow;
+
+#ifdef WIN32
+ char *pp;
+
+ for (pp = cmd; *pp; pp++) {
+ if (*pp == '\'') *pp = '"';
+ }
+#endif
+
+ /* If restrictedshell == 0, any command is allowed. */
+ if (restrictedshell == 0)
+ allow = 1;
+ else
+ allow = shell_cmd_is_allowed (cmd, &safecmd, &cmdname);
+
+ if (allow == 1)
+ f = popen (cmd, mode);
+ else if (allow == 2)
+ f = popen (safecmd, mode);
+ else if (allow == -1)
+ fprintf (stderr, "\nrunpopen quotation error in command line: %s\n",
+ cmd);
+ else
+ fprintf (stderr, "\nrunpopen command not allowed: %s\n", cmdname);
+
+ if (safecmd)
+ free (safecmd);
+ if (cmdname)
+ free (cmdname);
+ return f;
+}
+#endif /* ENABLE_PIPES */
+
+/* The main program, etc. */
+
+#ifdef XeTeX
+#include "xetexdir/XeTeX_ext.h"
+#endif
+
+/* What we were invoked as and with. */
+char **argv;
+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;
+
+/* The filename for dynamic character translation, or NULL. */
+string translate_filename;
+string default_translate_filename;
+
+#if defined(TeX)
+/* Needed for --src-specials option. */
+static char *last_source_name;
+static int last_lineno;
+static boolean srcspecialsoption = false;
+static void parse_src_specials_option (const_string);
+#endif
+
+/* Parsing a first %&-line in the input file. */
+static void parse_first_line (const_string);
+
+/* Parse option flags. */
+static void parse_options (int, string *);
+
+/* Try to figure out if we have been given a filename. */
+static string get_input_file_name (void);
+
+/* Get a true/false value for a variable from texmf.cnf and the
+ environment. Not static because we call it from tex.ch. */
+
+boolean
+texmf_yesno(const_string var)
+{
+ string value = kpse_var_value (var);
+ return value && (*value == 't' || *value == 'y' || *value == '1');
+}
+
+#ifdef pdfTeX
+const char *ptexbanner = BANNER;
+#endif
+
+#ifdef WIN32
+/* forward declaration */
+static string
+normalize_quotes (const_string name, const_string mesg);
+#endif /* WIN32 */
+
+/* maininit, called from main() - this is most of the main routine,
+ including our C-level option handling and concomitant kpse setup.
+ The original TeX/MF code for handling first lines is still live, and
+ we set up for that in `topenin' (which is called from the .web). */
+
+void
+maininit (int ac, string *av)
+{
+ string main_input_file;
+#if (IS_upTeX || defined(XeTeX) || defined(pdfTeX)) && defined(WIN32)
+ string enc;
+#endif
+ /* Save to pass along to topenin. */
+ argc = ac;
+ argv = av;
+
+ /* Must be initialized before options are parsed. */
+ interactionoption = 4;
+
+ /* Have things to record as we go along. */
+ kpse_record_input = recorder_record_input;
+ kpse_record_output = recorder_record_output;
+
+#if defined(__SyncTeX__)
+ /* 0 means "disable Synchronize TeXnology".
+ synctexoption is a *.web variable.
+ We initialize it to a weird value to catch the -synctex command line flag.
+ At runtime, if synctexoption is not INT_MAX, then it contains the
+ command line option provided; otherwise, no such option was given
+ by the user. */
+# define SYNCTEX_NO_OPTION INT_MAX
+ synctexoption = SYNCTEX_NO_OPTION;
+#endif
+
+#if IS_pTeX
+ kpse_set_program_name (argv[0], NULL);
+ initkanji ();
+#endif
+#if (defined(XeTeX) || defined(pdfTeX)) && defined(WIN32)
+ kpse_set_program_name (argv[0], NULL);
+#endif
+#if (IS_upTeX || defined(XeTeX) || defined(pdfTeX)) && defined(WIN32)
+/*
+ -cnf-line=command_line_encoding=value cannot give effect because
+ command_line_encoding is read here before parsing the command
+ line. So we add the following.
+*/
+ { /* support old compilers which are incompatible with C99 */
+ int n;
+ for (n = 1; n < ac; n++) {
+ if (!strncasecmp (av[n], "-cnf-line=command_line_encoding=", 32)) {
+ putenv (av[n] + 10);
+ break;
+ }
+ if (!strncasecmp (av[n], "--cnf-line=command_line_encoding=", 33)) {
+ putenv (av[n] + 11);
+ break;
+ }
+ if (n < ac - 1 && (!strncasecmp (av[n], "-cnf-line", 9) ||
+ !strncasecmp (av[n], "--cnf-line", 10)) &&
+ !strncasecmp (av[n+1], "command_line_encoding=", 22)) {
+ putenv (av[n+1]);
+ break;
+ }
+ }
+ }
+ enc = kpse_var_value("command_line_encoding");
+ get_command_line_args_utf8(enc, &argc, &argv);
+#endif
+#if IS_pTeX && !IS_upTeX && !defined(WIN32)
+ ptenc_get_command_line_args(&argc, &argv);
+#endif
+
+ /* If the user says --help or --version, we need to notice early. And
+ since we want the --ini option, have to do it before getting into
+ the web (which would read the base file, etc.). */
+#if ((IS_upTeX || defined(XeTeX) || defined(pdfTeX)) && defined(WIN32)) || (IS_pTeX && !IS_upTeX && !defined(WIN32))
+ parse_options (argc, argv);
+#else
+ parse_options (ac, av);
+#endif
+
+#if IS_pTeX || ((defined(XeTeX) || defined(pdfTeX)) && defined(WIN32))
+ /* In pTeX and friends, or in WIN32, texmf.cnf is not recorded in
+ the case of --recorder, because parse_options() is executed
+ after the start of kpathsea due to special initializations.
+ Therefore we record texmf.cnf here. */
+ if (recorder_enabled) {
+ string *p = kpse_find_file_generic ("texmf.cnf", kpse_cnf_format, 0, 1);
+ if (p && *p) {
+ string *pp = p;
+ while (*p) {
+ recorder_record_input (*p);
+ free (*p);
+ p++;
+ }
+ free (pp);
+ }
+ }
+#endif /* IS_pTeX || (...) */
+
+ /* If -progname was not specified, default to the dump name. */
+ if (!user_progname)
+ user_progname = dump_name;
+
+ /* Do this early so we can inspect kpse_invocation_name and
+ kpse_program_name below, and because we have to do this before
+ any path searching. */
+#if IS_pTeX || ((defined(XeTeX) || defined(pdfTeX)) && defined(WIN32))
+ if (user_progname)
+ kpse_reset_program_name (user_progname);
+#else
+ kpse_set_program_name (argv[0], user_progname);
+#endif
+
+#if defined(MF)
+#if defined(MFLua)
+ /* Reset mf*-nowin program names. */
+ if (strncasecmp (kpse_invocation_name, "mflua-nowin", 11) == 0)
+ kpse_reset_program_name ("mflua");
+#elif defined(MFLuaJIT)
+ if (strncasecmp (kpse_invocation_name, "mfluajit-nowin", 14) == 0)
+ kpse_reset_program_name ("mfluajit");
+#else
+ if (strncasecmp (kpse_invocation_name, "mf-nowin", 8) == 0)
+ kpse_reset_program_name ("mf");
+#endif
+#endif
+
+ /* Make the given engine name available in the variable `engine'. */
+ 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 ();
+
+#ifdef WIN32
+ if (main_input_file == NULL) {
+ string name;
+#ifndef XeTeX
+ boolean quoted;
+#endif
+
+ name = argv[argc-1];
+ if (name && name[0] != '-' && name[0] != '&' && name[0] != '\\') {
+ if (strlen (name) > 2 && isalpha (name[0]) && name[1] == ':' &&
+ name[2] == '\\') {
+ string pp;
+ for (pp = name; *pp; pp++) {
+ if (IS_KANJI (pp))
+ pp++;
+ else if (*pp == '\\')
+ *pp = '/';
+ }
+ }
+ name = normalize_quotes(argv[argc-1], "argument");
+#ifdef XeTeX
+ main_input_file = kpse_find_file(argv[argc-1], INPUT_FORMAT, false);
+ argv[argc-1] = name;
+#else
+ quoted = (name[0] == '"');
+ if (quoted) {
+ /* Overwrite last quote and skip first quote. */
+ name[strlen(name)-1] = '\0';
+ name++;
+ }
+ main_input_file = kpse_find_file(name, INPUT_FORMAT, false);
+ if (quoted) {
+ /* Undo modifications */
+ name[strlen(name)] = '"';
+ name--;
+ }
+ argv[argc-1] = name;
+#endif
+ }
+ }
+#endif /* WIN32 */
+
+ /* Second chance to activate file:line:error style messages, this
+ time from texmf.cnf. */
+ if (filelineerrorstylep < 0) {
+ filelineerrorstylep = 0;
+ } else if (!filelineerrorstylep) {
+ filelineerrorstylep = texmf_yesno ("file_line_error_style");
+ }
+
+ /* If no dump default yet, and we're not doing anything special on
+ this run, we may want to look at the first line of the main input
+ file for a %&<dumpname> specifier. */
+ if (parsefirstlinep < 0) {
+ parsefirstlinep = 0;
+ } else if (!parsefirstlinep) {
+ parsefirstlinep = texmf_yesno ("parse_first_line");
+ }
+ if (parsefirstlinep && (!dump_name || !translate_filename)) {
+ parse_first_line (main_input_file);
+ }
+ /* Check whether there still is no translate_filename known. If so,
+ use the default_translate_filename. */
+ if (!translate_filename) {
+ translate_filename = default_translate_filename;
+ }
+ /* If we're preloaded, I guess everything is set up. I don't really
+ know any more, it's been so long since anyone truly preloaded. We
+ still use the word "preloaded" in the messages, though (via the
+ original .web sources), at Knuth's request. */
+ if (readyalready != 314159) {
+ /* The `ini_version' variable is declared/used in the change files. */
+ boolean virversion = false;
+ if (FILESTRCASEEQ (kpse_program_name, INI_PROGRAM)) {
+ iniversion = true;
+ } else if (FILESTRCASEEQ (kpse_program_name, VIR_PROGRAM)) {
+ virversion = true;
+#ifdef TeX
+ } else if (FILESTRCASEEQ (kpse_program_name, "initex")) {
+ iniversion = true;
+ } else if (FILESTRCASEEQ (kpse_program_name, "virtex")) {
+ virversion = true;
+#ifndef Aleph
+ } else if (FILESTRCASEEQ (kpse_program_name, "mltex")) {
+ mltexp = true;
+#endif /* !Aleph */
+#endif /* TeX */
+ }
+
+ /* If run like `tex \&foo', reasonable to guess "foo" as the fmt name. */
+ if (!main_input_file) {
+ if (argv[1] && *argv[1] == '&') {
+ dump_name = argv[1] + 1;
+ }
+ }
+
+ if (!dump_name) {
+ /* If called as *vir{mf,tex,mpost} use `plain'. Otherwise, use the
+ name we were invoked under as our best guess. */
+ dump_name = (virversion ? "plain" : kpse_program_name);
+ }
+ }
+
+#ifdef TeX
+ /* Sanity check: -mltex, -enc, -etex only work in combination with -ini. */
+ if (!iniversion) {
+#if !defined(Aleph)
+ if (mltexp) {
+ fprintf(stderr, "-mltex only works with -ini\n");
+ }
+#if !defined(XeTeX) && !IS_pTeX
+ if (enctexp) {
+ fprintf(stderr, "-enc only works with -ini\n");
+ }
+#endif
+#endif
+#if IS_eTeX
+ if (etexp) {
+ fprintf(stderr, "-etex only works with -ini\n");
+ }
+#endif
+ }
+#endif
+
+ /* If we've set up the fmt/base default in any of the various ways
+ above, also set its length. */
+ if (dump_name) {
+ const_string with_ext = NULL;
+ unsigned name_len = strlen (dump_name);
+ unsigned ext_len = strlen (DUMP_EXT);
+
+ /* Provide extension if not there already. */
+ if (name_len > ext_len
+ && FILESTRCASEEQ (dump_name + name_len - ext_len, DUMP_EXT)) {
+ with_ext = dump_name;
+ } else {
+ with_ext = concat (dump_name, DUMP_EXT);
+ }
+ DUMP_VAR = concat (" ", with_ext); /* adjust array for Pascal */
+ DUMP_LENGTH_VAR = strlen (DUMP_VAR + 1);
+ } else {
+ /* For dump_name to be NULL is a bug. */
+ abort();
+ }
+
+ /* Additional initializations. No particular reason for doing them
+ here instead of first thing in the change file; less symbols to
+ propagate through Webc, that's all. */
+#ifdef MF
+ kpse_set_program_enabled (kpse_mf_format, MAKE_TEX_MF_BY_DEFAULT,
+ kpse_src_compile);
+ kpse_set_program_enabled (kpse_base_format, MAKE_TEX_FMT_BY_DEFAULT,
+ kpse_src_compile);
+#endif /* MF */
+#ifdef TeX
+#if defined (Aleph)
+ kpse_set_program_enabled (kpse_ocp_format, MAKE_OMEGA_OCP_BY_DEFAULT,
+ kpse_src_compile);
+ kpse_set_program_enabled (kpse_ofm_format, MAKE_OMEGA_OFM_BY_DEFAULT,
+ kpse_src_compile);
+ kpse_set_program_enabled (kpse_tfm_format, false, kpse_src_compile);
+#else /* !Aleph */
+ kpse_set_program_enabled (kpse_tfm_format, MAKE_TEX_TFM_BY_DEFAULT,
+ kpse_src_compile);
+#endif /* !Aleph */
+ kpse_set_program_enabled (kpse_tex_format, MAKE_TEX_TEX_BY_DEFAULT,
+ kpse_src_compile);
+ kpse_set_program_enabled (kpse_fmt_format, MAKE_TEX_FMT_BY_DEFAULT,
+ kpse_src_compile);
+
+ init_shell_escape ();
+
+ if (!outputcomment) {
+ outputcomment = kpse_var_value ("output_comment");
+ }
+#endif /* TeX */
+}
+
+/* main: Set up for reading the command line, which will happen in
+ `maininit' and `topenin', then call the main body, plus
+ special Windows/Kanji initializations. */
+
+int
+#if defined(DLLPROC)
+DLLPROC (int ac, string *av)
+#else
+main (int ac, string *av)
+#endif
+{
+#ifdef __EMX__
+ _wildcard (&ac, &av);
+ _response (&ac, &av);
+#endif
+
+#ifdef WIN32
+ av[0] = kpse_program_basename (av[0]);
+ _setmaxstdio(2048);
+ setmode(fileno(stdin), _O_BINARY);
+#endif
+
+ maininit (ac, av);
+
+#ifdef WIN32
+ if (ac > 1) {
+ char *pp;
+ if ((strlen(av[ac-1]) > 2) &&
+ isalpha(av[ac-1][0]) &&
+ (av[ac-1][1] == ':') &&
+ (av[ac-1][2] == '\\')) {
+ for (pp=av[ac-1]+2; *pp; pp++) {
+ if (IS_KANJI(pp)) {
+ pp++;
+ continue;
+ }
+ if (*pp == '\\')
+ *pp = '/';
+ }
+ }
+ }
+#endif
+
+ /* Call the real main program. */
+ mainbody ();
+
+ return EXIT_SUCCESS;
+}
+
+/* This is supposed to ``open the terminal for input'', but what we
+ really do is copy command line arguments into TeX's or Metafont's
+ buffer, so they can handle them. If nothing is available, or we've
+ been called already (and hence, argc==0), we return with
+ `last=first'. */
+
+void
+topenin (void)
+{
+ int i;
+
+#ifdef XeTeX
+ static UFILE termin_file;
+ if (termin == 0) {
+ termin = &termin_file;
+ termin->f = stdin;
+ termin->savedChar = -1;
+ termin->skipNextLF = 0;
+ termin->encodingMode = UTF8;
+ termin->conversionData = 0;
+ inputfile[0] = termin;
+ }
+#endif
+
+ buffer[first] = 0; /* In case there are no arguments. */
+
+ if (optind < argc) { /* We have command line arguments. */
+ int k = first;
+ for (i = optind; i < argc; i++) {
+#ifdef XeTeX
+ unsigned char *ptr = (unsigned char *)&(argv[i][0]);
+ /* need to interpret UTF8 from the command line */
+ UInt32 rval;
+ while ((rval = *(ptr++)) != 0) {
+ UInt16 extraBytes = bytesFromUTF8[rval];
+ switch (extraBytes) { /* note: code falls through cases! */
+ case 5: rval <<= 6; if (*ptr) rval += *(ptr++);
+ case 4: rval <<= 6; if (*ptr) rval += *(ptr++);
+ case 3: rval <<= 6; if (*ptr) rval += *(ptr++);
+ case 2: rval <<= 6; if (*ptr) rval += *(ptr++);
+ case 1: rval <<= 6; if (*ptr) rval += *(ptr++);
+ case 0: ;
+ };
+ rval -= offsetsFromUTF8[extraBytes];
+ buffer[k++] = rval;
+ }
+#else
+ char *ptr = &(argv[i][0]);
+ /* Don't use strcat, since in Aleph the buffer elements aren't
+ single bytes. */
+ while (*ptr) {
+ buffer[k++] = *(ptr++);
+ }
+#endif
+ buffer[k++] = ' ';
+ }
+ argc = 0; /* Don't do this again. */
+ buffer[k] = 0;
+ }
+
+ /* Find the end of the buffer. */
+ for (last = first; buffer[last]; ++last)
+ ;
+
+ /* Make `last' be one past the last non-space character in `buffer',
+ ignoring line terminators (but not, e.g., tabs). This is because
+ we are supposed to treat this like a line of TeX input. Although
+ there are pathological cases (SPC CR SPC CR) where this differs
+ from input_line below, and from previous behavior of removing all
+ whitespace, the simplicity of removing all trailing line terminators
+ seems more in keeping with actual command line processing. */
+#define IS_SPC_OR_EOL(c) ((c) == ' ' || (c) == '\r' || (c) == '\n')
+ for (--last; last >= first && IS_SPC_OR_EOL (buffer[last]); --last)
+ ;
+ last++;
+
+ /* One more time, this time converting to TeX's internal character
+ representation. */
+#if !defined(Aleph) && !defined(XeTeX)
+ for (i = first; i < last; i++)
+ buffer[i] = xord[buffer[i]];
+#endif
+}
+
+/* IPC for TeX. By Tom Rokicki for the NeXT; it makes TeX ship out the
+ DVI file in a pipe to TeXView so that the output can be displayed
+ incrementally. Shamim Mohamed adapted it for Web2c. */
+#if defined (TeX) && defined (IPC)
+
+#ifdef WIN32
+#undef _WINSOCKAPI_
+#include <winsock2.h>
+#else
+#include <sys/socket.h>
+#include <fcntl.h>
+#ifndef O_NONBLOCK /* POSIX */
+#ifdef O_NDELAY /* BSD */
+#define O_NONBLOCK O_NDELAY
+#elif defined(O_FNDELAY) /* NeXT */
+#define O_NONBLOCK O_FNDELAY
+#else
+what the fcntl? cannot implement IPC without equivalent for O_NONBLOCK.
+#endif
+#endif /* no O_NONBLOCK */
+#endif /* !WIN32 */
+
+#ifdef WIN32
+# define IPC_AF AF_INET
+# ifndef IPC_LOCAL_HOST
+# define IPC_LOCAL_HOST "127.0.0.1"
+# define FIXED_PORT (unsigned short)4242
+# endif
+#else
+# define IPC_AF AF_UNIX
+# ifndef IPC_PIPE_NAME /* $HOME is prepended to this. */
+# define IPC_PIPE_NAME "/.TeXview_Pipe"
+# endif
+#endif
+#ifndef IPC_SERVER_CMD /* Command to run to start the server. */
+# ifdef WIN32
+# define IPC_SERVER_CMD "texview.exe"
+# else
+# define IPC_SERVER_CMD "open `which TeXview`"
+# endif
+#endif
+
+struct msg
+{
+ int namelength; /* length of auxiliary data */
+ int eof; /* new eof for dvi file */
+#if 0 /* see usage of struct msg below */
+ char more_data[0]; /* where the rest of the stuff goes */
+#endif
+};
+
+static struct sockaddr *ipc_addr;
+static int ipc_addr_len;
+
+static int
+ipc_make_name (void)
+{
+ if (ipc_addr_len == 0) {
+#ifdef WIN32
+ unsigned long remote_addr = inet_addr(IPC_LOCAL_HOST);
+ if (remote_addr != INADDR_NONE) {
+ struct sockaddr_in *ipc_sin_addr = xmalloc (sizeof (struct sockaddr_in));
+ ipc_sin_addr->sin_family = AF_INET;
+ ipc_sin_addr->sin_addr.s_addr = remote_addr;
+ ipc_sin_addr->sin_port = htons (FIXED_PORT);
+ ipc_addr = ((struct sockaddr *) ipc_sin_addr);
+ ipc_addr_len = sizeof(struct sockaddr_in);
+ }
+#else
+ string s = getenv ("HOME");
+ if (s) {
+ char *ipc_name;
+ ipc_addr = xmalloc (strlen (s) + 40);
+ ipc_addr->sa_family = 0;
+ ipc_name = ipc_addr->sa_data;
+ strcpy (ipc_name, s);
+ strcat (ipc_name, IPC_PIPE_NAME);
+ ipc_addr_len = strlen (ipc_name) + 3;
+ }
+#endif
+ }
+ return ipc_addr_len;
+}
+
+static int sock = -1;
+
+#ifdef WIN32
+# define CLOSE_SOCKET(s) closesocket (s); WSACleanup ()
+#else
+# define CLOSE_SOCKET(s) close (s)
+#endif
+
+static int
+ipc_is_open (void)
+{
+ return sock != -1;
+}
+
+static void
+ipc_open_out (void) {
+#ifdef WIN32
+ struct WSAData wsaData;
+ int nCode;
+ unsigned long mode = 1;
+#endif
+#ifdef IPC_DEBUG
+ fputs ("tex: Opening socket for IPC output ...\n", stderr);
+#endif
+ if (sock != -1) {
+ return;
+ }
+
+#ifdef WIN32
+ if ((nCode = WSAStartup(MAKEWORD(1, 1), &wsaData)) != 0) {
+ fprintf(stderr,"WSAStartup() returned error code %d.\n", nCode);
+ return;
+ }
+#endif
+
+ if (ipc_make_name () <= 0)
+ return;
+
+ sock = socket (IPC_AF, SOCK_STREAM, 0);
+#ifdef IPC_DEBUG
+ if(sock != -1)
+ fprintf(stderr, "tex: Socket handle is %d\n", sock);
+ else
+ fprintf(stderr, "tex: Socket is invalid.\n");
+#endif
+
+ if (sock != -1) {
+ if (connect (sock, ipc_addr, ipc_addr_len) != 0 ||
+#ifdef WIN32
+ ioctlsocket (sock, FIONBIO, &mode) < 0
+#else
+ fcntl (sock, F_SETFL, O_NONBLOCK) < 0
+#endif
+ ) {
+ CLOSE_SOCKET (sock);
+ sock = -1;
+#ifdef IPC_DEBUG
+ fputs ("tex: IPC socket cannot be connected.\n", stderr);
+ fputs ("tex: Socket is closed.\n", stderr);
+#endif
+ return;
+ }
+#ifdef IPC_DEBUG
+ fputs ("tex: Successfully opened IPC socket.\n", stderr);
+#endif
+ }
+}
+
+static void
+ipc_close_out (void)
+{
+#ifdef IPC_DEBUG
+ fputs ("tex: Closing output socket ...\n", stderr);
+#endif
+ if (ipc_is_open ()) {
+ CLOSE_SOCKET (sock);
+ sock = -1;
+ }
+}
+
+static void
+ipc_snd (int n, int is_eof, char *data)
+{
+ struct
+ {
+ struct msg msg;
+ char more_data[1024];
+ } ourmsg;
+
+ if (!ipc_is_open ()) {
+ return;
+ }
+
+#ifdef IPC_DEBUG
+ fprintf(stderr, "%d\t%d\n", ourmsg.msg.namelength, ourmsg.msg.eof);
+ fputs ("tex: Sending message to socket ...\n", stderr);
+#endif
+ ourmsg.msg.namelength = n;
+ ourmsg.msg.eof = is_eof;
+ if (n) {
+ strcpy (ourmsg.more_data, data);
+ }
+ n += sizeof (struct msg);
+#ifdef IPC_DEBUG
+ fprintf(stderr, "%d\t%d\n", ourmsg.msg.namelength, ourmsg.msg.eof);
+ fputs ("tex: Writing to socket...\n", stderr);
+#endif
+#if defined(WIN32)
+ if (send (sock, (char *)&ourmsg, n, 0) != n) {
+#else
+ if (write (sock, &ourmsg, n) != n) {
+#endif
+ ipc_close_out ();
+ }
+#ifdef IPC_DEBUG
+ fputs ("tex: IPC message sent.\n", stderr);
+#endif
+}
+
+/* This routine notifies the server if there is an eof, or the filename
+ if a new DVI file is starting. This is the routine called by TeX.
+ Aleph defines str_start(#) as str_start_ar[# - too_big_char], with
+ too_big_char = biggest_char + 1 = 65536 (omstr.ch). */
+
+void
+ipcpage (int is_eof)
+{
+ static boolean begun = false;
+ unsigned len = 0;
+ string p = NULL;
+
+ if (!begun) {
+ string name; /* Just the filename. */
+ string cwd = xgetcwd ();
+
+ ipc_open_out ();
+#if !defined(Aleph)
+ len = strstart[outputfilename + 1] - strstart[outputfilename];
+#else
+ len = strstartar[outputfilename + 1 - 65536L] -
+ strstartar[outputfilename - 65536L];
+#endif
+ name = xmalloc (len + 1);
+#if !defined(Aleph)
+ strncpy (name, (string)&strpool[strstart[outputfilename]], len);
+#else
+ {
+ unsigned i;
+ for (i=0; i<len; i++)
+ name[i] = strpool[i+strstartar[outputfilename - 65536L]];
+ }
+#endif
+ name[len] = 0;
+
+ /* Have to pass whole filename to the other end, since it may have
+ been started up and running as a daemon, e.g., as with the NeXT
+ preview program. */
+ p = concat3 (cwd, DIR_SEP_STRING, name);
+ free (cwd);
+ free (name);
+
+#if defined (WIN32)
+ { char *q;
+ for (q = p; *q; q++) {
+ if (*q == '\\')
+ *q = '/';
+ else if (IS_KANJI(q))
+ q++;
+ }
+ }
+#endif
+ len = strlen(p);
+ begun = true;
+ }
+ ipc_snd (len, is_eof, p);
+
+ if (p)
+ free (p);
+}
+#endif /* TeX && IPC */
+
+#if defined (TeX) || defined (MF)
+ /* TCX and Aleph&Co get along like sparks and gunpowder. */
+#if !defined(Aleph) && !defined(XeTeX)
+
+/* Return the next number following START, setting POST to the following
+ character, as in strtol. Issue a warning and return -1 if no number
+ can be parsed. */
+
+static int
+tcx_get_num (int upb,
+ unsigned line_count,
+ string start,
+ string *post)
+{
+ int num = strtol (start, post, 0);
+ assert (post && *post);
+ if (*post == start) {
+ /* Could not get a number. If blank line, fine. Else complain. */
+ string p = start;
+ while (*p && ISSPACE (*p))
+ p++;
+ if (*p != 0)
+ fprintf (stderr, "%s:%d: Expected numeric constant, not `%s'.\n",
+ translate_filename, line_count, start);
+ num = -1;
+ } else if (num < 0 || num > upb) {
+ fprintf (stderr, "%s:%d: Destination charcode %d <0 or >%d.\n",
+ translate_filename, line_count, num, upb);
+ num = -1;
+ }
+
+ return num;
+}
+
+/* Update the xchr, xord, and xprn arrays for TeX, allowing a
+ translation table specified at runtime via an external file.
+ Look for the character translation file FNAME along the same path as
+ tex.pool. If no suffix in FNAME, use .tcx (don't bother trying to
+ support extension-less names for these files). */
+
+void
+readtcxfile (void)
+{
+ string orig_filename;
+ if (!find_suffix (translate_filename)) {
+ translate_filename = concat (translate_filename, ".tcx");
+ }
+ orig_filename = translate_filename;
+ translate_filename
+ = kpse_find_file (translate_filename, kpse_web2c_format, true);
+ if (translate_filename) {
+ string line;
+ unsigned line_count = 0;
+ FILE *translate_file = xfopen (translate_filename, FOPEN_R_MODE);
+ while ((line = read_line (translate_file))) {
+ int first;
+ string start2;
+ string comment_loc = strchr (line, '%');
+ if (comment_loc)
+ *comment_loc = 0;
+
+ line_count++;
+
+ first = tcx_get_num (255, line_count, line, &start2);
+ if (first >= 0) {
+ string start3;
+ int second;
+ int printable;
+
+ second = tcx_get_num (255, line_count, start2, &start3);
+ if (second >= 0) {
+ /* I suppose we could check for nonempty junk following the
+ "printable" code, but let's not bother. */
+ string extra;
+
+ /* If they mention a second code, make that the internal number. */
+ xord[first] = second;
+ xchr[second] = first;
+
+ printable = tcx_get_num (1, line_count, start3, &extra);
+ /* Not-a-number, may be a comment. */
+ if (printable == -1)
+ printable = 1;
+ /* Don't allow the 7bit ASCII set to become unprintable. */
+ if (32 <= second && second <= 126)
+ printable = 1;
+ } else {
+ second = first; /* else make internal the same as external */
+ /* If they mention a charcode, call it printable. */
+ printable = 1;
+ }
+
+ xprn[second] = printable;
+ }
+ free (line);
+ }
+ xfclose(translate_file, translate_filename);
+ } else {
+ WARNING1 ("Could not open char translation file `%s'", orig_filename);
+ }
+}
+#endif /* !Aleph && !XeTeX */
+#endif /* TeX || MF [character translation] */
+
+#ifdef XeTeX /* XeTeX handles this differently, and allows odd quotes within names */
+static string
+normalize_quotes (const_string name, const_string mesg)
+{
+ int quote_char = 0;
+ boolean must_quote = false;
+ int len = strlen(name);
+ /* Leave room for quotes and NUL. */
+ string ret;
+ string p;
+ const_string q;
+ for (q = name; *q; q++) {
+ if (*q == ' ') {
+ if (!must_quote) {
+ len += 2;
+ must_quote = true;
+ }
+ }
+ else if (*q == '\"' || *q == '\'') {
+ must_quote = true;
+ if (quote_char == 0)
+ quote_char = '\"' + '\'' - *q;
+ len += 2; /* this could sometimes add length we don't need */
+ }
+ }
+ ret = xmalloc(len + 1);
+ p = ret;
+ if (must_quote) {
+ if (quote_char == 0)
+ quote_char = '\"';
+ *p++ = quote_char;
+ }
+ for (q = name; *q; q++) {
+ if (*q == quote_char) {
+ *p++ = quote_char;
+ quote_char = '\"' + '\'' - quote_char;
+ *p++ = quote_char;
+ }
+ *p++ = *q;
+ }
+ if (quote_char != 0)
+ *p++ = quote_char;
+ *p = '\0';
+ return ret;
+}
+#else
+/* Normalize quoting of filename -- that is, only quote if there is a space,
+ and always use the quote-name-quote style. */
+static string
+normalize_quotes (const_string name, const_string mesg)
+{
+ boolean quoted = false;
+ boolean must_quote = (strchr(name, ' ') != NULL);
+ /* Leave room for quotes and NUL. */
+ string ret = xmalloc(strlen(name)+3);
+ string p;
+ const_string q;
+ p = ret;
+ if (must_quote)
+ *p++ = '"';
+ for (q = name; *q; q++) {
+ if (*q == '"')
+ quoted = !quoted;
+ else
+ *p++ = *q;
+ }
+ if (must_quote)
+ *p++ = '"';
+ *p = '\0';
+ if (quoted) {
+ fprintf(stderr, "! Unbalanced quotes in %s %s\n", mesg, name);
+ uexit(1);
+ }
+ return ret;
+}
+#endif
+
+/* Getting the input filename. */
+string
+get_input_file_name (void)
+{
+ string input_file_name = NULL;
+
+ if (argv[optind] && argv[optind][0] != '&' && argv[optind][0] != '\\') {
+ /* Not &format, not \input, so assume simple filename. */
+ string name;
+#ifndef XeTeX
+ boolean quoted;
+#endif
+
+#ifdef WIN32
+ if (strlen (argv[optind]) > 2 && isalpha (argv[optind][0]) &&
+ argv[optind][1] == ':' && argv[optind][2] == '\\') {
+ char *pp;
+ for (pp = argv[optind]; *pp; pp++) {
+ if (*pp == '\\')
+ *pp = '/';
+ else if (IS_KANJI(pp))
+ pp++;
+ }
+ }
+#endif
+ name = normalize_quotes(argv[optind], "argument");
+#ifdef XeTeX
+ input_file_name = kpse_find_file(argv[optind], INPUT_FORMAT, false);
+#else
+ quoted = (name[0] == '"');
+ if (quoted) {
+ /* Overwrite last quote and skip first quote. */
+ name[strlen(name)-1] = '\0';
+ name++;
+ }
+ input_file_name = kpse_find_file(name, INPUT_FORMAT, false);
+ if (quoted) {
+ /* Undo modifications */
+ name[strlen(name)] = '"';
+ name--;
+ }
+#endif
+ argv[optind] = name;
+ }
+ return input_file_name;
+}
+
+/* Reading the options. */
+
+/* Test whether getopt found an option ``A''.
+ Assumes the option index is in the variable `option_index', and the
+ option table in a variable `long_options'. */
+#define ARGUMENT_IS(a) STREQ (long_options[option_index].name, a)
+
+/* SunOS cc can't initialize automatic structs, so make this static. */
+static struct option long_options[]
+ = { { DUMP_OPTION, 1, 0, 0 },
+#ifdef TeX
+ /* 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 },
+ { "recorder", 0, &recorder_enabled, 1 },
+ { "version", 0, 0, 0 },
+#ifdef TeX
+#ifdef IPC
+ { "ipc", 0, &ipcon, 1 },
+ { "ipc-start", 0, &ipcon, 2 },
+#endif /* IPC */
+#if !defined(Aleph)
+ { "mltex", 0, &mltexp, 1 },
+#if !defined(XeTeX) && !IS_pTeX
+ { "enc", 0, &enctexp, 1 },
+#endif
+#endif /* !Aleph */
+#if IS_eTeX
+ { "etex", 0, &etexp, 1 },
+#endif
+ { "output-comment", 1, 0, 0 },
+#if defined(pdfTeX)
+ { "draftmode", 0, 0, 0 },
+ { "output-format", 1, 0, 0 },
+#endif /* pdfTeX */
+ { "shell-escape", 0, &shellenabledp, 1 },
+ { "no-shell-escape", 0, &shellenabledp, -1 },
+ { "enable-write18", 0, &shellenabledp, 1 },
+ { "disable-write18", 0, &shellenabledp, -1 },
+ { "shell-restricted", 0, 0, 0 },
+ { "debug-format", 0, &debugformatfile, 1 },
+ { "src-specials", 2, 0, 0 },
+#if defined(__SyncTeX__)
+ /* Synchronization: just like "interaction" above */
+ { "synctex", 1, 0, 0 },
+#endif
+#endif /* TeX */
+#if defined (TeX) || defined (MF)
+ { "file-line-error-style", 0, &filelineerrorstylep, 1 },
+ { "no-file-line-error-style", 0, &filelineerrorstylep, -1 },
+ /* Shorter option names for the above. */
+ { "file-line-error", 0, &filelineerrorstylep, 1 },
+ { "no-file-line-error", 0, &filelineerrorstylep, -1 },
+ { "jobname", 1, 0, 0 },
+ { "output-directory", 1, 0, 0 },
+ { "parse-first-line", 0, &parsefirstlinep, 1 },
+ { "no-parse-first-line", 0, &parsefirstlinep, -1 },
+#if !defined(Aleph)
+ { "translate-file", 1, 0, 0 },
+ { "default-translate-file", 1, 0, 0 },
+ { "8bit", 0, &eightbitp, 1 },
+#endif /* !Aleph */
+#if defined(XeTeX)
+ { "no-pdf", 0, &nopdfoutput, 1 },
+ { "output-driver", 1, 0, 0 },
+ { "papersize", 1, 0, 0 },
+#endif /* XeTeX */
+ { "mktex", 1, 0, 0 },
+ { "no-mktex", 1, 0, 0 },
+#endif /* TeX or MF */
+#if IS_pTeX
+#ifdef WIN32
+ { "guess-input-enc", 0, &infile_enc_auto, 1 },
+ { "no-guess-input-enc", 0, &infile_enc_auto, 0 },
+#endif
+ { "kanji", 1, 0, 0 },
+ { "kanji-internal", 1, 0, 0 },
+#endif /* IS_pTeX */
+ { 0, 0, 0, 0 } };
+
+static void
+parse_options (int argc, string *argv)
+{
+ int g; /* `getopt' return code. */
+ int option_index;
+
+ for (;;) {
+ g = getopt_long_only (argc, argv, "+", long_options, &option_index);
+
+ if (g == -1) /* End of arguments, exit the loop. */
+ break;
+
+ if (g == '?') { /* Unknown option. */
+ continue;
+ }
+
+ assert (g == 0); /* We have no short option names. */
+
+ if (ARGUMENT_IS ("kpathsea-debug")) {
+ kpathsea_debug |= atoi (optarg);
+
+#ifdef XeTeX
+ } else if (ARGUMENT_IS ("papersize")) {
+ papersize = optarg;
+ } else if (ARGUMENT_IS ("output-driver")) {
+ outputdriver = optarg;
+#endif
+
+ } 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;
+#else
+ c_job_name = normalize_quotes (optarg, "jobname");
+#endif
+
+ } else if (ARGUMENT_IS (DUMP_OPTION)) {
+ dump_name = optarg;
+ dumpoption = true;
+
+#ifdef TeX
+ /* For backward compatibility only. */
+ } else if (ARGUMENT_IS ("efmt")) {
+ dump_name = optarg;
+ dumpoption = true;
+#endif
+
+ } else if (ARGUMENT_IS ("output-directory")) {
+ output_directory = optarg;
+
+#ifdef TeX
+ } else if (ARGUMENT_IS ("output-comment")) {
+ unsigned len = strlen (optarg);
+ if (len < 256) {
+ outputcomment = optarg;
+ } else {
+ WARNING2 ("Comment truncated to 255 characters from %d. (%s)",
+ len, optarg);
+ outputcomment = xmalloc (256);
+ strncpy (outputcomment, optarg, 255);
+ outputcomment[255] = 0;
+ }
+
+#ifdef IPC
+ } else if (ARGUMENT_IS ("ipc-start")) {
+ ipc_open_out ();
+ /* Try to start up the other end if it's not already. */
+ if (!ipc_is_open ()) {
+#ifdef WIN32
+ if (_spawnlp (_P_NOWAIT, IPC_SERVER_CMD, IPC_SERVER_CMD, NULL) != -1) {
+#else
+ if (system (IPC_SERVER_CMD) == 0) {
+#endif
+ unsigned i;
+ for (i = 0; i < 20 && !ipc_is_open (); i++) {
+#ifdef WIN32
+ Sleep (100); /* 2000ms is too long for a simple w32 example */
+#else
+ sleep (2);
+#endif
+ ipc_open_out ();
+ }
+ }
+ }
+#endif /* IPC */
+
+ } else if (ARGUMENT_IS ("shell-restricted")) {
+ shellenabledp = 1;
+ restrictedshell = 1;
+
+ } else if (ARGUMENT_IS ("src-specials")) {
+ last_source_name = xstrdup("");
+ /* Option `--src" without any value means `auto' mode. */
+ if (optarg == NULL) {
+ insertsrcspecialeverypar = true;
+ insertsrcspecialauto = true;
+ srcspecialsoption = true;
+ srcspecialsp = true;
+ } else {
+ parse_src_specials_option(optarg);
+ }
+#endif /* TeX */
+#if defined(pdfTeX)
+ } else if (ARGUMENT_IS ("output-format")) {
+ pdfoutputoption = 1;
+ if (strcmp(optarg, "dvi") == 0) {
+ pdfoutputvalue = 0;
+ } else if (strcmp(optarg, "pdf") == 0) {
+ pdfoutputvalue = 2;
+ } else {
+ WARNING1 ("Ignoring unknown value `%s' for --output-format", optarg);
+ pdfoutputoption = 0;
+ }
+ } else if (ARGUMENT_IS ("draftmode")) {
+ pdfdraftmodeoption = 1;
+ pdfdraftmodevalue = 1;
+#endif /* pdfTeX */
+#if defined (TeX) || defined (MF)
+#if !defined(Aleph)
+ } else if (ARGUMENT_IS ("translate-file")) {
+ translate_filename = optarg;
+ } else if (ARGUMENT_IS ("default-translate-file")) {
+ default_translate_filename = optarg;
+#endif /* !Aleph */
+ } else if (ARGUMENT_IS ("mktex")) {
+ kpse_maketex_option (optarg, true);
+ } else if (ARGUMENT_IS ("no-mktex")) {
+ kpse_maketex_option (optarg, false);
+#endif /* TeX or MF */
+ } else if (ARGUMENT_IS ("interaction")) {
+ /* These numbers match @d's in *.ch */
+ if (STREQ (optarg, "batchmode")) {
+ interactionoption = 0;
+ } else if (STREQ (optarg, "nonstopmode")) {
+ interactionoption = 1;
+ } else if (STREQ (optarg, "scrollmode")) {
+ interactionoption = 2;
+ } else if (STREQ (optarg, "errorstopmode")) {
+ interactionoption = 3;
+ } else {
+ WARNING1 ("Ignoring unknown argument `%s' to --interaction", optarg);
+ }
+#if IS_pTeX
+ } else if (ARGUMENT_IS ("kanji")) {
+ if (!set_enc_string (optarg, NULL)) {
+ WARNING1 ("Ignoring unknown argument `%s' to --kanji", optarg);
+ }
+ } else if (ARGUMENT_IS ("kanji-internal")) {
+ if (!set_enc_string (NULL, optarg)) {
+ WARNING1 ("Ignoring unknown argument `%s' to --kanji-internal", optarg);
+ }
+#endif
+
+ } else if (ARGUMENT_IS ("help")) {
+ usagehelp (PROGRAM_HELP, BUG_ADDRESS);
+
+#if defined(__SyncTeX__)
+ } else if (ARGUMENT_IS ("synctex")) {
+ /* Synchronize TeXnology: catching the command line option as a long */
+ synctexoption = (int) strtol(optarg, NULL, 0);
+#endif
+
+ } else if (ARGUMENT_IS ("version")) {
+ char *versions;
+#if defined (pdfTeX) || defined(XeTeX)
+ initversionstring(&versions);
+#else
+ versions = NULL;
+#endif
+ printversionandexit (BANNER, COPYRIGHT_HOLDER, AUTHOR, versions);
+
+ } /* Else it was a flag; getopt has already done the assignment. */
+ }
+}
+
+#if defined(TeX)
+void
+parse_src_specials_option (const_string opt_list)
+{
+ char * toklist = xstrdup(opt_list);
+ char * tok;
+ insertsrcspecialauto = false;
+ tok = strtok (toklist, ", ");
+ while (tok) {
+ if (strcmp (tok, "everypar") == 0
+ || strcmp (tok, "par") == 0
+ || strcmp (tok, "auto") == 0) {
+ insertsrcspecialauto = true;
+ insertsrcspecialeverypar = true;
+ } else if (strcmp (tok, "everyparend") == 0
+ || strcmp (tok, "parend") == 0)
+ insertsrcspecialeveryparend = true;
+ else if (strcmp (tok, "everycr") == 0
+ || strcmp (tok, "cr") == 0)
+ insertsrcspecialeverycr = true;
+ else if (strcmp (tok, "everymath") == 0
+ || strcmp (tok, "math") == 0)
+ insertsrcspecialeverymath = true;
+ else if (strcmp (tok, "everyhbox") == 0
+ || strcmp (tok, "hbox") == 0)
+ insertsrcspecialeveryhbox = true;
+ else if (strcmp (tok, "everyvbox") == 0
+ || strcmp (tok, "vbox") == 0)
+ insertsrcspecialeveryvbox = true;
+ else if (strcmp (tok, "everydisplay") == 0
+ || strcmp (tok, "display") == 0)
+ insertsrcspecialeverydisplay = true;
+ else if (strcmp (tok, "none") == 0) {
+ /* This one allows to reset an option that could appear in texmf.cnf */
+ insertsrcspecialauto = insertsrcspecialeverypar =
+ insertsrcspecialeveryparend = insertsrcspecialeverycr =
+ insertsrcspecialeverymath = insertsrcspecialeveryhbox =
+ insertsrcspecialeveryvbox = insertsrcspecialeverydisplay = false;
+ } else {
+ WARNING1 ("Ignoring unknown argument `%s' to --src-specials", tok);
+ }
+ tok = strtok(0, ", ");
+ }
+ free(toklist);
+ srcspecialsp=insertsrcspecialauto | insertsrcspecialeverypar |
+ insertsrcspecialeveryparend | insertsrcspecialeverycr |
+ insertsrcspecialeverymath | insertsrcspecialeveryhbox |
+ insertsrcspecialeveryvbox | insertsrcspecialeverydisplay;
+ srcspecialsoption = true;
+}
+#endif
+
+/* If the first thing on the command line (we use the globals `argv' and
+ `optind') is a normal filename (i.e., does not start with `&' or
+ `\'), and if we can open it, and if its first line is %&FORMAT, and
+ FORMAT is a readable dump file, then set DUMP_VAR to FORMAT.
+ Also call kpse_reset_program_name to ensure the correct paths for the
+ format are used. */
+static void
+parse_first_line (const_string filename)
+{
+ FILE *f = filename ? fopen (filename, FOPEN_R_MODE) : NULL;
+ if (f) {
+ string first_line = read_line (f);
+ xfclose (f, filename);
+
+ /* We deal with the general format "%&fmt --translate-file=tcx" */
+ /* The idea of using this format came from Wlodzimierz Bzyl
+ <matwb@monika.univ.gda.pl> */
+ if (first_line && first_line[0] == '%' && first_line[1] == '&') {
+ /* Parse the first line into at most three space-separated parts. */
+ char *s;
+ char *part[4];
+ int npart;
+ char **parse;
+
+ /* Here we use ISBLANK instead of IS_SPC_OR_EOL because we are
+ parsing the whitespace-delimited %& line, not TeX input. */
+ for (s = first_line+2; ISBLANK(*s); ++s)
+ ;
+ npart = 0;
+ while (*s && npart != 3) {
+ part[npart++] = s;
+ while (*s && *s != ' ') s++;
+ while (*s == ' ') *s++ = '\0';
+ }
+ part[npart] = NULL;
+ parse = part;
+ /* Look at what we've got. Very crude! */
+ if (*parse && **parse != '-') {
+ /* A format name */
+ if (dump_name) {
+ /* format already determined, do nothing. */
+ } else {
+ string f_name = concat (part[0], DUMP_EXT);
+ string d_name = kpse_find_file (f_name, DUMP_FORMAT, false);
+ if (d_name && kpse_readable_file (d_name)) {
+ dump_name = xstrdup (part[0]);
+ kpse_reset_program_name (dump_name);
+ /* Tell TeX/MF/MP we have a %&name line... */
+ dumpline = true;
+ }
+ free (f_name);
+ }
+ parse++;
+ }
+ /* The tcx stuff, if any. Should we support the -translate-file
+ form as well as --translate-file? */
+ if (*parse) {
+ s = NULL;
+ if (translate_filename) {
+ /* TCX file already set, do nothing. */
+ } else if (STREQ (*parse, "--translate-file")) {
+ s = *(parse+1);
+ } else if (STREQ (*parse, "-translate-file")) {
+ s = *(parse+1);
+ } else if (STRNEQ (*parse, "--translate-file=", 17)) {
+ s = *parse+17;
+ } else if (STRNEQ (*parse, "-translate-file=", 16)) {
+ s = *parse+16;
+ }
+ /* Just set the name, no sanity checks here. */
+ if (s && *s) {
+ translate_filename = xstrdup(s);
+ }
+ }
+ }
+ if (first_line)
+ free (first_line);
+ }
+}
+
+/*
+ piped I/O
+ */
+
+/* The code that implements popen() needs an array for tracking
+ possible pipe file pointers, because these need to be
+ closed using pclose().
+*/
+
+#if ENABLE_PIPES
+
+#define NUM_PIPES 16
+
+static FILE *pipes [NUM_PIPES];
+
+boolean
+open_in_or_pipe (FILE **f_ptr, int filefmt, const_string fopen_mode)
+{
+ string fname = NULL;
+ int i; /* iterator */
+
+ /* opening a read pipe is straightforward, only have to
+ skip past the pipe symbol in the file name. filename
+ quoting is assumed to happen elsewhere (it does :-)) */
+
+ if (shellenabledp && *(nameoffile+1) == '|') {
+ /* the user requested a pipe */
+ *f_ptr = NULL;
+ fname = xmalloc(strlen((const_string)(nameoffile+1))+1);
+ strcpy(fname,(const_string)(nameoffile+1));
+ if (fullnameoffile)
+ free(fullnameoffile);
+ fullnameoffile = xstrdup(fname);
+ recorder_record_input (fname + 1);
+ *f_ptr = runpopen(fname+1,"r");
+ free(fname);
+ for (i=0; i<NUM_PIPES; i++) {
+ if (pipes[i]==NULL) {
+ pipes[i] = *f_ptr;
+ break;
+ }
+ }
+ if (*f_ptr)
+ setvbuf (*f_ptr,NULL,_IONBF,0);
+#ifdef WIN32
+ Poptr = *f_ptr;
+#endif
+
+ return *f_ptr != NULL;
+ }
+
+ return open_input(f_ptr,filefmt,fopen_mode) ;
+}
+
+#ifdef XeTeX
+boolean
+u_open_in_or_pipe(unicodefile* f, integer filefmt, const_string fopen_mode, integer mode, integer encodingData)
+{
+ string fname = NULL;
+ int i; /* iterator */
+
+ /* opening a read pipe is straightforward, only have to
+ skip past the pipe symbol in the file name. filename
+ quoting is assumed to happen elsewhere (it does :-)) */
+
+ if (shellenabledp && *(nameoffile+1) == '|') {
+ /* the user requested a pipe */
+ *f = malloc(sizeof(UFILE));
+ (*f)->encodingMode = (mode == AUTO) ? UTF8 : mode;
+ (*f)->conversionData = 0;
+ (*f)->savedChar = -1;
+ (*f)->skipNextLF = 0;
+ (*f)->f = NULL;
+ fname = xmalloc(strlen((const_string)(nameoffile+1))+1);
+ strcpy(fname,(const_string)(nameoffile+1));
+ if (fullnameoffile)
+ free(fullnameoffile);
+ fullnameoffile = xstrdup(fname);
+ recorder_record_input (fname + 1);
+ (*f)->f = runpopen(fname+1,"r");
+ free(fname);
+ for (i=0; i<NUM_PIPES; i++) {
+ if (pipes[i]==NULL) {
+ pipes[i] = (*f)->f;
+ break;
+ }
+ }
+ if ((*f)->f)
+ setvbuf ((*f)->f,NULL,_IONBF,0);
+#ifdef WIN32
+ Poptr = (*f)->f;
+#endif
+
+ return (*f)->f != NULL;
+ }
+
+ return u_open_in(f, filefmt, fopen_mode, mode, encodingData);
+}
+#endif
+
+boolean
+open_out_or_pipe (FILE **f_ptr, const_string fopen_mode)
+{
+ string fname;
+ int i; /* iterator */
+
+ /* opening a write pipe takes a little bit more work, because TeX
+ will perhaps have appended ".tex". To avoid user confusion as
+ much as possible, this extension is stripped only when the command
+ is a bare word. Some small string trickery is needed to make
+ sure the correct number of bytes is free()-d afterwards */
+
+ if (shellenabledp && *(nameoffile+1) == '|') {
+ /* the user requested a pipe */
+ fname = xmalloc(strlen((const_string)(nameoffile+1))+1);
+ strcpy(fname,(const_string)(nameoffile+1));
+ if (strchr (fname,' ')==NULL && strchr(fname,'>')==NULL) {
+ /* mp and mf currently do not use this code, but it
+ is better to be prepared */
+ if (STREQ((fname+strlen(fname)-4),".tex"))
+ *(fname+strlen(fname)-4) = 0;
+ *f_ptr = runpopen(fname+1,"w");
+ *(fname+strlen(fname)) = '.';
+ } else {
+ *f_ptr = runpopen(fname+1,"w");
+ }
+ recorder_record_output (fname + 1);
+ free(fname);
+
+ for (i=0; i<NUM_PIPES; i++) {
+ if (pipes[i]==NULL) {
+ pipes[i] = *f_ptr;
+ break;
+ }
+ }
+
+ if (*f_ptr)
+ setvbuf(*f_ptr,NULL,_IONBF,0);
+
+ return *f_ptr != NULL;
+ }
+
+ return open_output(f_ptr,fopen_mode);
+}
+
+
+void
+close_file_or_pipe (FILE *f)
+{
+ int i; /* iterator */
+
+ if (shellenabledp) {
+ /* if this file was a pipe, pclose() it and return */
+ for (i=0; i<NUM_PIPES; i++) {
+ if (pipes[i] == f) {
+ if (f) {
+ pclose (f);
+#ifdef WIN32
+ Poptr = NULL;
+#endif
+ }
+ pipes[i] = NULL;
+ return;
+ }
+ }
+ }
+ close_file(f);
+}
+
+#ifdef XeTeX
+
+#include <unicode/ucnv.h>
+
+void
+u_close_file_or_pipe (unicodefile* f)
+{
+ int i; /* iterator */
+
+ if (shellenabledp) {
+ /* if this file was a pipe, pclose() it and return */
+ for (i=0; i<NUM_PIPES; i++) {
+ if (pipes[i] == (*f)->f) {
+ if ((*f)->f) {
+ pclose ((*f)->f);
+ if (((*f)->encodingMode == ICUMAPPING) && ((*f)->conversionData != NULL))
+ ucnv_close((*f)->conversionData);
+ free(*f);
+ }
+ pipes[i] = NULL;
+ return;
+ }
+ }
+ }
+ close_file((*f)->f);
+}
+
+#endif
+
+#endif /* ENABLE_PIPES */
+
+/* All our interrupt handler has to do is set TeX's or Metafont's global
+ variable `interrupt'; then they will do everything needed. */
+#ifdef WIN32
+/* Win32 doesn't set SIGINT ... */
+static BOOL WINAPI
+catch_interrupt (DWORD arg)
+{
+ switch (arg) {
+ case CTRL_C_EVENT:
+ case CTRL_BREAK_EVENT:
+ interrupt = 1;
+ return TRUE;
+ default:
+ /* No need to set interrupt as we are exiting anyway */
+ return FALSE;
+ }
+}
+#else /* not WIN32 */
+static RETSIGTYPE
+catch_interrupt (int arg)
+{
+ interrupt = 1;
+#ifdef OS2
+ (void) signal (SIGINT, SIG_ACK);
+#else
+ (void) signal (SIGINT, catch_interrupt);
+#endif /* not OS2 */
+}
+#endif /* not WIN32 */
+
+#if defined(_MSC_VER)
+#define strtoull _strtoui64
+#endif
+
+static boolean start_time_set = false;
+static time_t start_time = 0;
+
+static boolean SOURCE_DATE_EPOCH_set = false;
+static boolean FORCE_SOURCE_DATE_set = false;
+
+void init_start_time() {
+ char *source_date_epoch;
+ unsigned long long epoch;
+ char *endptr;
+ if (!start_time_set) {
+ start_time_set = true;
+#ifndef onlyTeX
+ source_date_epoch = getenv("SOURCE_DATE_EPOCH");
+ if (source_date_epoch) {
+ errno = 0;
+ epoch = strtoull(source_date_epoch, &endptr, 10);
+ if (*endptr != '\0' || errno != 0) {
+FATAL1 ("invalid epoch-seconds-timezone value for environment variable $SOURCE_DATE_EPOCH: %s",
+ source_date_epoch);
+ }
+#if defined(_MSC_VER)
+ if (epoch > 32535291599ULL)
+ epoch = 32535291599ULL;
+#endif
+ start_time = epoch;
+ SOURCE_DATE_EPOCH_set = true;
+ } else
+#endif /* not onlyTeX */
+ {
+ start_time = time((time_t *) NULL);
+ }
+ }
+}
+
+/* Besides getting the date and time here, we also set up the interrupt
+ handler, for no particularly good reason. It's just that since the
+ `fix_date_and_time' routine is called early on (section 1337 in TeX,
+ ``Get the first line of input and prepare to start''), this is as
+ good a place as any. */
+
+void
+get_date_and_time (integer *minutes, integer *day,
+ integer *month, integer *year)
+{
+ struct tm *tmptr;
+#ifndef onlyTeX
+ string sde_texprim = getenv ("FORCE_SOURCE_DATE");
+ if (sde_texprim && STREQ (sde_texprim, "1")) {
+ init_start_time ();
+ tmptr = gmtime (&start_time);
+ FORCE_SOURCE_DATE_set = true;
+ } else
+#endif /* not onlyTeX */
+ {
+ /* whether the envvar was not set (usual case) or invalid,
+ use current time. */
+ time_t myclock = time ((time_t *) 0);
+ tmptr = localtime (&myclock);
+
+#ifndef onlyTeX
+ /* warn if they gave an invalid value, empty (null string) ok. */
+ if (sde_texprim && strlen (sde_texprim) > 0
+ && !STREQ (sde_texprim, "0")) {
+WARNING1 ("invalid value (expected 0 or 1) for environment variable $FORCE_SOURCE_DATE: %s",
+ sde_texprim);
+ }
+#endif /* not onlyTeX */
+ }
+
+ *minutes = tmptr->tm_hour * 60 + tmptr->tm_min;
+ *day = tmptr->tm_mday;
+ *month = tmptr->tm_mon + 1;
+ *year = tmptr->tm_year + 1900;
+
+ {
+#ifdef SA_INTERRUPT
+ /* Under SunOS 4.1.x, the default action after return from the
+ signal handler is to restart the I/O if nothing has been
+ transferred. The effect on TeX is that interrupts are ignored if
+ we are waiting for input. The following tells the system to
+ return EINTR from read() in this case. From ken@cs.toronto.edu. */
+
+ struct sigaction a, oa;
+
+ a.sa_handler = catch_interrupt;
+ sigemptyset (&a.sa_mask);
+ sigaddset (&a.sa_mask, SIGINT);
+ a.sa_flags = SA_INTERRUPT;
+ sigaction (SIGINT, &a, &oa);
+ if (oa.sa_handler != SIG_DFL)
+ sigaction (SIGINT, &oa, (struct sigaction *) 0);
+#else /* no SA_INTERRUPT */
+#ifdef WIN32
+ SetConsoleCtrlHandler(catch_interrupt, TRUE);
+#else /* not WIN32 */
+ RETSIGTYPE (*old_handler)(int);
+
+ old_handler = signal (SIGINT, catch_interrupt);
+ if (old_handler != SIG_DFL)
+ signal (SIGINT, old_handler);
+#endif /* not WIN32 */
+#endif /* no SA_INTERRUPT */
+ }
+}
+
+#if defined(pdfTeX) || defined(epTeX) || defined(eupTeX) || defined(XeTeX)
+/*
+ Getting a high resolution time.
+ */
+void
+get_seconds_and_micros (integer *seconds, integer *micros)
+{
+#if defined (HAVE_GETTIMEOFDAY)
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+ *seconds = tv.tv_sec;
+ *micros = tv.tv_usec;
+#elif defined (HAVE_FTIME)
+ struct timeb tb;
+ ftime(&tb);
+ *seconds = tb.time;
+ *micros = tb.millitm*1000;
+#else
+ time_t myclock = time((time_t*)NULL);
+ *seconds = myclock;
+ *micros = 0;
+#endif
+}
+#endif
+
+/* Read a line of input as efficiently as possible while still looking
+ like Pascal. We set `last' to `first' and return `false' if we get
+ to eof. Otherwise, we return `true' and set last = first +
+ length(line except trailing whitespace). */
+
+#ifndef XeTeX /* for XeTeX, we have a replacement function in XeTeX_ext.c */
+boolean
+input_line (FILE *f)
+{
+ int i = EOF;
+
+ /* Recognize either LF or CR as a line terminator. */
+#if IS_pTeX
+ last = input_line2(f, (unsigned char *)buffer, first, bufsize, &i);
+#else
+#ifdef WIN32
+ if (f != Poptr && fileno (f) != fileno (stdin)) {
+ long position = ftell (f);
+
+ if (position == 0L) { /* Detect and skip Byte order marks. */
+ int k1, k2, k3, k4;
+ k1 = getc (f);
+
+ if (k1 != 0xff && k1 != 0xfe && k1 != 0xef)
+ rewind (f);
+ else {
+ k2 = getc (f);
+
+ if (k2 != 0xff && k2 != 0xfe && k2 != 0xbb)
+ rewind (f);
+ else if ((k1 == 0xff && k2 == 0xfe) || /* UTF-16(LE) */
+ (k1 == 0xfe && k2 == 0xff)) /* UTF-16(BE) */
+ ;
+ else {
+ k3 = getc (f);
+ k4 = getc (f);
+ if (k1 == 0xef && k2 == 0xbb && k3 == 0xbf &&
+ k4 >= 0 && k4 <= 0x7e) /* UTF-8 */
+ ungetc (k4, f);
+ else
+ rewind (f);
+ }
+ }
+ }
+ }
+#endif /* WIN32 */
+ last = first;
+ do {
+ errno = 0; /* otherwise EINTR might wrongly persist */
+ while (last < bufsize && (i = getc (f)) != EOF && i != '\n' && i != '\r')
+ buffer[last++] = i;
+
+ /* The story on EINTR: because we tell libc to pass interrupts
+ through (see SA_INTERRUPT above), we have to make sure that we
+ check for and ignore EINTR when getc reads an EOF; hence the
+ outer do..while loop here (and a similar loop below).
+
+ On the other hand, we have to make sure that we detect a real
+ EOF. Otherwise, for example, typing CTRL-C and then CTRL-D to the
+ ** prompt results in an infinite loop, because we
+ (input_line) would never return false. On glibc 2.28-10 (Debian
+ 10/buster), and probably other versions, errno is evidently not
+ cleared as a side effect of getc (and this is allowed).
+ Therefore we clear errno before calling getc above.
+
+ Original report (thread following has many irrelevant diversions):
+ https://tug.org/pipermail/tex-k/2020-August/003297.html */
+
+ } while (i == EOF && errno == EINTR);
+#endif /* not IS_pTeX */
+
+ if (i == EOF && last == first)
+ return false;
+
+ /* We didn't get the whole line because our buffer was too small. */
+ if (i != EOF && i != '\n' && i != '\r') {
+ fprintf (stderr, "! Unable to read an entire line---bufsize=%u.\n",
+ (unsigned) bufsize);
+ fputs ("Please increase buf_size in texmf.cnf.\n", stderr);
+ uexit (1);
+ }
+
+ buffer[last] = ' ';
+ if (last >= maxbufstack)
+ maxbufstack = last;
+
+ /* If next char is LF of a CRLF, read it. */
+ if (i == '\r') {
+ while ((i = getc (f)) == EOF && errno == EINTR)
+ ;
+ if (i != '\n')
+ ungetc (i, f);
+ }
+
+ /* Trim trailing space character (but not, e.g., tabs). We can't have
+ line terminators because we stopped reading at the first \r or \n.
+ TeX's rule is to strip only trailing spaces (and eols). David
+ Fuchs mentions that this stripping was done to ensure portability
+ of TeX documents given the padding with spaces on fixed-record
+ "lines" on some systems of the time, e.g., IBM VM/CMS and OS/360. */
+ while (last > first && buffer[last - 1] == ' ')
+ --last;
+
+ /* Don't bother using xord if we don't need to. */
+#if !defined(Aleph)
+ for (i = first; i <= last; i++)
+ buffer[i] = xord[buffer[i]];
+#endif
+
+#if IS_pTeX
+ for (i = last+1; (i < last + 5 && i < bufsize) ; i++)
+ buffer[i] = '\0';
+#endif
+
+ return true;
+}
+#endif /* !XeTeX */
+
+/* This string specifies what the `e' option does in response to an
+ error message. */
+static const_string edit_value = EDITOR;
+
+/* This procedure originally due to sjc@s1-c. TeX & Metafont call it when
+ the user types `e' in response to an error, invoking a text editor on
+ the erroneous source file. FNSTART is how far into FILENAME the
+ actual filename starts; FNLENGTH is how long the filename is. */
+
+void
+calledit (packedASCIIcode *filename,
+ poolpointer fnstart,
+ integer fnlength,
+ integer linenumber)
+{
+ char *temp, *command, *fullcmd;
+ char c;
+ int sdone, ddone;
+
+#ifdef WIN32
+ char *fp, *ffp, *env, editorname[256], buffer[256];
+ int cnt = 0;
+ int dontchange = 0;
+#endif
+
+ sdone = ddone = 0;
+ filename += fnstart;
+
+ /* Close any open input files, since we're going to kill the job and
+ the editor might well want to open them for writing. On Windows,
+ at least, that would not be allowed when the file is still open.
+
+ Unfortunately, the input_file array contains both the open files
+ that we want to close, and junk references to non-files for
+ terminal interaction that we must not try to close. For example,
+ consider this input sequence:
+ \input test % contains a single line \bla, that is, any undefined cs
+ i\bum x % insert another undefined control sequence
+ e % invoke the editor
+ At this point input_file will have an open file for test.tex,
+ and a non-file for the insert. https://tex.stackexchange.com/q/552113
+
+ Therefore, we have to traverse down input_stack (not input_file),
+ looking for name_field values >17, which correspond to open
+ files, and then the index_field value of that entry tells us the
+ corresponding element of input_file, which is what we need to close.
+
+ We test for >17 because name_field=0 means the terminal,
+ name_field=1..16 means \openin stream n - 1,
+ name_field=17 means an invalid stream number (for read_toks).
+ Although ... seems like we should close any opened \openin files also.
+ Whoever is reading this, please implement that? Sigh.
+
+ Description in modules 300--304 of tex.web: "Input stacks and states."
+
+ Here, we do not have to look at cur_input, the global variable
+ which is effectively the top of input_stack, because it will always
+ be a terminal (non-file) interaction -- the one where the user
+ typed "e" to start the edit. */
+ {
+ int is_ptr; /* element of input_stack, 0 < input_ptr */
+ for (is_ptr = 0; is_ptr < inputptr; is_ptr++) {
+ if (inputstack[is_ptr].namefield <= 17) {
+ ; /* fprintf (stderr, "calledit: skipped input_stack[%d], ", is_ptr);
+ fprintf (stderr, "namefield=%d <= 17\n",
+ inputstack[is_ptr].namefield); */
+ } else {
+ FILE *f;
+ /* when name_field > 17, index_field specifies the element of
+ the input_file array, 1 <= in_open */
+ int if_ptr = inputstack[is_ptr].indexfield;
+ if (if_ptr < 1 || if_ptr > inopen) {
+ fprintf (stderr, "%s:calledit: unexpected if_ptr=%d not in range 1..%d,",
+ argv[0], if_ptr, inopen);
+ fprintf (stderr, "from input_stack[%d].namefield=%d\n",
+ is_ptr, inputstack[is_ptr].namefield);
+ exit (1);
+ }
+
+#ifdef XeTeX
+ f = inputfile[if_ptr]->f;
+#else
+ f = inputfile[if_ptr];
+#endif
+ /* fprintf (stderr,"calledit: input_stack #%d -> input_file #%d = %x\n",
+ is_ptr, if_ptr, f); */
+ /* Although it should never happen, if the file value happens to
+ be zero, let's not gratuitously abort. */
+ if (f) {
+ xfclose (f, "inputfile");
+ } else {
+ fprintf (stderr, "%s:calledit: not closing unexpected zero", argv[0]);
+ fprintf (stderr, " input_file[%d] from input_stack[%d].namefield=%d\n",
+ if_ptr, is_ptr, inputstack[is_ptr].namefield);
+ }
+ } /* end name_field > 17 */
+ } /* end for loop for input_stack */
+ } /* end block for variable declarations */
+
+ /* Replace the default with the value of the appropriate environment
+ variable or config file value, if it's set. */
+ temp = kpse_var_value (edit_var);
+ if (temp != NULL)
+ edit_value = temp;
+
+ /* Construct the command string. The `11' is the maximum length an
+ integer might be (64 bits). */
+ command = xmalloc (strlen (edit_value) + fnlength + 11);
+
+ /* So we can construct it as we go. */
+ temp = command;
+
+#ifdef WIN32
+ fp = editorname;
+ if ((isalpha(*edit_value) && *(edit_value + 1) == ':'
+ && IS_DIR_SEP (*(edit_value + 2)))
+ || (*edit_value == '"' && isalpha(*(edit_value + 1))
+ && *(edit_value + 2) == ':'
+ && IS_DIR_SEP (*(edit_value + 3)))
+ )
+ dontchange = 1;
+#endif
+
+ while ((c = *edit_value++) != 0)
+ {
+ if (c == '%')
+ {
+ int i;
+ switch (c = *edit_value++)
+ {
+ case 'd':
+ if (ddone)
+ FATAL ("call_edit: `%%d' appears twice in editor command");
+ sprintf (temp, "%ld", (long int)linenumber);
+ while (*temp != '\0')
+ temp++;
+ ddone = 1;
+ break;
+
+ case 's':
+ if (sdone)
+ FATAL ("call_edit: `%%s' appears twice in editor command");
+ for (i =0; i < fnlength; i++)
+ *temp++ = Xchr (filename[i]);
+ sdone = 1;
+ break;
+
+ case '\0':
+ *temp++ = '%';
+ /* Back up to the null to force termination. */
+ edit_value--;
+ break;
+
+ default:
+ *temp++ = '%';
+ *temp++ = c;
+ break;
+ }
+ }
+ else {
+#ifdef WIN32
+ if (dontchange)
+ *temp++ = c;
+ else { if(Isspace(c) && cnt == 0) {
+ cnt++;
+ temp = command;
+ *temp++ = c;
+ *fp = '\0';
+ } else if(!Isspace(c) && cnt == 0) {
+ *fp++ = c;
+ } else {
+ *temp++ = c;
+ }
+ }
+#else
+ *temp++ = c;
+#endif
+ }
+ }
+
+ *temp = 0;
+
+#ifdef WIN32
+ if (dontchange == 0) {
+ if(editorname[0] == '.' ||
+ editorname[0] == '/' ||
+ editorname[0] == '\\') {
+ fprintf(stderr, "%s is not allowed to execute.\n", editorname);
+ uexit(1);
+ }
+ env = (char *)getenv("PATH");
+ if(SearchPath(env, editorname, ".exe", 256, buffer, &ffp)==0) {
+ if(SearchPath(env, editorname, ".bat", 256, buffer, &ffp)==0) {
+ fprintf(stderr, "I cannot find %s in the PATH.\n", editorname);
+ uexit(1);
+ }
+ }
+ fullcmd = (char *)xmalloc(strlen(buffer)+strlen(command)+5);
+ strcpy(fullcmd, "\"");
+ strcat(fullcmd, buffer);
+ strcat(fullcmd, "\"");
+ strcat(fullcmd, command);
+ } else
+#endif
+ fullcmd = command;
+
+ /* Execute the command. */
+ if (system (fullcmd) != 0)
+ fprintf (stderr, "! Trouble executing `%s'.\n", command);
+
+ /* Quit, since we found an error. */
+ uexit (1);
+}
+
+/* Read and write dump files. As distributed, these files are
+ architecture dependent; specifically, BigEndian and LittleEndian
+ architectures produce different files. These routines always output
+ BigEndian files. This still does not guarantee them to be
+ architecture-independent, because it is possible to make a format
+ that dumps a glue ratio, i.e., a floating-point number. Fortunately,
+ none of the standard formats do that. */
+
+#if !defined (WORDS_BIGENDIAN) && !defined (NO_DUMP_SHARE) /* this fn */
+
+/* This macro is always invoked as a statement. It assumes a variable
+ `temp'. */
+
+#define SWAP(x, y) temp = (x); (x) = (y); (y) = temp
+
+
+/* Make the NITEMS items pointed at by P, each of size SIZE, be the
+ opposite-endianness of whatever they are now. */
+
+static void
+swap_items (char *p, int nitems, int size)
+{
+ char temp;
+
+ /* Since `size' does not change, we can write a while loop for each
+ case, and avoid testing `size' for each time. */
+ switch (size)
+ {
+ /* 16-byte items happen on the DEC Alpha machine when we are not
+ doing sharable memory dumps. */
+ case 16:
+ while (nitems--)
+ {
+ SWAP (p[0], p[15]);
+ SWAP (p[1], p[14]);
+ SWAP (p[2], p[13]);
+ SWAP (p[3], p[12]);
+ SWAP (p[4], p[11]);
+ SWAP (p[5], p[10]);
+ SWAP (p[6], p[9]);
+ SWAP (p[7], p[8]);
+ p += size;
+ }
+ break;
+
+ case 8:
+ while (nitems--)
+ {
+ SWAP (p[0], p[7]);
+ SWAP (p[1], p[6]);
+ SWAP (p[2], p[5]);
+ SWAP (p[3], p[4]);
+ p += size;
+ }
+ break;
+
+ case 4:
+ while (nitems--)
+ {
+ SWAP (p[0], p[3]);
+ SWAP (p[1], p[2]);
+ p += size;
+ }
+ break;
+
+ case 2:
+ while (nitems--)
+ {
+ SWAP (p[0], p[1]);
+ p += size;
+ }
+ break;
+
+ case 1:
+ /* Nothing to do. */
+ break;
+
+ default:
+ FATAL1 ("Can't swap a %d-byte item for (un)dumping", size);
+ }
+}
+#endif /* not WORDS_BIGENDIAN and not NO_DUMP_SHARE */
+
+
+/* Here we write NITEMS items, each item being ITEM_SIZE bytes long.
+ The pointer to the stuff to write is P, and we write to the file
+ OUT_FILE. */
+
+void
+#ifdef FMT_COMPRESS
+do_dump (char *p, int item_size, int nitems, gzFile out_file)
+#else
+do_dump (char *p, int item_size, int nitems, FILE *out_file)
+#endif
+{
+#if !defined (WORDS_BIGENDIAN) && !defined (NO_DUMP_SHARE)
+ swap_items (p, nitems, item_size);
+#endif
+
+#ifdef FMT_COMPRESS
+ if (gzwrite (out_file, p, item_size * nitems) != item_size * nitems)
+#else
+ if (fwrite (p, item_size, nitems, out_file) != nitems)
+#endif
+ {
+ fprintf (stderr, "! Could not write %d %d-byte item(s) to %s.\n",
+ nitems, item_size, nameoffile+1);
+ uexit (1);
+ }
+
+ /* Have to restore the old contents of memory, since some of it might
+ get used again. */
+#if !defined (WORDS_BIGENDIAN) && !defined (NO_DUMP_SHARE)
+ swap_items (p, nitems, item_size);
+#endif
+}
+
+
+/* Here is the dual of the writing routine. */
+
+void
+#ifdef FMT_COMPRESS
+do_undump (char *p, int item_size, int nitems, gzFile in_file)
+#else
+do_undump (char *p, int item_size, int nitems, FILE *in_file)
+#endif
+{
+#ifdef FMT_COMPRESS
+ if (gzread (in_file, p, item_size * nitems) != item_size * nitems)
+#else
+ if (fread (p, item_size, nitems, in_file) != (size_t) nitems)
+#endif
+ FATAL3 ("Could not undump %d %d-byte item(s) from %s",
+ nitems, item_size, nameoffile+1);
+
+#if !defined (WORDS_BIGENDIAN) && !defined (NO_DUMP_SHARE)
+ swap_items (p, nitems, item_size);
+#endif
+}
+
+/* Some (most?) of this could be moved to the WEB side, but oh well. */
+#if defined(TeX) || defined(MF)
+#if !defined(pdfTeX)
+static void
+checkpoolpointer (poolpointer poolptr, size_t len)
+{
+ if (poolptr + len >= poolsize) {
+ fprintf (stderr, "\nstring pool overflow [%i bytes]\n",
+ (int)poolsize); /* fixme */
+ exit(1);
+ }
+}
+
+#ifndef XeTeX /* XeTeX uses this from XeTeX_ext.c */
+static
+#endif
+int
+maketexstring(const_string s)
+{
+ size_t len;
+#ifdef XeTeX
+ UInt32 rval;
+ const unsigned char *cp = (const unsigned char *)s;
+#endif
+#if defined(TeX)
+ if (s == NULL || *s == 0)
+ return getnullstr();
+#else
+ assert (s != 0);
+#endif
+ len = strlen(s);
+ checkpoolpointer (poolptr, len); /* in the XeTeX case, this may be more than enough */
+#ifdef XeTeX
+ while ((rval = *(cp++)) != 0) {
+ UInt16 extraBytes = bytesFromUTF8[rval];
+ switch (extraBytes) { /* note: code falls through cases! */
+ case 5: rval <<= 6; if (*cp) rval += *(cp++);
+ case 4: rval <<= 6; if (*cp) rval += *(cp++);
+ case 3: rval <<= 6; if (*cp) rval += *(cp++);
+ case 2: rval <<= 6; if (*cp) rval += *(cp++);
+ case 1: rval <<= 6; if (*cp) rval += *(cp++);
+ case 0: ;
+ };
+ rval -= offsetsFromUTF8[extraBytes];
+ if (rval > 0xffff) {
+ rval -= 0x10000;
+ strpool[poolptr++] = 0xd800 + rval / 0x0400;
+ strpool[poolptr++] = 0xdc00 + rval % 0x0400;
+ }
+ else
+ strpool[poolptr++] = rval;
+ }
+#else /* ! XeTeX */
+ while (len-- > 0)
+ strpool[poolptr++] = *s++;
+#endif /* ! XeTeX */
+
+ return makestring();
+}
+#endif /* !pdfTeX */
+
+strnumber
+makefullnamestring(void)
+{
+ return maketexstring(fullnameoffile);
+}
+
+/* Get the job name to be used, which may have been set from the
+ command line. */
+strnumber
+getjobname(strnumber name)
+{
+ strnumber ret = name;
+ if (c_job_name != NULL)
+ ret = maketexstring(c_job_name);
+ return ret;
+}
+#endif
+
+#if defined(TeX)
+static int
+compare_paths (const_string p1, const_string p2)
+{
+ int ret;
+ while (
+#ifdef MONOCASE_FILENAMES
+ (((ret = (toupper(*p1) - toupper(*p2))) == 0) && (*p2 != 0))
+#else
+ (((ret = (*p1 - *p2)) == 0) && (*p2 != 0))
+#endif
+ || (IS_DIR_SEP(*p1) && IS_DIR_SEP(*p2))) {
+ p1++, p2++;
+ }
+ ret = (ret < 0 ? -1 : (ret > 0 ? 1 : 0));
+ return ret;
+}
+
+#ifdef XeTeX /* the string pool is UTF-16 but we want a UTF-8 string */
+
+string
+gettexstring (strnumber s)
+{
+ unsigned bytesToWrite = 0;
+ poolpointer len, i, j;
+ string name;
+ if (s >= 65536L)
+ len = strstart[s + 1 - 65536L] - strstart[s - 65536L];
+ else
+ len = 0;
+ name = xmalloc(len * 3 + 1); /* max UTF16->UTF8 expansion
+ (code units, not bytes) */
+ for (i = 0, j = 0; i < len; i++) {
+ unsigned c = strpool[i + strstart[s - 65536L]];
+ if (c >= 0xD800 && c <= 0xDBFF) {
+ unsigned lo = strpool[++i + strstart[s - 65536L]];
+ if (lo >= 0xDC00 && lo <= 0xDFFF)
+ c = (c - 0xD800) * 0x0400 + lo - 0xDC00;
+ else
+ c = 0xFFFD;
+ }
+ if (c < 0x80)
+ bytesToWrite = 1;
+ else if (c < 0x800)
+ bytesToWrite = 2;
+ else if (c < 0x10000)
+ bytesToWrite = 3;
+ else if (c < 0x110000)
+ bytesToWrite = 4;
+ else {
+ bytesToWrite = 3;
+ c = 0xFFFD;
+ }
+
+ j += bytesToWrite;
+ switch (bytesToWrite) { /* note: everything falls through. */
+ case 4: name[--j] = ((c | 0x80) & 0xBF); c >>= 6;
+ case 3: name[--j] = ((c | 0x80) & 0xBF); c >>= 6;
+ case 2: name[--j] = ((c | 0x80) & 0xBF); c >>= 6;
+ case 1: name[--j] = (c | firstByteMark[bytesToWrite]);
+ }
+ j += bytesToWrite;
+ }
+ name[j] = 0;
+ return name;
+}
+
+#else
+
+string
+gettexstring (strnumber s)
+{
+ poolpointer len;
+ string name;
+#if !defined(Aleph)
+ len = strstart[s + 1] - strstart[s];
+#else
+ len = strstartar[s + 1 - 65536L] - strstartar[s - 65536L];
+#endif
+ name = (string)xmalloc (len + 1);
+#if !defined(Aleph)
+ strncpy (name, (string)&strpool[strstart[s]], len);
+#else
+ {
+ poolpointer i;
+ /* Don't use strncpy. The strpool is not made up of chars. */
+ for (i=0; i<len; i++) name[i] = strpool[i+strstartar[s - 65536L]];
+ }
+#endif
+ name[len] = 0;
+ return name;
+}
+
+#endif /* not XeTeX */
+
+boolean
+isnewsource (strnumber srcfilename, int lineno)
+{
+ char *name = gettexstring(srcfilename);
+ return (compare_paths(name, last_source_name) != 0 || lineno != last_lineno);
+}
+
+void
+remembersourceinfo (strnumber srcfilename, int lineno)
+{
+ if (last_source_name)
+ free(last_source_name);
+ last_source_name = gettexstring(srcfilename);
+ last_lineno = lineno;
+}
+
+poolpointer
+makesrcspecial (strnumber srcfilename, int lineno)
+{
+ poolpointer oldpoolptr = poolptr;
+ char *filename = gettexstring(srcfilename);
+ /* FIXME: Magic number. */
+ char buf[40];
+ char *s = buf;
+
+ /* Always put a space after the number, which makes things easier
+ * to parse.
+ */
+ sprintf (buf, "src:%d ", lineno);
+
+ if (poolptr + strlen(buf) + strlen(filename) >= (size_t)poolsize) {
+ fprintf (stderr, "\nstring pool overflow\n"); /* fixme */
+ exit (1);
+ }
+ s = buf;
+ while (*s)
+ strpool[poolptr++] = *s++;
+
+ s = filename;
+ while (*s)
+ strpool[poolptr++] = *s++;
+
+ return (oldpoolptr);
+}
+
+/* pdfTeX routines also used for e-pTeX, e-upTeX, and XeTeX */
+#if defined (pdfTeX) || defined (epTeX) || defined (eupTeX) || defined(XeTeX)
+
+#include <kpathsea/c-stat.h>
+#include "md5.h"
+
+#define check_nprintf(size_get, size_want) \
+ if ((unsigned)(size_get) >= (unsigned)(size_want)) \
+ pdftex_fail ("snprintf failed: file %s, line %d", __FILE__, __LINE__);
+# define check_buf(size, buf_size) \
+ if ((unsigned)(size) > (unsigned)(buf_size)) \
+ pdftex_fail("buffer overflow at file %s, line %d", __FILE__, __LINE__ )
+# define xfree(p) do { if (p != NULL) free(p); p = NULL; } while (0)
+# define MAX_CSTRING_LEN 1024 * 1024
+
+#if !defined (pdfTeX)
+# define PRINTF_BUF_SIZE 1024
+static char print_buf[PRINTF_BUF_SIZE];
+
+/* Helper for pdftex_fail. */
+static void
+safe_print(const char *str)
+{
+ const char *c;
+ for (c = str; *c; ++c)
+ print(*c);
+}
+/* pdftex_fail may be called when a buffer overflow has happened/is
+ happening, therefore may not call mktexstring. However, with the
+ current implementation it appears that error messages are misleading,
+ possibly because pool overflows are detected too late.
+
+ The output format of this fuction must be the same as pdf_error in
+ pdftex.web! */
+__attribute__ ((noreturn, format(printf, 1, 2)))
+void pdftex_fail(const char *fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ println();
+ safe_print("!error: ");
+ vsnprintf(print_buf, PRINTF_BUF_SIZE, fmt, args);
+ safe_print(print_buf);
+ va_end(args);
+ println();
+ safe_print(" ==> Fatal error occurred, output file will be damaged!");
+ println();
+ if (kpathsea_debug) {
+ safe_print("kpathsea_debug enabled, calling abort()...");
+ println();
+ abort();
+ } else {
+ exit(EXIT_FAILURE);
+ }
+}
+#endif /* not pdfTeX */
+
+#define TIME_STR_SIZE 30
+char start_time_str[TIME_STR_SIZE];
+static char time_str[TIME_STR_SIZE];
+ /* minimum size for time_str is 24: "D:YYYYmmddHHMMSS+HH'MM'" */
+
+static void
+makepdftime(time_t t, char *time_str, boolean utc)
+{
+ struct tm lt, gmt;
+ size_t size;
+ int i, off, off_hours, off_mins;
+
+ /* get the time */
+ if (utc) {
+ lt = *gmtime(&t);
+ }
+ else {
+ lt = *localtime(&t);
+ }
+ size = strftime(time_str, TIME_STR_SIZE, "D:%Y%m%d%H%M%S", &lt);
+ /* expected format: "YYYYmmddHHMMSS" */
+ if (size == 0) {
+ /* unexpected, contents of time_str is undefined */
+ time_str[0] = '\0';
+ return;
+ }
+
+ /* correction for seconds: %S can be in range 00..61,
+ the PDF reference expects 00..59,
+ therefore we map "60" and "61" to "59" */
+ if (time_str[14] == '6') {
+ time_str[14] = '5';
+ time_str[15] = '9';
+ time_str[16] = '\0'; /* for safety */
+ }
+
+ /* get the time zone offset */
+ gmt = *gmtime(&t);
+
+ /* this calculation method was found in exim's tod.c */
+ off = 60 * (lt.tm_hour - gmt.tm_hour) + lt.tm_min - gmt.tm_min;
+ if (lt.tm_year != gmt.tm_year) {
+ off += (lt.tm_year > gmt.tm_year) ? 1440 : -1440;
+ } else if (lt.tm_yday != gmt.tm_yday) {
+ off += (lt.tm_yday > gmt.tm_yday) ? 1440 : -1440;
+ }
+
+ if (off == 0) {
+ time_str[size++] = 'Z';
+ time_str[size] = 0;
+ } else {
+ off_hours = off / 60;
+ off_mins = abs(off - off_hours * 60);
+ i = snprintf(&time_str[size], 9, "%+03d'%02d'", off_hours, off_mins);
+ check_nprintf(i, 9);
+ }
+}
+
+void
+initstarttime(void)
+{
+ if (!start_time_set) {
+ init_start_time ();
+ if (getenv ("SOURCE_DATE_EPOCH")) {
+ makepdftime (start_time, start_time_str, /* utc= */true);
+ } else {
+ makepdftime (start_time, start_time_str, /* utc= */false);
+ }
+ }
+}
+
+#if defined(_WIN32)
+#undef access
+#undef dir_p
+#define access fsyscp_access
+#define dir_p fsyscp_dir_p
+#endif /* _WIN32 */
+
+/* Search for an input file. If -output-directory is specified look
+ there first. If that fails, do the regular kpse search. */
+string
+find_input_file(integer s)
+{
+ string filename;
+
+#if defined(XeTeX)
+ filename = gettexstring(s);
+#else
+ filename = makecfilename(s);
+#endif
+ /* Look in -output-directory first, if the filename is not
+ absolute. This is because we want the pdf* functions to
+ be able to find the same files as \openin */
+ if (output_directory && !kpse_absolute_p (filename, false)) {
+ string pathname;
+
+ pathname = concat3(output_directory, DIR_SEP_STRING, filename);
+ if (!access(pathname, R_OK) && !dir_p (pathname)) {
+ return pathname;
+ }
+ xfree (pathname);
+ }
+ if (! kpse_in_name_ok(filename)) {
+ return NULL; /* no permission */
+ }
+ return kpse_find_tex(filename);
+}
+
+#if !defined(XeTeX)
+char *
+makecstring(integer s)
+{
+ static char *cstrbuf = NULL;
+ char *p;
+ static int allocsize;
+ int allocgrow, i, l = strstart[s + 1] - strstart[s];
+ check_buf(l + 1, MAX_CSTRING_LEN);
+ if (cstrbuf == NULL) {
+ allocsize = l + 1;
+ cstrbuf = xmallocarray(char, allocsize);
+ } else if (l + 1 > allocsize) {
+ allocgrow = allocsize * 0.2;
+ if (l + 1 - allocgrow > allocsize)
+ allocsize = l + 1;
+ else if (allocsize < MAX_CSTRING_LEN - allocgrow)
+ allocsize += allocgrow;
+ else
+ allocsize = MAX_CSTRING_LEN;
+ cstrbuf = xreallocarray(cstrbuf, char, allocsize);
+ }
+ p = cstrbuf;
+ for (i = 0; i < l; i++)
+ *p++ = strpool[i + strstart[s]];
+ *p = 0;
+ return cstrbuf;
+}
+
+/* makecfilename
+ input/ouput same as makecstring:
+ input: string number
+ output: C string with quotes removed.
+ That means, file names that are legal on some operation systems
+ cannot any more be used since pdfTeX version 1.30.4.
+*/
+char *
+makecfilename(integer s)
+{
+ char *name = makecstring(s);
+ char *p = name;
+ char *q = name;
+
+ while (*p) {
+ if (*p != '"')
+ *q++ = *p;
+ p++;
+ }
+ *q = '\0';
+ return name;
+}
+#endif /* !XeTeX */
+
+void
+getcreationdate(void)
+{
+ size_t len;
+#if defined(XeTeX)
+ int i;
+#endif
+ initstarttime();
+ /* put creation date on top of string pool and update poolptr */
+ len = strlen(start_time_str);
+
+ /* In e-pTeX, "init len => call initstarttime()" (as pdftexdir/utils.c)
+ yields unintentional output. */
+
+ if ((unsigned) (poolptr + len) >= (unsigned) (poolsize)) {
+ poolptr = poolsize;
+ /* error by str_toks that calls str_room(1) */
+ return;
+ }
+
+#if defined(XeTeX)
+ for (i = 0; i < len; i++)
+ strpool[poolptr++] = (uint16_t)start_time_str[i];
+#else
+ memcpy(&strpool[poolptr], start_time_str, len);
+ poolptr += len;
+#endif
+}
+
+void
+getfilemoddate(integer s)
+{
+ struct stat file_data;
+
+ char *file_name = find_input_file(s);
+ if (file_name == NULL) {
+ return; /* empty string */
+ }
+
+ recorder_record_input(file_name);
+ /* get file status */
+#ifdef _WIN32
+ if (fsyscp_stat(file_name, &file_data) == 0) {
+#else
+ if (stat(file_name, &file_data) == 0) {
+#endif
+ size_t len;
+ boolean use_utc = FORCE_SOURCE_DATE_set && SOURCE_DATE_EPOCH_set;
+ makepdftime(file_data.st_mtime, time_str, use_utc);
+ len = strlen(time_str);
+ if ((unsigned) (poolptr + len) >= (unsigned) (poolsize)) {
+ poolptr = poolsize;
+ /* error by str_toks that calls str_room(1) */
+ } else {
+#if defined(XeTeX)
+ int i;
+
+ for (i = 0; i < len; i++)
+ strpool[poolptr++] = (uint16_t)time_str[i];
+#else
+ memcpy(&strpool[poolptr], time_str, len);
+ poolptr += len;
+#endif
+ }
+ }
+ /* else { errno contains error code } */
+
+ xfree(file_name);
+}
+
+void
+getfilesize(integer s)
+{
+ struct stat file_data;
+ int i;
+
+ char *file_name = find_input_file(s);
+ if (file_name == NULL) {
+ return; /* empty string */
+ }
+
+ recorder_record_input(file_name);
+ /* get file status */
+#ifdef _WIN32
+ if (fsyscp_stat(file_name, &file_data) == 0) {
+#else
+ if (stat(file_name, &file_data) == 0) {
+#endif
+ size_t len;
+ char buf[20];
+
+ /* st_size has type off_t */
+ i = snprintf(buf, sizeof(buf),
+ "%lu", (long unsigned int) file_data.st_size);
+ check_nprintf(i, sizeof(buf));
+ len = strlen(buf);
+ if ((unsigned) (poolptr + len) >= (unsigned) (poolsize)) {
+ poolptr = poolsize;
+ /* error by str_toks that calls str_room(1) */
+ } else {
+#if defined(XeTeX)
+ for (i = 0; i < len; i++)
+ strpool[poolptr++] = (uint16_t)buf[i];
+#else
+ memcpy(&strpool[poolptr], buf, len);
+ poolptr += len;
+#endif
+ }
+ }
+ /* else { errno contains error code } */
+
+ xfree(file_name);
+}
+
+void
+getfiledump(integer s, int offset, int length)
+{
+ FILE *f;
+ int read, i;
+#if defined(XeTeX)
+ unsigned char *readbuffer;
+ char strbuf[3];
+ int j, k;
+#else
+ poolpointer data_ptr;
+ poolpointer data_end;
+#endif /* XeTeX */
+ char *file_name;
+
+ if (length == 0) {
+ /* empty result string */
+ return;
+ }
+
+ if (poolptr + 2 * length + 1 >= poolsize) {
+ /* no place for result */
+ poolptr = poolsize;
+ /* error by str_toks that calls str_room(1) */
+ return;
+ }
+
+ file_name = find_input_file(s);
+ if (file_name == NULL) {
+ return; /* empty string */
+ }
+
+ /* read file data */
+ f = fopen(file_name, FOPEN_RBIN_MODE);
+ if (f == NULL) {
+ xfree(file_name);
+ return;
+ }
+ recorder_record_input(file_name);
+ if (fseek(f, offset, SEEK_SET) != 0) {
+ xfree(file_name);
+ return;
+ }
+#if defined(XeTeX)
+ readbuffer = (unsigned char *)xmalloc (length + 1);
+ read = fread(readbuffer, sizeof(char), length, f);
+ fclose(f);
+ for (j = 0; j < read; j++) {
+ i = snprintf (strbuf, 3, "%.2X", (unsigned int)readbuffer[j]);
+ check_nprintf(i, 3);
+ for (k = 0; k < i; k++)
+ strpool[poolptr++] = (uint16_t)strbuf[k];
+ }
+ xfree (readbuffer);
+#else
+ /* there is enough space in the string pool, the read
+ data are put in the upper half of the result, thus
+ the conversion to hex can be done without overwriting
+ unconverted bytes. */
+ data_ptr = poolptr + length;
+ read = fread(&strpool[data_ptr], sizeof(char), length, f);
+ fclose(f);
+
+ /* convert to hex */
+ data_end = data_ptr + read;
+ for (; data_ptr < data_end; data_ptr++) {
+ i = snprintf((char *) &strpool[poolptr], 3,
+ "%.2X", (unsigned int) strpool[data_ptr]);
+ check_nprintf(i, 3);
+ poolptr += i;
+ }
+#endif /* XeTeX */
+ xfree(file_name);
+}
+
+/* Converts any given string in into an allowed PDF string which is
+ * hexadecimal encoded;
+ * sizeof(out) should be at least lin*2+1.
+ */
+void
+convertStringToHexString(const char *in, char *out, int lin)
+{
+ int i, j, k;
+ char buf[3];
+ j = 0;
+ for (i = 0; i < lin; i++) {
+ k = snprintf(buf, sizeof(buf),
+ "%02X", (unsigned int) (unsigned char) in[i]);
+ check_nprintf(k, sizeof(buf));
+ out[j++] = buf[0];
+ out[j++] = buf[1];
+ }
+ out[j] = '\0';
+}
+
+#define DIGEST_SIZE 16
+#define FILE_BUF_SIZE 1024
+
+void
+getmd5sum(strnumber s, boolean file)
+{
+ md5_state_t state;
+ md5_byte_t digest[DIGEST_SIZE];
+ char outbuf[2 * DIGEST_SIZE + 1];
+ int len = 2 * DIGEST_SIZE;
+#if defined(XeTeX)
+ char *xname;
+ int i;
+#endif
+
+ if (file) {
+ char file_buf[FILE_BUF_SIZE];
+ int read = 0;
+ FILE *f;
+ char *file_name;
+
+ file_name = find_input_file(s);
+ if (file_name == NULL) {
+ return; /* empty string */
+ }
+
+ /* in case of error the empty string is returned,
+ no need for xfopen that aborts on error.
+ */
+ f = fopen(file_name, FOPEN_RBIN_MODE);
+ if (f == NULL) {
+ xfree(file_name);
+ return;
+ }
+ recorder_record_input(file_name);
+ md5_init(&state);
+ while ((read = fread(&file_buf, sizeof(char), FILE_BUF_SIZE, f)) > 0) {
+ md5_append(&state, (const md5_byte_t *) file_buf, read);
+ }
+ md5_finish(&state, digest);
+ fclose(f);
+
+ xfree(file_name);
+ } else {
+ /* s contains the data */
+ md5_init(&state);
+#if defined(XeTeX)
+ xname = gettexstring (s);
+ md5_append(&state,
+ (md5_byte_t *) xname,
+ strlen (xname));
+ xfree (xname);
+#else
+ md5_append(&state,
+ (md5_byte_t *) &strpool[strstart[s]],
+ strstart[s + 1] - strstart[s]);
+#endif
+ md5_finish(&state, digest);
+ }
+
+ if (poolptr + len >= poolsize) {
+ /* error by str_toks that calls str_room(1) */
+ return;
+ }
+ convertStringToHexString((char *) digest, outbuf, DIGEST_SIZE);
+#if defined(XeTeX)
+ for (i = 0; i < 2 * DIGEST_SIZE; i++)
+ strpool[poolptr++] = (uint16_t)outbuf[i];
+#else
+ memcpy(&strpool[poolptr], outbuf, len);
+ poolptr += len;
+#endif
+}
+
+#endif /* pdfTeX or e-pTeX or e-upTeX or XeTeX */
+#endif /* TeX */
+
+/* Metafont/MetaPost fraction routines. Replaced either by assembler or C.
+ The assembler syntax doesn't work on Solaris/x86. */
+#ifndef TeX
+#if defined (__sun__) || defined (__cplusplus)
+#define NO_MF_ASM
+#endif
+/* The assembler code is not PIC safe on i?86 so use C code. */
+#if defined (__PIC__) && defined (__i386__)
+#define NO_MF_ASM
+#endif
+#if defined(WIN32) && !defined(NO_MF_ASM) && !defined(__MINGW32__)
+#include "lib/mfmpw32.c"
+#elif defined (__i386__) && defined (__GNUC__) && !defined (NO_MF_ASM)
+#include "lib/mfmpi386.asm"
+#else
+/* Replace fixed-point fraction routines from mf.web and mp.web with
+ Hobby's floating-point C code. */
+
+/****************************************************************
+Copyright 1990 - 1995 by AT&T Bell Laboratories.
+
+Permission to use, copy, modify, and distribute this software
+and its documentation for any purpose and without fee is hereby
+granted, provided that the above copyright notice appear in all
+copies and that both that the copyright notice and this
+permission notice and warranty disclaimer appear in supporting
+documentation, and that the names of AT&T Bell Laboratories or
+any of its entities not be used in advertising or publicity
+pertaining to distribution of the software without specific,
+written prior permission.
+
+AT&T disclaims all warranties with regard to this software,
+including all implied warranties of merchantability and fitness.
+In no event shall AT&T be liable for any special, indirect or
+consequential damages or any damages whatsoever resulting from
+loss of use, data or profits, whether in an action of contract,
+negligence or other tortious action, arising out of or in
+connection with the use or performance of this software.
+****************************************************************/
+
+/**********************************************************
+ The following is by John Hobby
+ **********************************************************/
+
+#ifndef FIXPT
+
+/* These replacements for takefraction, makefraction, takescaled, makescaled
+ run about 3 to 11 times faster than the standard versions on modern machines
+ that have fast hardware for double-precision floating point. They should
+ produce approximately correct results on all machines and agree exactly
+ with the standard versions on machines that satisfy the following conditions:
+ 1. Doubles must have at least 46 mantissa bits; i.e., numbers expressible
+ as n*2^k with abs(n)<2^46 should be representable.
+ 2. The following should hold for addition, subtraction, and multiplcation but
+ not necessarily for division:
+ A. If the true answer is between two representable numbers, the computed
+ answer must be one of them.
+ B. When the true answer is representable, this must be the computed result.
+ 3. Dividing one double by another should always produce a relative error of
+ at most one part in 2^46. (This is why the mantissa requirement is
+ 46 bits instead of 45 bits.)
+ 3. In the absence of overflow, double-to-integer conversion should truncate
+ toward zero and do this in an exact fashion.
+ 4. Integer-to-double convesion should produce exact results.
+ 5. Dividing one power of two by another should yield an exact result.
+ 6. ASCII to double conversion should be exact for integer values.
+ 7. Integer arithmetic must be done in the two's-complement system.
+*/
+#define ELGORDO 0x7fffffff
+#define TWEXP31 2147483648.0
+#define TWEXP28 268435456.0
+#define TWEXP16 65536.0
+#define TWEXP_16 (1.0/65536.0)
+#define TWEXP_28 (1.0/268435456.0)
+
+integer
+ztakefraction (integer p, integer q) /* Approximate p*q/2^28 */
+{ register double d;
+ register integer i;
+ d = (double)p * (double)q * TWEXP_28;
+ if ((p^q) >= 0) {
+ d += 0.5;
+ if (d>=TWEXP31) {
+ if (d!=TWEXP31 || (((p&077777)*(q&077777))&040000)==0)
+ aritherror = true;
+ return ELGORDO;
+ }
+ i = (integer) d;
+ if (d==i && (((p&077777)*(q&077777))&040000)!=0) --i;
+ } else {
+ d -= 0.5;
+ if (d<= -TWEXP31) {
+ if (d!= -TWEXP31 || ((-(p&077777)*(q&077777))&040000)==0)
+ aritherror = true;
+ return -ELGORDO;
+ }
+ i = (integer) d;
+ if (d==i && ((-(p&077777)*(q&077777))&040000)!=0) ++i;
+ }
+ return i;
+}
+
+integer
+ztakescaled (integer p, integer q) /* Approximate p*q/2^16 */
+{ register double d;
+ register integer i;
+ d = (double)p * (double)q * TWEXP_16;
+ if ((p^q) >= 0) {
+ d += 0.5;
+ if (d>=TWEXP31) {
+ if (d!=TWEXP31 || (((p&077777)*(q&077777))&040000)==0)
+ aritherror = true;
+ return ELGORDO;
+ }
+ i = (integer) d;
+ if (d==i && (((p&077777)*(q&077777))&040000)!=0) --i;
+ } else {
+ d -= 0.5;
+ if (d<= -TWEXP31) {
+ if (d!= -TWEXP31 || ((-(p&077777)*(q&077777))&040000)==0)
+ aritherror = true;
+ return -ELGORDO;
+ }
+ i = (integer) d;
+ if (d==i && ((-(p&077777)*(q&077777))&040000)!=0) ++i;
+ }
+ return i;
+}
+
+/* Note that d cannot exactly equal TWEXP31 when the overflow test is made
+ because the exact value of p/q cannot be strictly between (2^31-1)/2^28
+ and 8/1. No pair of integers less than 2^31 has such a ratio.
+*/
+integer
+zmakefraction (integer p, integer q) /* Approximate 2^28*p/q */
+{ register double d;
+ register integer i;
+#ifdef DEBUG
+ if (q==0) confusion(47);
+#endif /* DEBUG */
+ d = TWEXP28 * (double)p /(double)q;
+ if ((p^q) >= 0) {
+ d += 0.5;
+ if (d>=TWEXP31) {aritherror=true; return ELGORDO;}
+ i = (integer) d;
+ if (d==i && ( ((q>0 ? -q : q)&077777)
+ * (((i&037777)<<1)-1) & 04000)!=0) --i;
+ } else {
+ d -= 0.5;
+ if (d<= -TWEXP31) {aritherror=true; return -ELGORDO;}
+ i = (integer) d;
+ if (d==i && ( ((q>0 ? q : -q)&077777)
+ * (((i&037777)<<1)+1) & 04000)!=0) ++i;
+ }
+ return i;
+}
+
+/* Note that d cannot exactly equal TWEXP31 when the overflow test is made
+ because the exact value of p/q cannot be strictly between (2^31-1)/2^16
+ and 2^15/1. No pair of integers less than 2^31 has such a ratio.
+*/
+integer
+zmakescaled (integer p, integer q) /* Approximate 2^16*p/q */
+{ register double d;
+ register integer i;
+#ifdef DEBUG
+ if (q==0) confusion(47);
+#endif /* DEBUG */
+ d = TWEXP16 * (double)p /(double)q;
+ if ((p^q) >= 0) {
+ d += 0.5;
+ if (d>=TWEXP31) {aritherror=true; return ELGORDO;}
+ i = (integer) d;
+ if (d==i && ( ((q>0 ? -q : q)&077777)
+ * (((i&037777)<<1)-1) & 04000)!=0) --i;
+ } else {
+ d -= 0.5;
+ if (d<= -TWEXP31) {aritherror=true; return -ELGORDO;}
+ i = (integer) d;
+ if (d==i && ( ((q>0 ? q : -q)&077777)
+ * (((i&037777)<<1)+1) & 04000)!=0) ++i;
+ }
+ return i;
+}
+
+#endif /* not FIXPT */
+#endif /* not assembler */
+#endif /* not TeX, i.e., MF */
+
+#ifdef MF
+/* On-line display routines for Metafont. Here we use a dispatch table
+ indexed by the MFTERM or TERM environment variable to select the
+ graphics routines appropriate to the user's terminal. stdout must be
+ connected to a terminal for us to do any graphics. */
+
+#ifdef MFNOWIN
+#undef AMIGAWIN
+#undef EPSFWIN
+#undef HP2627WIN
+#undef MFTALKWIN
+#undef NEXTWIN
+#undef REGISWIN
+#undef SUNWIN
+#undef TEKTRONIXWIN
+#undef UNITERMWIN
+#undef WIN32WIN
+#undef X11WIN
+#endif
+
+/* Prototypes for Metafont display routines: mf_XXX_initscreen,
+ mf_XXX_updatescreen, mf_XXX_blankrectangle, and mf_XXX_paintrow. */
+#include <window/mfdisplay.h>
+
+/* This variable, `mfwsw', contains the dispatch tables for each
+ terminal. We map the Pascal calls to the routines `init_screen',
+ `update_screen', `blank_rectangle', and `paint_row' into the
+ appropriate entry point for the specific terminal that MF is being
+ run on. */
+
+struct mfwin_sw
+{
+ const char *mfwsw_type; /* Name of terminal a la TERMCAP. */
+ int (*mfwsw_initscreen) (void);
+ void (*mfwsw_updatescrn) (void);
+ void (*mfwsw_blankrect) (screencol, screencol, screenrow, screenrow);
+ void (*mfwsw_paintrow) (screenrow, pixelcolor, transspec, screencol);
+} mfwsw[] =
+{
+#ifdef AMIGAWIN
+ { "amiterm", mf_amiga_initscreen, mf_amiga_updatescreen,
+ mf_amiga_blankrectangle, mf_amiga_paintrow },
+#endif
+#ifdef EPSFWIN
+ { "epsf", mf_epsf_initscreen, mf_epsf_updatescreen,
+ mf_epsf_blankrectangle, mf_epsf_paintrow },
+#endif
+#ifdef HP2627WIN
+ { "hp2627", mf_hp2627_initscreen, mf_hp2627_updatescreen,
+ mf_hp2627_blankrectangle, mf_hp2627_paintrow },
+#endif
+#ifdef MFTALKWIN
+ { "mftalk", mf_mftalk_initscreen, mf_mftalk_updatescreen,
+ mf_mftalk_blankrectangle, mf_mftalk_paintrow },
+#endif
+#ifdef NEXTWIN
+ { "next", mf_next_initscreen, mf_next_updatescreen,
+ mf_next_blankrectangle, mf_next_paintrow },
+#endif
+#ifdef REGISWIN
+ { "regis", mf_regis_initscreen, mf_regis_updatescreen,
+ mf_regis_blankrectangle, mf_regis_paintrow },
+#endif
+#ifdef SUNWIN
+ { "sun", mf_sun_initscreen, mf_sun_updatescreen,
+ mf_sun_blankrectangle, mf_sun_paintrow },
+#endif
+#ifdef TEKTRONIXWIN
+ { "tek", mf_tektronix_initscreen, mf_tektronix_updatescreen,
+ mf_tektronix_blankrectangle, mf_tektronix_paintrow },
+#endif
+#ifdef UNITERMWIN
+ { "uniterm", mf_uniterm_initscreen, mf_uniterm_updatescreen,
+ mf_uniterm_blankrectangle, mf_uniterm_paintrow },
+#endif
+#ifdef WIN32WIN
+ { "win32term", mf_win32_initscreen, mf_win32_updatescreen,
+ mf_win32_blankrectangle, mf_win32_paintrow },
+#endif
+#ifdef X11WIN
+ { "xterm", mf_x11_initscreen, mf_x11_updatescreen,
+ mf_x11_blankrectangle, mf_x11_paintrow },
+#endif
+
+ /* Always support this. */
+ { "trap", mf_trap_initscreen, mf_trap_updatescreen,
+ mf_trap_blankrectangle, mf_trap_paintrow },
+
+/* Finally, we must have an entry with a terminal type of NULL. */
+ { NULL, NULL, NULL, NULL, NULL }
+
+}; /* End of the array initialization. */
+
+
+/* This is a pointer to the mfwsw[] entry that we find. */
+static struct mfwin_sw *mfwp;
+
+
+/* The following are routines that just jump to the correct
+ terminal-specific graphics code. If none of the routines in the
+ dispatch table exist, or they fail, we produce trap-compatible
+ output, i.e., the same words and punctuation that the unchanged
+ mf.web would produce. */
+
+
+/* This returns true if we can do window operations, else false. */
+
+boolean
+initscreen (void)
+{
+ int retval;
+ /* If MFTERM is set, use it. */
+ const_string tty_type = kpse_var_value ("MFTERM");
+
+ if (tty_type == NULL)
+ {
+#if defined (AMIGA)
+ tty_type = "amiterm";
+#elif defined (WIN32)
+ tty_type = "win32term";
+#elif defined (OS2) || defined (__DJGPP__) /* not AMIGA nor WIN32 */
+ tty_type = "mftalk";
+#else /* not (OS2 or WIN32 or __DJGPP__ or AMIGA) */
+ /* If DISPLAY is set, we are X11; otherwise, who knows. */
+ boolean have_display = getenv ("DISPLAY") != NULL;
+ tty_type = have_display ? "xterm" : getenv ("TERM");
+
+ /* If we don't know what kind of terminal this is, or if Metafont
+ isn't being run interactively, don't do any online output. */
+ if (tty_type == NULL
+ || (!STREQ (tty_type, "trap") && !isatty (fileno (stdout))))
+ return 0;
+#endif /* not (OS2 or WIN32 or __DJGPP__ or AMIGA) */
+ }
+
+ /* Test each of the terminals given in `mfwsw' against the terminal
+ type, and take the first one that matches, or if the user is running
+ under Emacs, the first one. */
+ for (mfwp = mfwsw; mfwp->mfwsw_type != NULL; mfwp++) {
+ if (!strncmp (mfwp->mfwsw_type, tty_type, strlen (mfwp->mfwsw_type))
+ || STREQ (tty_type, "emacs")) {
+ if (mfwp->mfwsw_initscreen) {
+ retval = (*mfwp->mfwsw_initscreen) ();
+#ifdef WIN32
+ Sleep(1000); /* Wait for opening a window */
+#endif
+ return retval;
+ }
+ else {
+ fprintf (stderr, "mf: Couldn't initialize online display for `%s'.\n",
+ tty_type);
+ break;
+ }
+ }
+ }
+
+ /* The current terminal type wasn't found in any of the entries, or
+ initalization failed, so silently give up, assuming that the user
+ isn't on a terminal that supports graphic output. */
+ return 0;
+}
+
+
+/* Make sure everything is visible. */
+
+void
+updatescreen (void)
+{
+ if (mfwp->mfwsw_updatescrn)
+ (*mfwp->mfwsw_updatescrn) ();
+}
+
+
+/* This sets the rectangle bounded by ([left,right], [top,bottom]) to
+ the background color. */
+
+void
+blankrectangle (screencol left, screencol right,
+ screenrow top, screenrow bottom)
+{
+ if (mfwp->mfwsw_blankrect)
+ (*mfwp->mfwsw_blankrect) (left, right, top, bottom);
+}
+
+
+/* This paints ROW, starting with the color INIT_COLOR.
+ TRANSITION_VECTOR then specifies the length of the run; then we
+ switch colors. This goes on for VECTOR_SIZE transitions. */
+
+void
+paintrow (screenrow row, pixelcolor init_color,
+ transspec transition_vector, screencol vector_size)
+{
+ if (mfwp->mfwsw_paintrow)
+ (*mfwp->mfwsw_paintrow) (row, init_color, transition_vector, vector_size);
+}
+#endif /* MF */
diff --git a/Build/source/texk/web2c/lib/uexit.c b/Build/source/texk/web2c/lib/uexit.c
new file mode 100644
index 00000000000..90a4d9f76a4
--- /dev/null
+++ b/Build/source/texk/web2c/lib/uexit.c
@@ -0,0 +1,20 @@
+/* uexit.c: define uexit to do an exit with the right status. We can't
+ just call `exit' from the web files, since the webs use `exit' as a
+ loop label. Public domain. */
+
+#include <w2c/config.h>
+
+void
+uexit (int unix_code)
+{
+ int final_code;
+
+ if (unix_code == 0)
+ final_code = EXIT_SUCCESS;
+ else if (unix_code == 1)
+ final_code = EXIT_FAILURE;
+ else
+ final_code = unix_code;
+
+ exit (final_code);
+}
diff --git a/Build/source/texk/web2c/lib/usage.c b/Build/source/texk/web2c/lib/usage.c
new file mode 100644
index 00000000000..4c6bc5bbe0a
--- /dev/null
+++ b/Build/source/texk/web2c/lib/usage.c
@@ -0,0 +1,35 @@
+/* usage.c: Output a help message (from help.h).
+
+ Modified in 2001 by O. Weber.
+ Written in 1995 by K. Berry. Public domain. */
+
+#include <w2c/config.h>
+
+/* Call usage if the program exits with an "usage error". STR is supposed
+ to be the program name. */
+
+void
+usage (const_string str)
+{
+ fprintf (stderr, "Try `%s --help' for more information.\n", str);
+ uexit (1);
+}
+
+/* Call usage if the program exits by printing the help message.
+ MESSAGE is a NULL-terminated array of strings which make up the
+ help message. Each string is printed on a separate line.
+ We use arrays instead of a single string to work around compiler
+ limitations (sigh).
+*/
+void
+usagehelp (const_string *message, const_string bug_email)
+{
+ if (!bug_email)
+ bug_email = "tex-k@tug.org";
+ while (*message) {
+ printf("%s\n", *message);
+ ++message;
+ }
+ printf("\nEmail bug reports to %s.\n", bug_email);
+ uexit(0);
+}
diff --git a/Build/source/texk/web2c/lib/version.c b/Build/source/texk/web2c/lib/version.c
new file mode 100644
index 00000000000..054b0abc0be
--- /dev/null
+++ b/Build/source/texk/web2c/lib/version.c
@@ -0,0 +1,6 @@
+#include <w2c/c-auto.h>
+
+/* This string is appended to all the banners and used in --version. */
+/* Public domain. */
+
+const char *versionstring = WEB2CVERSION;
diff --git a/Build/source/texk/web2c/lib/zround.c b/Build/source/texk/web2c/lib/zround.c
new file mode 100644
index 00000000000..e51eed8fa2a
--- /dev/null
+++ b/Build/source/texk/web2c/lib/zround.c
@@ -0,0 +1,42 @@
+/* zround.c: round R to the nearest whole number. This is supposed to
+ implement the predefined Pascal round function. Public domain. */
+
+#include <w2c/config.h>
+#include "lib.h"
+
+integer
+zround (double r)
+{
+ integer i;
+
+ /* R can be outside the range of an integer if glue is stretching or
+ shrinking a lot. We can't do any better than returning the largest
+ or smallest integer possible in that case. It doesn't seem to make
+ any practical difference. Here is a sample input file which
+ demonstrates the problem, from phil@cs.arizona.edu:
+ \documentstyle{article}
+ \begin{document}
+ \begin{flushleft}
+ $\hbox{} $\hfill
+ \filbreak
+ \eject
+
+ djb@silverton.berkeley.edu points out we should testing against
+ TeX's largest or smallest integer (32 bits), not the machine's. So
+ we might as well use a floating-point constant, and avoid potential
+ compiler bugs (also noted by djb, on BSDI). */
+ if (r > 2147483647.0)
+ i = 2147483647;
+ /* should be ...8, but atof bugs are too common */
+ else if (r < -2147483647.0)
+ i = -2147483647;
+ /* Admittedly some compilers don't follow the ANSI rules of casting
+ meaning truncating toward zero; but it doesn't matter enough to do
+ anything more complicated here. */
+ else if (r >= 0.0)
+ i = (integer)(r + 0.5);
+ else
+ i = (integer)(r - 0.5);
+
+ return i;
+}