From a9340686f1096a3f0b29ccfb1dc65fa2bdef82bb Mon Sep 17 00:00:00 2001 From: ache Date: Mon, 2 Feb 2004 16:14:02 +0000 Subject: [PATCH] Back out LANG printing changes. POSIX is unclear in this place, but other systems do that in the old way. --- usr.bin/locale/locale.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) 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); } /*