diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2016-07-18 06:17:59 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2016-07-18 06:17:59 +0300 |
commit | c8ea9b44e9957c193137b0fdbbc50dd8af63a2cf (patch) | |
tree | 7df9c1279ed19a673c101d8a7023defe9c4d1a52 /main.c | |
parent | 615093c3aff4f248a4136f5030aaa3219fe35f62 (diff) | |
parent | 6ce601e93b93847ab9d369405cbba624fc1c49bb (diff) | |
download | egawk-c8ea9b44e9957c193137b0fdbbc50dd8af63a2cf.tar.gz egawk-c8ea9b44e9957c193137b0fdbbc50dd8af63a2cf.tar.bz2 egawk-c8ea9b44e9957c193137b0fdbbc50dd8af63a2cf.zip |
Merge branch 'master' into feature/nocopy
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 23 |
1 files changed, 20 insertions, 3 deletions
@@ -152,6 +152,7 @@ static int do_nostalgia = false; /* provide a blast from the past */ static int do_binary = false; /* hands off my data! */ static int do_version = false; /* print version info */ static const char *locale = ""; /* default value to setlocale */ +static char *locale_dir = LOCALEDIR; /* default locale dir */ int use_lc_numeric = false; /* obey locale for decimal point */ @@ -220,6 +221,10 @@ main(int argc, char **argv) char *extra_stack; int have_srcfile = 0; SRCFILE *s; + char *cp; +#if defined(LOCALEDEBUG) + const char *initial_locale; +#endif /* do these checks early */ if (getenv("TIDYMEM") != NULL) @@ -238,8 +243,13 @@ main(int argc, char **argv) if (argc < 2) usage(EXIT_FAILURE, stderr); - (void) bindtextdomain(PACKAGE, LOCALEDIR); - (void) textdomain(PACKAGE); + if ((cp = getenv("GAWK_LOCALE_DIR")) != NULL) + locale_dir = cp; + +#if defined(LOCALEDEBUG) + initial_locale = locale; +#endif + set_locale_stuff(); (void) signal(SIGFPE, catchsig); #ifdef SIGBUS @@ -287,7 +297,10 @@ main(int argc, char **argv) parse_args(argc, argv); - set_locale_stuff(); +#if defined(LOCALEDEBUG) + if (locale != initial_locale) + set_locale_stuff(); +#endif /* * In glibc, MB_CUR_MAX is actually a function. This value is @@ -1710,4 +1723,8 @@ set_locale_stuff(void) #if defined(LC_TIME) setlocale(LC_TIME, locale); #endif + + /* These must be done after calling setlocale */ + (void) bindtextdomain(PACKAGE, locale_dir); + (void) textdomain(PACKAGE); } |