summaryrefslogtreecommitdiffstats
path: root/tmux.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2016-03-05 17:58:12 +0000
committerThomas Adam <thomas@xteddy.org>2016-03-05 17:58:12 +0000
commit5fc5c03dad7e99997df64c682b4ea0fc662dee53 (patch)
tree2e928eaa1143850bbe191fcb4b4ac8d171892011 /tmux.c
parent81f78f0da7f72b4707f653d70615c7b64c341d44 (diff)
parent0d6de44a37755f0e5046c04e19e4506a6d59e750 (diff)
Merge branch 'obsd-master'
Conflicts: tmux.c
Diffstat (limited to 'tmux.c')
-rw-r--r--tmux.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/tmux.c b/tmux.c
index 1ff3e0db..cf82110a 100644
--- a/tmux.c
+++ b/tmux.c
@@ -23,6 +23,8 @@
#include <errno.h>
#include <event.h>
#include <fcntl.h>
+#include <getopt.h>
+#include <langinfo.h>
#include <locale.h>
#include <pwd.h>
#include <stdlib.h>
@@ -190,10 +192,14 @@ main(int argc, char **argv)
const char *s;
int opt, flags, keys;
- 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");
+ if (setlocale(LC_CTYPE, "en_US.UTF-8") == NULL) {
+ if (setlocale(LC_CTYPE, "") == NULL)
+ errx(1, "invalid LC_ALL, LC_CTYPE or LANG");
+ s = nl_langinfo(CODESET);
+ if (strcasecmp(s, "UTF-8") != 0 &&
+ strcasecmp(s, "UTF8") != 0)
+ errx(1, "need UTF-8 locale (LC_CTYPE) but have %s", s);
+ }
setlocale(LC_TIME, "");
tzset();