]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
q3map2/help: read columns from terminal
authorThomas Debesse <dev@illwieckz.net>
Mon, 3 May 2021 04:45:05 +0000 (06:45 +0200)
committerThomas Debesse <dev@illwieckz.net>
Mon, 3 May 2021 06:16:22 +0000 (08:16 +0200)
tools/quake3/CMakeLists.txt
tools/quake3/q3map2/help.c

index c54c17d0ebbd06c8341b4e64e8946b03f3db0d46..e03dfc6fe352f41c1f823871fb8651217530f9d3 100644 (file)
@@ -190,3 +190,5 @@ if (UNIX)
     target_link_libraries(q3map2 pthread m)
     target_link_libraries(q3data m)
 endif ()
+
+target_link_libraries(q3map2 termcap)
index 2ad46e17314856338c2ab7999632beddbf275a45..f6974a6c30a6d25e3af590ae907290538d806885 100644 (file)
@@ -457,11 +457,19 @@ void HelpGames()
        printf("\n\n");
 }
 
+#include <termcap.h>
+
 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();