| 1 |
/* main.c -- the main program for everything but TeX & MF. */ |
| 2 |
/* Public domain. */ |
| 3 |
|
| 4 |
#include <w2c/config.h> |
| 5 |
#include "lib.h" |
| 6 |
|
| 7 |
/* These variables are referenced from the change files. */ |
| 8 |
char **argv; |
| 9 |
int argc; |
| 10 |
|
| 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) |
| 16 |
{ |
| 17 |
#ifdef __EMX__ |
| 18 |
_wildcard (&ac, &av); |
| 19 |
_response (&ac, &av); |
| 20 |
#endif |
| 21 |
|
| 22 |
#ifdef WIN32 |
| 23 |
_setmaxstdio(2048); |
| 24 |
#endif |
| 25 |
|
| 26 |
argc = ac; |
| 27 |
argv = av; |
| 28 |
mainbody (); |
| 29 |
return EXIT_SUCCESS; |
| 30 |
} |
| 31 |
|
| 32 |
|
| 33 |
/* Return the Nth (counted as in C) argument from the command line. */ |
| 34 |
|
| 35 |
string |
| 36 |
cmdline (int n) |
| 37 |
{ |
| 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); |
| 43 |
} |
| 44 |
return argv[n]; |
| 45 |
} |