beta-0.89.2
[luatex.git] / source / texk / web2c / lib / main.c
blobd3f5a45aa43522c317a2cf659b5c683eb7db01cd
1 /* main.c -- the main program for everything but TeX & MF. */
2 /* Public domain. */
4 #include <w2c/config.h>
5 #include "lib.h"
7 /* These variables are referenced from the change files. */
8 char **argv;
9 int argc;
11 /* The entry point for all the programs except TeX and Metafont, which
12 have more to do. We just have to set up the command line. web2c
13 transforms Pascal's main block into a procedure `main_body'. */
14 int
15 main (int ac, string* av)
17 #ifdef __EMX__
18 _wildcard (&ac, &av);
19 _response (&ac, &av);
20 #endif
22 #ifdef WIN32
23 _setmaxstdio(2048);
24 #endif
26 argc = ac;
27 argv = av;
28 mainbody ();
29 return EXIT_SUCCESS;
33 /* Return the Nth (counted as in C) argument from the command line. */
35 string
36 cmdline (int n)
38 if (n >= argc)
39 { /* This error message should never happen, because the callers
40 should always check they've got the arguments they expect. */
41 fprintf (stderr, "%s: Oops; not enough arguments.\n", argv[0]);
42 uexit (1);
44 return argv[n];