summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/lib/main.c
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/main.c
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/main.c')
-rw-r--r--Build/source/texk/web2c/lib/main.c45
1 files changed, 45 insertions, 0 deletions
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];
+}