Back to index

tetex-bin  3.0
main.c
Go to the documentation of this file.
00001 /* main.c -- the main program for everything but TeX & MF.  */
00002 /* Public domain. */
00003 
00004 #include "config.h"
00005 
00006 
00007 /* These variables are referenced from the change files.  */
00008 char **argv;
00009 int argc;
00010 
00011 /* The entry point for all the programs except TeX and Metafont, which
00012    have more to do.  We just have to set up the command line.  web2c
00013    transforms Pascal's main block into a procedure `main_body'.  */
00014 
00015 int main P2C(int, ac,  string *, av)
00016 {
00017 #ifdef __EMX__
00018   _wildcard (&ac, &av);
00019   _response (&ac, &av);
00020 #endif
00021   extern void mainbody P1H(void);
00022 
00023   argc = ac;
00024   argv = av;
00025   mainbody ();
00026   return EXIT_SUCCESS;
00027 }
00028 
00029 
00030 /* Return the Nth (counted as in C) argument from the command line.  */
00031 
00032 string 
00033 cmdline P1C(int, n)
00034 {
00035   if (n >= argc)
00036     { /* This error message should never happen, because the callers
00037          should always check they've got the arguments they expect.  */
00038       fprintf (stderr, "%s: Oops; not enough arguments.\n", argv[0]);
00039       uexit (1);
00040     }
00041   return argv[n];
00042 }