version 1.151, 2015/11/12 11:09:11 |
version 1.152, 2015/11/12 11:24:08 |
|
|
int |
int |
main(int argc, char **argv) |
main(int argc, char **argv) |
{ |
{ |
char *s, *path, *label, **var, tmp[PATH_MAX]; |
char *path, *label, **var, tmp[PATH_MAX]; |
int opt, flags, keys; |
const char *s; |
|
int opt, flags, keys; |
|
|
#ifdef DEBUG |
#ifdef DEBUG |
malloc_options = (char *) "AFGJPX"; |
malloc_options = (char *) "AFGJPX"; |
|
|
"proc exec tty ps", NULL) != 0) |
"proc exec tty ps", NULL) != 0) |
err(1, "pledge"); |
err(1, "pledge"); |
|
|
if (!(flags & CLIENT_UTF8)) { |
/* |
/* |
* tmux is a UTF-8 terminal, so if TMUX is set, assume UTF-8. |
* If the user has set whichever of LC_ALL, LC_CTYPE or LANG |
* Otherwise, if the user has set LC_ALL, LC_CTYPE or LANG to contain |
* exist (in that order) to contain UTF-8, it is a safe |
* UTF-8, it is a safe assumption that either they are using a UTF-8 |
* assumption that either they are using a UTF-8 terminal, or |
* terminal, or if not they know that output from UTF-8-capable |
* if not they know that output from UTF-8-capable programs may |
* programs may be wrong. |
* be wrong. |
*/ |
*/ |
if (getenv("TMUX") != NULL) |
if ((s = getenv("LC_ALL")) == NULL || *s == '\0') { |
flags |= CLIENT_UTF8; |
if ((s = getenv("LC_CTYPE")) == NULL || *s == '\0') |
else { |
s = getenv("LANG"); |
s = getenv("LC_ALL"); |
} |
if (s == NULL || *s == '\0') |
if (s != NULL && (strcasestr(s, "UTF-8") != NULL || |
s = getenv("LC_CTYPE"); |
strcasestr(s, "UTF8") != NULL)) |
if (s == NULL || *s == '\0') |
|
s = getenv("LANG"); |
|
if (s == NULL || *s == '\0') |
|
s = ""; |
|
if (strcasestr(s, "UTF-8") != NULL || |
|
strcasestr(s, "UTF8") != NULL) |
flags |= CLIENT_UTF8; |
flags |= CLIENT_UTF8; |
} |
} |
|
|