summaryrefslogtreecommitdiffstats
path: root/boggle
diff options
context:
space:
mode:
authorphil <phil@NetBSD.org>1994-12-29 08:00:17 +0000
committerphil <phil@NetBSD.org>1994-12-29 08:00:17 +0000
commit44a2ddf9c7b40ed56ec76d7afd1831b75bcdd17d (patch)
tree23fd828b0f9418c74038c9774ae72d5831e7a0fd /boggle
parent290f692eb03a3d95f6e4fce90ccfc13e3a5c1d3d (diff)
downloadbsdgames-darwin-44a2ddf9c7b40ed56ec76d7afd1831b75bcdd17d.tar.gz
bsdgames-darwin-44a2ddf9c7b40ed56ec76d7afd1831b75bcdd17d.tar.zst
bsdgames-darwin-44a2ddf9c7b40ed56ec76d7afd1831b75bcdd17d.zip
make the code agree with documentation and usage() for final two
options.
Diffstat (limited to 'boggle')
-rw-r--r--boggle/boggle/bog.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/boggle/boggle/bog.c b/boggle/boggle/bog.c
index c3ca5474..44bbea02 100644
--- a/boggle/boggle/bog.c
+++ b/boggle/boggle/bog.c
@@ -155,21 +155,29 @@ main(argc, argv)
argc -= optind;
argv += optind;
- /* process boardspec if given */
+ /* process final arguments */
if (argc > 0)
if (strcmp(argv[0], "+") == 0)
reuse = 1;
else if (strcmp(argv[0], "++") == 0)
selfuse = 1;
- else if (islower(argv[0][0])) {
+
+ if (reuse || selfuse) {
+ argc -= 1;
+ argv += 1;
+ }
+
+ if (argc > 0)
+ if (islower(argv[0][0])) {
if (strlen(argv[0]) != 16) {
usage();
-
+ } else {
/* This board is assumed to be valid... */
bspec = argv[0];
- } else
- usage();
- }
+ }
+ } else {
+ usage();
+ }
if (batch && bspec == NULL)
errx(1, "must give both -b and a board setup");