From e2bc612730f7fd45083df5a94b4b6bfbf94ffafc Mon Sep 17 00:00:00 2001 From: Albert Cahalan Date: Tue, 28 Dec 2004 16:09:27 +0000 Subject: [PATCH] never use putenv w/ stack variable; also move lang stuff --- src/tuxpaint.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/tuxpaint.c b/src/tuxpaint.c index 87f9b53f3..30c6b948a 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -1183,6 +1183,17 @@ static void setup_language(const char * const prg) } +// handle --locale arg +static void do_locale_option(const char * const arg) +{ + int len = strlen(arg) + 6; + char *str = malloc(len); + snprintf(str, len, "LANG=%s", arg); + putenv(str); + setlocale(LC_ALL, ""); /* use arg ? */ +} + + static TTF_Font *try_alternate_font(void) { char str[128]; @@ -5915,11 +5926,7 @@ static void setup(int argc, char * argv[]) { if (i < argc - 1) { - snprintf(str, sizeof(str), "LANG=%s", argv[i + 1]); - putenv(str); - - setlocale(LC_ALL, ""); /* argv[i + 1]) ? */ - i++; + do_locale_option(argv[++i]); } else {