1: /*
   2:  * Copyright (c) 1983 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  */
   6: 
   7: #ifndef lint
   8: char copyright[] =
   9: "@(#) Copyright (c) 1980 Regents of the University of California.\n\
  10:  All rights reserved.\n";
  11: #endif not lint
  12: 
  13: #ifndef lint
  14: static char sccsid[] = "@(#)main.c	5.1 (Berkeley) 5/29/85";
  15: #endif not lint
  16: 
  17: #include "externs.h"
  18: 
  19: /*ARGSUSED*/
  20: main(argc, argv)
  21:     int argc;
  22:     register char **argv;
  23: {
  24:     register char *p;
  25:     int i;
  26:     extern char _sobuf[];
  27: 
  28:     setbuf(stdout, _sobuf);
  29:     (void) srand(getpid());
  30:     issetuid = getuid() != geteuid();
  31:     if (p = rindex(*argv, '/'))
  32:         p++;
  33:     else
  34:         p = *argv;
  35:     if (strcmp(p, "driver") == 0 || strcmp(p, "saildriver") == 0)
  36:         mode = MODE_DRIVER;
  37:     else if (strcmp(p, "sail.log") == 0)
  38:         mode = MODE_LOGGER;
  39:     else
  40:         mode = MODE_PLAYER;
  41:     while ((p = *++argv) && *p == '-')
  42:         switch (p[1]) {
  43:         case 'd':
  44:             mode = MODE_DRIVER;
  45:             break;
  46:         case 's':
  47:             mode = MODE_LOGGER;
  48:             break;
  49:         case 'D':
  50:             debug++;
  51:             break;
  52:         case 'x':
  53:             randomize;
  54:             break;
  55:         case 'l':
  56:             longfmt++;
  57:             break;
  58:         case 'b':
  59:             nobells++;
  60:             break;
  61:         default:
  62:             fprintf(stderr, "SAIL: Unknown flag %s.\n", p);
  63:             exit(1);
  64:         }
  65:     if (*argv)
  66:         game = atoi(*argv);
  67:     else
  68:         game = -1;
  69:     if (i = setjmp(restart))
  70:         mode = i;
  71:     switch (mode) {
  72:     case MODE_PLAYER:
  73:         return pl_main();
  74:     case MODE_DRIVER:
  75:         return dr_main();
  76:     case MODE_LOGGER:
  77:         return lo_main();
  78:     default:
  79:         fprintf(stderr, "SAIL: Unknown mode %d.\n", mode);
  80:         abort();
  81:     }
  82:     /*NOTREACHED*/
  83: }

Defined functions

main defined in line 20; never used

Defined variables

copyright defined in line 8; never used
sccsid defined in line 14; never used
Last modified: 1985-05-30
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 687
Valid CSS Valid XHTML 1.0 Strict