summaryrefslogtreecommitdiffstats
path: root/games
diff options
context:
space:
mode:
authormax <max@FreeBSD.org>1997-02-15 06:12:07 +0000
committermax <max@FreeBSD.org>1997-02-15 06:12:07 +0000
commit87555db6e86def8759440e96ea218b43d1c199cc (patch)
treead264a6b2fb802b1fca0a8a8516d3cd2636c8386 /games
parent611c96cfb8d82d11751cf959c63b6da45a352553 (diff)
downloadFreeBSD-src-87555db6e86def8759440e96ea218b43d1c199cc.zip
FreeBSD-src-87555db6e86def8759440e96ea218b43d1c199cc.tar.gz
Added an option `-h' which gives you usage info.
(According to the original man page, giving `-' by itself as the argument is supposed to do this, but it seems that it never worked that way.)
Diffstat (limited to 'games')
-rw-r--r--games/backgammon/backgammon/backgammon.63
-rw-r--r--games/backgammon/common_source/subs.c25
2 files changed, 18 insertions, 10 deletions
diff --git a/games/backgammon/backgammon/backgammon.6 b/games/backgammon/backgammon/backgammon.6
index 0270153..f29c807 100644
--- a/games/backgammon/backgammon/backgammon.6
+++ b/games/backgammon/backgammon/backgammon.6
@@ -65,6 +65,9 @@ consist of:
.PP
.na
.TP 8
+.B -h
+Get a description of possible arguments and exit
+.TP 8
.B -n
don't ask for rules or instructions
.TP 8
diff --git a/games/backgammon/common_source/subs.c b/games/backgammon/common_source/subs.c
index 7f46571..7a6e1ba9 100644
--- a/games/backgammon/common_source/subs.c
+++ b/games/backgammon/common_source/subs.c
@@ -48,15 +48,15 @@ static char plwhite[] = "Player is white, computer is red.";
static char nocomp[] = "(No computer play.)";
char *descr[] = {
- "Usage: backgammon [-] [n r w b pr pw pb t3a]\n",
- "\t-\tgets this list\n\tn\tdon't ask for rules or instructions",
- "\tr\tplayer is red (implies n)\n\tw\tplayer is white (implies n)",
- "\tb\ttwo players, red and white (implies n)",
- "\tpr\tprint the board before red's turn",
- "\tpw\tprint the board before white's turn",
- "\tpb\tprint the board before both player's turn",
- "\tterm\tterminal is a term",
- "\tsfile\trecover saved game from file",
+ "Usage: backgammon [-h n r w b pr pw pb tterm sfile]\n",
+ "\t-h\tgets this list\n\t-n\tdon't ask for rules or instructions",
+ "\t-r\tplayer is red (implies -n)\n\t-w\tplayer is white (implies -n)",
+ "\t-b\ttwo players, red and white (implies -n)",
+ "\t-pr\tprint the board before red's turn",
+ "\t-pw\tprint the board before white's turn",
+ "\t-pb\tprint the board before both player's turn",
+ "\t-tterm\tterminal is a term",
+ "\t-sfile\trecover saved game from file",
0
};
@@ -308,11 +308,12 @@ register char **argv;
register char ch;
extern int optind;
extern char *optarg;
+ int i;
/* process arguments here. dashes are ignored, nbrw are ignored
if the game is being recovered */
- while ((ch = getopt (argc, argv, "nbrwp:t:s:")) != -1) {
+ while ((ch = getopt (argc, argv, "nbrwp:t:s:h")) != -1) {
switch (ch) {
/* don't ask if rules or instructions needed */
@@ -372,6 +373,10 @@ register char **argv;
/* recover file */
recover (optarg);
break;
+ case 'h':
+ for (i = 0; descr[i] != 0; i++)
+ puts (descr[i]);
+ getout();
}
}
argc -= optind;
OpenPOWER on IntegriCloud