summaryrefslogtreecommitdiff
path: root/lib/charset.c
diff options
context:
space:
mode:
authorGravatar Karl Ramm <kcr@mit.edu>2009-03-22 04:32:22 +0000
committerGravatar Karl Ramm <kcr@mit.edu>2009-03-22 04:32:22 +0000
commitc37c1eb6675a452c95bd4f761fc9e28934eb29ad (patch)
tree1ff6282ef7557c2441624caf3fe50b9544eab51c /lib/charset.c
parentd5d5efff2d919af2f2b1c78eeacc1e23d962123b (diff)
only run setlocale once
Diffstat (limited to 'lib/charset.c')
-rw-r--r--lib/charset.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/charset.c b/lib/charset.c
index 19dfb7e..dabe4b8 100644
--- a/lib/charset.c
+++ b/lib/charset.c
@@ -25,12 +25,16 @@ ZGetCharset(char *charset)
{
char *p;
short retval;
+ static int once = 1;
if (charset == NULL)
charset = getenv("ZEPHYR_CHARSET");
if (charset == NULL) {
- setlocale(LC_ALL, "");
+ if (once) {
+ setlocale(LC_ALL, "");
+ once = 0;
+ }
charset = nl_langinfo(CODESET);
}