FreeBSD Bugzilla – Attachment 13220 Details for
Bug 25278
[patch] bs accepts -s -c but not -sc
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 2.51 KB, created by
Andrew Stevenson
on 2001-02-22 12:40:01 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Andrew Stevenson
Created:
2001-02-22 12:40:01 UTC
Size:
2.51 KB
patch
obsolete
>--- /usr/src/games/bs/bs.c Mon Feb 21 13:07:31 2000 >+++ bs.c Thu Feb 22 22:25:08 2001 >@@ -9,14 +9,15 @@ > * $FreeBSD: src/games/bs/bs.c,v 1.9 2000/02/21 03:07:31 billf Exp $ > */ > >+#include <assert.h> >+#include <ctype.h> > #include <ncurses.h> > #include <signal.h> >-#include <ctype.h> >-#include <assert.h> > #include <stdlib.h> >-#include <unistd.h> >-#include <time.h> > #include <string.h> >+#include <sysexits.h> >+#include <time.h> >+#include <unistd.h> > > #ifndef A_UNDERLINE /* BSD curses */ > #define beep() write(1,"\007",1); >@@ -1110,58 +1111,50 @@ > return(sgetc("YN") == 'Y'); > } > >-static void do_options(c,op) >-int c; >-char *op[]; >+static void usage() > { >- 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"); >- exit(1); >- break; >- case '-': >- switch(op[i][1]) >- { >- case 'b': >+ (void) fprintf(stderr, "Usage: bs [-s | -b] [-c]\n" >+ "\tWhere the options are:\n" >+ "\t-s : play a salvo game\n" >+ "\t-b : play a blitz game\n" >+ "\t-c : ships may be adjacent\n"); >+ exit(EX_USAGE); >+} >+ >+static void do_options(argc,argv) >+int argc; >+char *argv[]; >+{ >+ int c; >+ >+ while ((c = getopt(argc, argv, "bcs")) != -1) { >+ switch (c) { >+ case 'b': >+ if (salvo == 1) { >+ (void) fprintf(stderr, >+ "Bad Arg: -b and -s are mutually exclusive\n"); >+ exit(EX_USAGE); >+ } else { > blitz = 1; >- if (salvo == 1) >- { >- (void) fprintf(stderr, >- "Bad Arg: -b and -s are mutually exclusive\n"); >- exit(1); >- } >- break; >- case 's': >- salvo = 1; >- if (blitz == 1) >- { >- (void) fprintf(stderr, >- "Bad Arg: -s and -b are mutually exclusive\n"); >- exit(1); >- } >- break; >- case 'c': >- closepack = 1; >- break; >- default: >+ } >+ break; >+ case 'c': >+ closepack = 1; >+ break; >+ case 's': >+ if (blitz == 1) { > (void) fprintf(stderr, >- "Bad arg: type \"%s ?\" for usage message\n", op[0]); >- exit(1); >+ "Bad Arg: -s and -b are mutually exclusive\n"); >+ exit(EX_USAGE); >+ } else { >+ salvo = 1; > } >- } >- } >+ break; >+ case '?': >+ default: >+ usage(); >+ } > } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 25278
:
13219
| 13220 |
13221
|
13222