From f8783749e760415506b4889ee7a970e876d0cb49 Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Tue, 4 May 2021 00:46:17 +0200 Subject: [PATCH] q3map2/help: only read terminal columns using ioctl on Posix systems It does not work on Windows with MSYS2. It is verified to work on Linux, FreeBSD and macOS. --- tools/quake3/q3map2/help.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/quake3/q3map2/help.c b/tools/quake3/q3map2/help.c index f4fd717b..60631e3d 100644 --- a/tools/quake3/q3map2/help.c +++ b/tools/quake3/q3map2/help.c @@ -31,7 +31,10 @@ /* dependencies */ #include "q3map2.h" +#if GDEF_OS_POSIX #include +#endif // GDEF_OS_POSIX + static unsigned terminalColumns = 80; struct HelpOption @@ -463,11 +466,13 @@ void HelpMain(const char* arg) printf(" q3map2 -help [stage]\n"); printf(" q3map2 -help all\n\n"); +#if GDEF_OS_POSIX struct winsize ws; ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws); if (ws.ws_col > 60) { terminalColumns = ws.ws_col; } +#endif // GDEF_OS_POSIX HelpCommon(); -- 2.39.2