From ad547a6b5986815fda458221149728d9d9ab1d87 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 25 Feb 2021 19:22:25 +0000 Subject: restore Build,TODO from r57911 git-svn-id: svn://tug.org/texlive/trunk@57915 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/lib/main.c | 45 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Build/source/texk/web2c/lib/main.c (limited to 'Build/source/texk/web2c/lib/main.c') 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 +#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]; +} -- cgit v1.2.3