Unix: fix 'nethack -u name'
Using '-u name' rather than '-uname' was being treated as '--usage' for any value of 'name'. '-uname' worked as intended unless name was 'sage' (or leading substring of it). That's still the case after this fix, where the space after -u is now necessary for that special case name.
This commit is contained in:
@@ -1422,6 +1422,8 @@ if hero's steed got hit by knockback effect, impossible "no monster to remove"
|
|||||||
the #saveoptions command included options changed via doset_simple() but not
|
the #saveoptions command included options changed via doset_simple() but not
|
||||||
ones changed via full doset()
|
ones changed via full doset()
|
||||||
fix 'nethack --scores' as alias for 'nethack -s'
|
fix 'nethack --scores' as alias for 'nethack -s'
|
||||||
|
adding command line 'nethack --usage' broke 'nethack -u name' (however,
|
||||||
|
'nethack -uname' still worked for names other than "sage")
|
||||||
|
|
||||||
curses: 'msg_window' option wasn't functional for curses unless the binary
|
curses: 'msg_window' option wasn't functional for curses unless the binary
|
||||||
also included tty support
|
also included tty support
|
||||||
|
|||||||
+5
-1
@@ -343,7 +343,7 @@ lopt(
|
|||||||
goto loptnotallowed;
|
goto loptnotallowed;
|
||||||
|
|
||||||
l = (int) (p ? (long) (p - arg) : (long) strlen(arg));
|
l = (int) (p ? (long) (p - arg) : (long) strlen(arg));
|
||||||
if (!strncmp(arg, optname, l)) {
|
if ((l > 2 || oneletterok) && !strncmp(arg, optname, l)) {
|
||||||
/* "-windowtype[=foo]" */
|
/* "-windowtype[=foo]" */
|
||||||
if (p)
|
if (p)
|
||||||
++p; /* past '=' or ':' */
|
++p; /* past '=' or ':' */
|
||||||
@@ -356,6 +356,10 @@ lopt(
|
|||||||
/* "-w..." but not "-w[indowtype[=foo]]" */
|
/* "-w..." but not "-w[indowtype[=foo]]" */
|
||||||
if (!p) {
|
if (!p) {
|
||||||
p = &arg[2]; /* past 'w' of "-wfoo" */
|
p = &arg[2]; /* past 'w' of "-wfoo" */
|
||||||
|
#if 0 /* -x:value could work but is not supported (callers don't expect it) */
|
||||||
|
} else if (p == arg + 2) {
|
||||||
|
++p; /* past ':' of "-w:foo" */
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
/* "-w...=foo" but not "-w[indowtype]=foo" */
|
/* "-w...=foo" but not "-w[indowtype]=foo" */
|
||||||
goto loptbail;
|
goto loptbail;
|
||||||
|
|||||||
Reference in New Issue
Block a user