Seems like it is still problem, after a bit investigating seems like tic
man page suggests name length of terminal names so just define it as
suggested by man page to be 32 if system supports long file names and 14
otherwise.

Amadeusz
>From 92b46ec5c5f7b0ebc4a08a34bba1ad1be7f4279e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Amadeusz=20S=C5=82awi=C5=84ski?= <am...@asmblr.net>
Date: Sat, 15 Sep 2012 15:07:30 +0200
Subject: [PATCH 2/3] Allow screen to run on terminals with long $TERM
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

According to tic man page:
Terminal names exceeding the maximum alias length
(32 characters on systems with long filenames, 14 characters otherwise)
will  be  truncated  to  the maximum alias length and a warning message
will be printed.

Signed-off-by: Amadeusz Sławiński <am...@asmblr.net>
---
 src/display.h | 2 +-
 src/os.h      | 8 ++++++++
 src/screen.h  | 2 +-
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/display.h b/src/display.h
index e48741f..19dded7 100644
--- a/src/display.h
+++ b/src/display.h
@@ -73,7 +73,7 @@ struct display
   struct win *d_other;         /* pointer to other window */
   int   d_nonblock;            /* -1 don't block if obufmax reached */
                                /* >0: block after nonblock secs */
-  char  d_termname[20 + 1];    /* $TERM */
+  char  d_termname[MAXTERMLEN + 1];    /* $TERM */
   char *d_tentry;              /* buffer for tgetstr */
   char d_tcinited;             /* termcap inited flag */
   int  d_width, d_height;      /* width/height of the screen */
diff --git a/src/os.h b/src/os.h
index 5c17c83..f1d849c 100644
--- a/src/os.h
+++ b/src/os.h
@@ -45,6 +45,14 @@
 #define NAME_MAX 14
 #endif
 
+#if !defined(MAXTERMLEN)
+# if !defined(HAVE_LONG_FILE_NAMES)
+#  define MAXTERMLEN 14
+# else
+#  define MAXTERMLEN 32
+# endif
+#endif
+
 #ifdef ISC
 # ifdef ENAMETOOLONG
 #  undef ENAMETOOLONG
diff --git a/src/screen.h b/src/screen.h
index 5c93f32..ea35aa1 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -214,7 +214,7 @@ struct msg
          char preselect[20];
          int esc;              /* his new escape character unless -1 */
          int meta_esc;         /* his new meta esc character unless -1 */
-         char envterm[20 + 1]; /* terminal type */
+         char envterm[MAXTERMLEN + 1]; /* terminal type */
          int encoding;         /* encoding of display */
          int detachfirst;      /* whether to detach remote sessions first */
        }
-- 
1.7.12

Reply via email to