From: Thomas Debesse Date: Mon, 3 May 2021 22:46:17 +0000 (+0200) Subject: q3map2/help: only read terminal columns using ioctl on Posix systems X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f8783749e760415506b4889ee7a970e876d0cb49;p=xonotic%2Fnetradiant.git 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. --- 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();