diff --git a/usr.bin/locale/locale.c b/usr.bin/locale/locale.c index 4748c44affa5..9a1e437e0789 100644 --- a/usr.bin/locale/locale.c +++ b/usr.bin/locale/locale.c @@ -421,19 +421,16 @@ void showlocale(void) { size_t i; - const char *lang, *vval, *eval, *lcall; + const char *lang, *vval, *eval; - (void)setlocale(LC_ALL, ""); + setlocale(LC_ALL, ""); - if ((lang = getenv("LANG")) == NULL) + lang = getenv("LANG"); + if (lang == NULL) { lang = ""; + } + printf("LANG=%s\n", lang); /* XXX: if LANG is null, then set it to "C" to get implied values? */ - if ((lcall = getenv("LC_ALL")) == NULL) - lcall = ""; - if (!*lcall || !strcmp(lang, lcall)) - printf("LANG=%s\n", lang); - else - printf("LANG=\"%s\"\n", lcall); for (i = 0; i < NLCINFO; i++) { vval = setlocale(lcinfo[i].id, NULL); @@ -454,7 +451,11 @@ showlocale(void) } } - printf("LC_ALL=%s\n", lcall); + vval = getenv("LC_ALL"); + if (vval == NULL) { + vval = ""; + } + printf("LC_ALL=%s\n", vval); } /*