From e9e78d9b2b413337d9f783ad9a514c8accd25ac9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amadeusz=20S=C5=82awi=C5=84ski?= Date: Fri, 25 Apr 2014 14:24:51 +0200 Subject: fix-utf8-status-padding-bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Dustin Kirkland Signed-off-by: Amadeusz Sławiński --- src/tty.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/tty.sh') 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 #include #include +#include #ifndef sgi # include #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 */ -- cgit v1.2.1