diff -ubB --show-c-function /home/ludo/src/guile/libguile/script.c /home/ludo/src/guile/libguile/script.c.locale.bak --- guile/libguile/script.c 2011-11-21 21:41:02.000000000 +0100 +++ guile/libguile/script.c.locale.bak 2011-11-21 21:41:00.000000000 +0100 @@ -26,6 +26,7 @@ #include #include #include +#include #include "libguile/_scm.h" #include "libguile/eval.h" @@ -369,6 +370,15 @@ scm_shell_usage (int fatal, char *messag } +static int +terminating_argument (const char *arg) +{ + return (strcmp (arg, "--") == 0 + || strcmp (arg, "-c") == 0 + || strcmp (arg, "-ds") == 0 + || strcmp (arg, "-s") == 0); +} + /* Given an array of command-line switches, return a Scheme expression to carry out the actions specified by the switches. */ @@ -376,6 +386,22 @@ scm_shell_usage (int fatal, char *messag SCM scm_compile_shell_switches (int argc, char **argv) { + int i; + + for (i = 0; i < argc && !terminating_argument (argv[i]); i++) + { + if (strncmp (argv[i], "--locale", sizeof "--locale") == 0) + { + const char *equal; + + equal = strchr (argv[i], '='); + if (equal != NULL) + setlocale (LC_ALL, &argv[i][equal + 1]); + else + setlocale (LC_ALL, ""); + } + } + return scm_call_2 (scm_c_public_ref ("ice-9 command-line", "compile-shell-switches"), scm_makfromstrs (argc, argv),