From dab0c64c818dd34196802b6dfb1e95681fd7aab9 Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Mon, 3 May 2021 06:45:05 +0200 Subject: [PATCH] q3map2/help: read columns from terminal --- tools/quake3/CMakeLists.txt | 2 ++ tools/quake3/q3map2/help.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/tools/quake3/CMakeLists.txt b/tools/quake3/CMakeLists.txt index c54c17d0..e03dfc6f 100644 --- a/tools/quake3/CMakeLists.txt +++ b/tools/quake3/CMakeLists.txt @@ -190,3 +190,5 @@ if (UNIX) target_link_libraries(q3map2 pthread m) target_link_libraries(q3data m) endif () + +target_link_libraries(q3map2 termcap) diff --git a/tools/quake3/q3map2/help.c b/tools/quake3/q3map2/help.c index 2ad46e17..f6974a6c 100644 --- a/tools/quake3/q3map2/help.c +++ b/tools/quake3/q3map2/help.c @@ -457,11 +457,19 @@ void HelpGames() printf("\n\n"); } +#include + void HelpMain(const char* arg) { printf("Usage: q3map2 [stage] [common options...] [stage options...] [stage source file]\n"); printf(" q3map2 -help [stage]\n\n"); + static char termbuf[2048]; + char *termtype = getenv("TERM"); + if (tgetent(termbuf, termtype) >= 0) { + terminalColumns = tgetnum("co"); + } + HelpCommon(); HelpGames(); -- 2.39.2