summaryrefslogtreecommitdiff
path: root/src/tty.sh
diff options
context:
space:
mode:
authorAmadeusz Sławiński <amade@asmblr.net>2014-04-25 14:24:51 +0200
committerAmadeusz Sławiński <amade@asmblr.net>2014-04-25 14:24:51 +0200
commite9e78d9b2b413337d9f783ad9a514c8accd25ac9 (patch)
tree80f0773c1fc14ab95c1ce3c713fe07621e4d84fd /src/tty.sh
parentfe0669d90d587a00f863e0a8f38c9f462a833554 (diff)
downloadscreen-e9e78d9b2b413337d9f783ad9a514c8accd25ac9.tar.gz
fix-utf8-status-padding-bug
Ensure that multibyte UTF8 characters are counted correctly when calculating and displaying the caption and hardstatus lines. Based on an earlier version by Kees Cook <address@hidden> Signed-off-by: Dustin Kirkland <address@hidden> Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
Diffstat (limited to 'src/tty.sh')
-rw-r--r--src/tty.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/tty.sh b/src/tty.sh
index 0b5524e..3374753 100644
--- a/src/tty.sh
+++ b/src/tty.sh
@@ -60,6 +60,7 @@ exit 0
#include <sys/types.h>
#include <signal.h>
#include <fcntl.h>
+#include <sys/stat.h>
#ifndef sgi
# include <sys/file.h>
#endif
@@ -1499,6 +1500,19 @@ int ibaud, obaud;
return 0;
}
+
+int
+CheckTtyname (tty)
+char *tty;
+{
+ struct stat st;
+
+ if (lstat(tty, &st) || !S_ISCHR(st.st_mode) ||
+ (st.st_nlink > 1 && strncmp(tty, "/dev/", 5)))
+ return -1;
+ return 0;
+}
+
/*
* Write out the mode struct in a readable form
*/