-static void
-do_options(int c, char *op[])
-{
- register int i;
-
- if (c > 1) {
- for (i = 1; i < c; i++) {
- switch (op[i][0]) {
- default:
- case '?':
- (void) fprintf(stderr, "Usage: battle [-s | -b] [-c]\n");
- (void) fprintf(stderr, "\tWhere the options are:\n");
- (void) fprintf(stderr, "\t-s : play a salvo game\n");
- (void) fprintf(stderr, "\t-b : play a blitz game\n");
- (void) fprintf(stderr, "\t-c : ships may be adjacent\n");
- ExitProgram(EXIT_FAILURE);
- break;
- case '-':
- switch (op[i][1]) {
- case 'b':
- blitz = 1;
- if (salvo == 1) {
- (void) fprintf(stderr,
- "Bad Arg: -b and -s are mutually exclusive\n");
- ExitProgram(EXIT_FAILURE);
- }
- break;
- case 's':
- salvo = 1;
- if (blitz == 1) {
- (void) fprintf(stderr,
- "Bad Arg: -s and -b are mutually exclusive\n");
- ExitProgram(EXIT_FAILURE);
- }
- break;
- case 'c':
- closepack = 1;
- break;
- default:
- (void) fprintf(stderr,
- "Bad arg: type \"%s ?\" for usage message\n",
- op[0]);
- ExitProgram(EXIT_FAILURE);
- }
- }
- }
- }
-}
-