aboutsummaryrefslogtreecommitdiff
path: root/tmux.c
diff options
context:
space:
mode:
authornicm <nicm>2016-03-05 07:44:31 +0000
committernicm <nicm>2016-03-05 07:44:31 +0000
commit1f0b317088aaeb230d69f13f43ed63b7406c6fd1 (patch)
tree2c29ab24e931d07f7348a0a1face364394bd7b52 /tmux.c
parentdf0983af39922f2ee747a244c1c718ba7ca28910 (diff)
downloadrtmux-1f0b317088aaeb230d69f13f43ed63b7406c6fd1.tar.gz
rtmux-1f0b317088aaeb230d69f13f43ed63b7406c6fd1.tar.bz2
rtmux-1f0b317088aaeb230d69f13f43ed63b7406c6fd1.zip
Although we always have en_US.UTF-8 on OpenBSD, some platforms do not,
so fall back to setlocale(LC_CTYPE, ""). tmux requires a UTF-8 locale, so check with wcwidth() on a UTF-8 character after setlocale().
Diffstat (limited to 'tmux.c')
-rw-r--r--tmux.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/tmux.c b/tmux.c
index 93503d2d..d221c78e 100644
--- a/tmux.c
+++ b/tmux.c
@@ -188,9 +188,12 @@ main(int argc, char **argv)
const char *s;
int opt, flags, keys;
- setlocale(LC_CTYPE, "en_US.UTF-8");
- setlocale(LC_TIME, "");
+ if (setlocale(LC_CTYPE, "en_US.UTF-8") == NULL)
+ setlocale(LC_CTYPE, "");
+ if (wcwidth(0xfffd) != 1)
+ errx(1, "no UTF-8 locale; please set LC_CTYPE");
+ setlocale(LC_TIME, "");
tzset();
if (**argv == '-')