From ac2634b603ca11177f3be8d2509363c7e25313a2 Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 3 Apr 2018 16:05:08 -0700 Subject: [PATCH] EDIT_GETLIN fix for tty After about the third time typing '#' and getting a prompt of "# K", I decided that it wasn't clumsy typing. The call chain for get_ext_cmd() was passing an uninitialized output buffer to [hooked_tty_]getlin() which treated random junk as the previous result to be used as current default. Other interfaces may need a similar fix. --- win/tty/getline.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/win/tty/getline.c b/win/tty/getline.c index a69abd4bd..058912186 100644 --- a/win/tty/getline.c +++ b/win/tty/getline.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 getline.c $NHDT-Date: 1490908467 2017/03/30 21:14:27 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.31 $ */ +/* NetHack 3.6 getline.c $NHDT-Date: 1522796701 2018/04/03 23:05:01 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.34 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -290,6 +290,7 @@ tty_get_ext_cmd() * ? ext_cmd_getlin_hook * : (getlin_hook_proc) 0); */ + buf[0] = '\0'; hooked_tty_getlin("#", buf, in_doagain ? (getlin_hook_proc) 0 : ext_cmd_getlin_hook); (void) mungspaces(buf);