simplify, and fix, setting the current locale

Fix test setup bogosities. Specifically, they weren't hermetic with respect to
locale env vars.

Rewrite the handling of locale vars to simplify the code and make it more like
the pattern most programs employ.

Fixes #3110
This commit is contained in:
Kurtis Rader
2016-06-03 19:05:13 -07:00
parent 32a585a52b
commit 0b385f145c
8 changed files with 77 additions and 87 deletions

View File

@@ -148,8 +148,7 @@ void setup_and_process_keys(bool continuous_mode) {
is_interactive_session = 1; // by definition this is interactive
set_main_thread();
setup_fork_guards();
wsetlocale(LC_ALL, L"POSIX");
program_name = L"fish_key_reader";
setlocale(LC_ALL, "POSIX");
env_init();
reader_init();
input_init();
@@ -178,6 +177,7 @@ void setup_and_process_keys(bool continuous_mode) {
}
int main(int argc, char **argv) {
program_name = L"fish_key_reader";
bool continuous_mode = false;
const char *short_opts = "+c";
const struct option long_opts[] = {{"continuous", no_argument, NULL, 'd'}, {NULL, 0, NULL, 0}};