From 27a7538e381dbc251b195d0e14fce851bea82f23 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 3 Mar 2018 12:58:53 -0500 Subject: [PATCH] enable USE_WIN_IOCTL code unless explicitly avoided Changes to be committed: modified: doc/fixes36.1 modified: include/unixconf.h modified: sys/share/ioctl.c github pull request #19 made reference to resulting code behaviour being better when windows were resized when USE_WIN_IOCTL was defined. The logic for including the necessary enabling code in the build in sys/share/ioctl.c was an explicit "opt-in" strategy, so anything not deliberately and explicitly listed was not able to take advantae of the potentially useful code. The need to add #defines to that list would have been perpetual as new platforms came online, and unnecessarily restrictive for everything else. This switches the logic to include the code by default now, and thus unless there is an explicit "opt-out" by uncommenting AVOID_WIN_IOCTL in include/unixconf.h Some platforms, and we have no way of knowing which ones, may have to ensure that AVOID_WIN_IOCTL is #define'd. --- doc/fixes36.1 | 2 ++ include/unixconf.h | 4 +++- sys/share/ioctl.c | 11 +++++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/doc/fixes36.1 b/doc/fixes36.1 index 02bded2af..c282bdc58 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -635,6 +635,8 @@ unix: race condition with parallel make: src/Makefile might start building unix: Makefile.{src,utl} ignored CPPFLAGS which is expanded by the default .c rule by GNU make so if user had a value for that in the environment, it would apply to some files but not others; explicitly override it +unix: enable code guarded by USE_WIN_IOCTL by default unless prevented by + uncommenting #define AVOID_WIN_IOCTL in include/unixconf.h win32gui: getversionstring() was overflowing the provided Help About buffer win32gui: guard against buffer overflow in in mswin_getlin() win32gui: handle menu_color attribute diff --git a/include/unixconf.h b/include/unixconf.h index 88e309d55..cec8c709a 100644 --- a/include/unixconf.h +++ b/include/unixconf.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 unixconf.h $NHDT-Date: 1451342112 2015/12/28 22:35:12 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.25 $ */ +/* NetHack 3.6 unixconf.h $NHDT-Date: 1520099325 2018/03/03 17:48:45 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.30 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -136,6 +136,8 @@ #define TIMED_DELAY #endif +/* #define AVOID_WIN_IOCTL */ /* ensure USE_WIN_IOCTL remains undefined */ + /* * If you define MAIL, then the player will be notified of new mail * when it arrives. If you also define DEF_MAILREADER then this will diff --git a/sys/share/ioctl.c b/sys/share/ioctl.c index 3da74b81a..138d02b5c 100644 --- a/sys/share/ioctl.c +++ b/sys/share/ioctl.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 ioctl.c $NHDT-Date: 1432512788 2015/05/25 00:13:08 $ $NHDT-Branch: master $:$NHDT-Revision: 1.12 $ */ +/* NetHack 3.6 ioctl.c $NHDT-Date: 1520099308 2018/03/03 17:48:28 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.13 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -63,9 +63,12 @@ struct termio termio; #include #endif -#if defined(TIOCGWINSZ) \ - && (defined(BSD) || defined(ULTRIX) || defined(AIX_31) \ - || defined(_BULL_SOURCE) || defined(SVR4)) +/* AVOID_WIN_IOCTL can be uncommented in unixconf.h + * to force USE_WIN_IOTCL to remain undefined, + * instead of the restricted explicit opt-in + * logic that used to be here. + */ +#if defined(TIOCGWINSZ) && !defined(AVOID_WIN_IOCTL) #define USE_WIN_IOCTL #include "tcap.h" /* for LI and CO */ #endif