From: Thomas Debesse Date: Mon, 3 May 2021 04:45:05 +0000 (+0200) Subject: q3map2/help: read columns from terminal X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=dab0c64c818dd34196802b6dfb1e95681fd7aab9;p=xonotic%2Fnetradiant.git q3map2/help: read columns from terminal --- 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();