]> granicus.if.org Git - nethack/commitdiff
Don't complain about unknown option if param is wrong
authorPasi Kallinen <paxed@alt.org>
Thu, 11 Feb 2021 16:22:14 +0000 (18:22 +0200)
committerPasi Kallinen <paxed@alt.org>
Thu, 11 Feb 2021 16:22:18 +0000 (18:22 +0200)
When a compound option was given an erroneous parameter,
for example "OPTIONS=runmode:foo",
you first got "Unknown runmode parameter 'foo", and
then "Unknown option 'runmode:foo'".

Prevent the Unknown option complaint, if we actually did
find a match.

src/options.c

index cfd6ad21676e85cee86ba35de5473d744dade815..a15c4e1287660aedbf854f82eb96dc2db8ab8752 100644 (file)
@@ -472,6 +472,8 @@ parseoptions(register char *opts,boolean tinitial, boolean tfrom_file)
 
     if (optresult == optn_silenterr)
         return FALSE;
+    if (got_match && optresult == optn_err)
+        return FALSE;
     if (optresult == optn_ok)
         return retval;