diff options
-rw-r--r-- | CRT.c | 3 | ||||
-rw-r--r-- | htop.c | 7 |
2 files changed, 3 insertions, 7 deletions
@@ -725,9 +725,6 @@ void CRT_init(const int* delay, int colorScheme, bool allowUnicode) { CRT_colorScheme = COLORSCHEME_MONOCHROME; CRT_setColors(CRT_colorScheme); - /* initialize locale */ - setlocale(LC_CTYPE, ""); - #ifdef HAVE_LIBNCURSESW if (allowUnicode && String_eq(nl_langinfo(CODESET), "UTF-8")) { CRT_utf8 = true; @@ -262,10 +262,9 @@ static void setCommFilter(State* state, char** commFilter) { int main(int argc, char** argv) { - char *lc_ctype = getenv("LC_CTYPE"); - if (lc_ctype != NULL) - setlocale(LC_CTYPE, lc_ctype); - else if ((lc_ctype = getenv("LC_ALL"))) + /* initialize locale */ + const char* lc_ctype; + if ((lc_ctype = getenv("LC_CTYPE")) || (lc_ctype = getenv("LC_ALL"))) setlocale(LC_CTYPE, lc_ctype); else setlocale(LC_CTYPE, ""); |