From 44a2ddf9c7b40ed56ec76d7afd1831b75bcdd17d Mon Sep 17 00:00:00 2001 From: phil Date: Thu, 29 Dec 1994 08:00:17 +0000 Subject: [PATCH] make the code agree with documentation and usage() for final two options. --- boggle/boggle/bog.c | 20 ++++++++++++++------ 1 file 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"); -- 2.47.1