|
|
1.1 root 1: /*
2: * Copyright (c) 1983 Regents of the University of California.
3: * All rights reserved.
4: *
5: * Redistribution and use in source and binary forms are permitted
6: * provided that: (1) source distributions retain this entire copyright
7: * notice and comment, and (2) distributions including binaries display
8: * the following acknowledgement: ``This product includes software
9: * developed by the University of California, Berkeley and its contributors''
10: * in the documentation or other materials provided with the distribution
11: * and in all advertising materials mentioning features or use of this
12: * software. Neither the name of the University nor the names of its
13: * contributors may be used to endorse or promote products derived
14: * from this software without specific prior written permission.
15: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
16: * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
17: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18: */
19:
20: #ifndef lint
21: char copyright[] =
22: "@(#) Copyright (c) 1983 Regents of the University of California.\n\
23: All rights reserved.\n";
24: #endif /* not lint */
25:
26: #ifndef lint
27: static char sccsid[] = "@(#)main.c 5.5 (Berkeley) 6/1/90";
28: #endif /* not lint */
29:
30: #include "externs.h"
31:
32: /*ARGSUSED*/
33: main(argc, argv)
34: int argc;
35: register char **argv;
36: {
37: register char *p;
38: int i;
39:
40: (void) srand(getpid());
41: issetuid = getuid() != geteuid();
42: if (p = rindex(*argv, '/'))
43: p++;
44: else
45: p = *argv;
46: if (strcmp(p, "driver") == 0 || strcmp(p, "saildriver") == 0)
47: mode = MODE_DRIVER;
48: else if (strcmp(p, "sail.log") == 0)
49: mode = MODE_LOGGER;
50: else
51: mode = MODE_PLAYER;
52: while ((p = *++argv) && *p == '-')
53: switch (p[1]) {
54: case 'd':
55: mode = MODE_DRIVER;
56: break;
57: case 's':
58: mode = MODE_LOGGER;
59: break;
60: case 'D':
61: debug++;
62: break;
63: case 'x':
64: randomize;
65: break;
66: case 'l':
67: longfmt++;
68: break;
69: case 'b':
70: nobells++;
71: break;
72: default:
73: fprintf(stderr, "SAIL: Unknown flag %s.\n", p);
74: exit(1);
75: }
76: if (*argv)
77: game = atoi(*argv);
78: else
79: game = -1;
80: if (i = setjmp(restart))
81: mode = i;
82: switch (mode) {
83: case MODE_PLAYER:
84: return pl_main();
85: case MODE_DRIVER:
86: return dr_main();
87: case MODE_LOGGER:
88: return lo_main();
89: default:
90: fprintf(stderr, "SAIL: Unknown mode %d.\n", mode);
91: abort();
92: }
93: /*NOTREACHED*/
94: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.