From b549d4314c75c5136bfc5ede78df5ecdfbd85690 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Mon, 10 Nov 2014 23:02:56 +0200 Subject: Add undocumented -Z option to set locale. --- main.c | 734 ++++++++++++++++++++++++++++++++++------------------------------- 1 file changed, 386 insertions(+), 348 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 3bee0488..e3440b8c 100644 --- a/main.c +++ b/main.c @@ -142,11 +142,16 @@ static bool disallow_var_assigns = false; /* true for --exec */ static void add_preassign(enum assign_type type, char *val); +static void parse_args(int argc, char **argv); +static void set_locale_stuff(void); +static bool stopped_early = false; + int do_flags = false; bool do_optimize = false; /* apply default optimizations */ 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 */ int use_lc_numeric = false; /* obey locale for decimal point */ @@ -186,6 +191,9 @@ static const struct option optab[] = { { "lint", optional_argument, NULL, 'L' }, { "lint-old", no_argument, NULL, 't' }, { "load", required_argument, NULL, 'l' }, +#if defined(LOCALEDEBUG) + { "locale", required_argument, NULL, 'Z' }, +#endif { "non-decimal-data", no_argument, NULL, 'n' }, { "nostalgia", no_argument, & do_nostalgia, 1 }, { "optimize", no_argument, NULL, 'O' }, @@ -209,15 +217,7 @@ static const struct option optab[] = { int main(int argc, char **argv) { - /* - * The + on the front tells GNU getopt not to rearrange argv. - */ - const char *optlist = "+F:f:v:W;bcCd::D::e:E:ghi:l:L:nNo::Op::MPrStVY"; - bool stopped_early = false; - int old_optind; int i; - int c; - char *scan, *src; char *extra_stack; int have_srcfile = 0; SRCFILE *s; @@ -233,60 +233,11 @@ main(int argc, char **argv) #endif /* HAVE_MTRACE */ #endif /* HAVE_MCHECK_H */ -#if defined(LC_CTYPE) - setlocale(LC_CTYPE, ""); -#endif -#if defined(LC_COLLATE) - setlocale(LC_COLLATE, ""); -#endif -#if defined(LC_MESSAGES) - setlocale(LC_MESSAGES, ""); -#endif -#if defined(LC_NUMERIC) && defined(HAVE_LOCALE_H) - /* - * Force the issue here. According to POSIX 2001, decimal - * point is used for parsing source code and for command-line - * assignments and the locale value for processing input, - * number to string conversion, and printing output. - * - * 10/2005 --- see below also; we now only use the locale's - * decimal point if do_posix in effect. - * - * 9/2007: - * This is a mess. We need to get the locale's numeric info for - * the thousands separator for the %'d flag. - */ - setlocale(LC_NUMERIC, ""); - init_locale(& loc); - setlocale(LC_NUMERIC, "C"); -#endif -#if defined(LC_TIME) - setlocale(LC_TIME, ""); -#endif - -#if MBS_SUPPORT - /* - * In glibc, MB_CUR_MAX is actually a function. This value is - * tested *a lot* in many speed-critical places in gawk. Caching - * this value once makes a speed difference. - */ - gawk_mb_cur_max = MB_CUR_MAX; - /* Without MBS_SUPPORT, gawk_mb_cur_max is 1. */ -#ifdef LIBC_IS_BORKED -{ - const char *env_lc; - - env_lc = getenv("LC_ALL"); - if (env_lc == NULL) - env_lc = getenv("LANG"); - if (env_lc != NULL && env_lc[1] == '\0' && tolower(env_lc[0]) == 'c') - gawk_mb_cur_max = 1; -} -#endif + myname = gawk_name(argv[0]); + os_arg_fixup(&argc, &argv); /* emulate redirection, expand wildcards */ - /* init the cache for checking bytes if they're characters */ - init_btowc_cache(); -#endif + if (argc < 2) + usage(EXIT_FAILURE, stderr); (void) bindtextdomain(PACKAGE, LOCALEDIR); (void) textdomain(PACKAGE); @@ -318,12 +269,6 @@ main(int argc, char **argv) (void) stackoverflow_install_handler(catchstackoverflow, extra_stack, STACK_SIZE); #undef STACK_SIZE - myname = gawk_name(argv[0]); - os_arg_fixup(&argc, &argv); /* emulate redirection, expand wildcards */ - - if (argc < 2) - usage(EXIT_FAILURE, stderr); - /* initialize the null string */ Nnull_string = make_string("", 0); @@ -338,306 +283,113 @@ main(int argc, char **argv) output_fp = stdout; - /* we do error messages ourselves on invalid options */ - opterr = false; - - /* copy argv before getopt gets to it; used to restart the debugger */ - save_argv(argc, argv); - /* initialize global (main) execution context */ push_context(new_context()); - /* option processing. ready, set, go! */ - for (optopt = 0, old_optind = 1; - (c = getopt_long(argc, argv, optlist, optab, NULL)) != EOF; - optopt = 0, old_optind = optind) { - if (do_posix) - opterr = true; - - switch (c) { - case 'F': - add_preassign(PRE_ASSIGN_FS, optarg); - break; + parse_args(argc, argv); - case 'E': - disallow_var_assigns = true; - /* fall through */ - case 'f': - /* - * Allow multiple -f options. - * This makes function libraries real easy. - * Most of the magic is in the scanner. - * - * The following is to allow for whitespace at the end - * of a #! /bin/gawk line in an executable file - */ - scan = optarg; - if (argv[optind-1] != optarg) - while (isspace((unsigned char) *scan)) - scan++; - src = (*scan == '\0' ? argv[optind++] : optarg); - (void) add_srcfile((src && src[0] == '-' && src[1] == '\0') ? - SRC_STDIN : SRC_FILE, - src, srcfiles, NULL, NULL); + set_locale_stuff(); - break; +#if MBS_SUPPORT + /* + * In glibc, MB_CUR_MAX is actually a function. This value is + * tested *a lot* in many speed-critical places in gawk. Caching + * this value once makes a speed difference. + */ + gawk_mb_cur_max = MB_CUR_MAX; + /* Without MBS_SUPPORT, gawk_mb_cur_max is 1. */ +#ifdef LIBC_IS_BORKED +{ + const char *env_lc; - case 'v': - add_preassign(PRE_ASSIGN, optarg); - break; + env_lc = getenv("LC_ALL"); + if (env_lc == NULL) + env_lc = getenv("LANG"); + if (env_lc != NULL && env_lc[1] == '\0' && tolower(env_lc[0]) == 'c') + gawk_mb_cur_max = 1; +} +#endif - case 'b': - do_binary = true; - break; + /* init the cache for checking bytes if they're characters */ + init_btowc_cache(); +#endif - case 'c': - do_flags |= DO_TRADITIONAL; - break; - case 'C': - copyleft(); - break; + if (do_nostalgia) + nostalgia(); - case 'd': - do_flags |= DO_DUMP_VARS; - if (optarg != NULL && optarg[0] != '\0') - varfile = optarg; - break; + /* check for POSIXLY_CORRECT environment variable */ + if (! do_posix && getenv("POSIXLY_CORRECT") != NULL) { + do_flags |= DO_POSIX; + if (do_lint) + lintwarn( + _("environment variable `POSIXLY_CORRECT' set: turning on `--posix'")); + } - case 'D': - do_flags |= DO_DEBUG; - if (optarg != NULL && optarg[0] != '\0') - command_file = optarg; - break; + if (do_posix) { + use_lc_numeric = true; + if (do_traditional) /* both on command line */ + warning(_("`--posix' overrides `--traditional'")); + else + do_flags |= DO_TRADITIONAL; + /* + * POSIX compliance also implies + * no GNU extensions either. + */ + } - case 'e': - if (optarg[0] == '\0') - warning(_("empty argument to `-e/--source' ignored")); - else - (void) add_srcfile(SRC_CMDLINE, optarg, srcfiles, NULL, NULL); - break; + if (do_traditional && do_non_decimal_data) { + do_flags &= ~DO_NON_DEC_DATA; + warning(_("`--posix'/`--traditional' overrides `--non-decimal-data'")); + } - case 'g': - do_flags |= DO_INTL; - break; + if (do_lint && os_is_setuid()) + warning(_("running %s setuid root may be a security problem"), myname); - case 'h': - /* write usage to stdout, per GNU coding stds */ - usage(EXIT_SUCCESS, stdout); - break; +#if MBS_SUPPORT + if (do_binary) { + if (do_posix) + warning(_("`--posix' overrides `--characters-as-bytes'")); + else + gawk_mb_cur_max = 1; /* hands off my data! */ +#if defined(LC_ALL) + setlocale(LC_ALL, "C"); +#endif + } +#endif - case 'i': - (void) add_srcfile(SRC_INC, optarg, srcfiles, NULL, NULL); - break; + if (do_debug) /* Need to register the debugger pre-exec hook before any other */ + init_debug(); - case 'l': - (void) add_srcfile(SRC_EXTLIB, optarg, srcfiles, NULL, NULL); - break; +#ifdef HAVE_MPFR + /* Set up MPFR defaults, and register pre-exec hook to process arithmetic opcodes */ + if (do_mpfr) + init_mpfr(DEFAULT_PREC, DEFAULT_ROUNDMODE); +#endif -#ifndef NO_LINT - case 'L': - do_flags |= DO_LINT_ALL; - if (optarg != NULL) { - if (strcmp(optarg, "fatal") == 0) - lintfunc = r_fatal; - else if (strcmp(optarg, "invalid") == 0) { - do_flags &= ~DO_LINT_ALL; - do_flags |= DO_LINT_INVALID; - } - } - break; + /* load group set */ + init_groupset(); - case 't': - do_flags |= DO_LINT_OLD; - break; -#else - case 'L': - case 't': - break; +#ifdef HAVE_MPFR + if (do_mpfr) { + mpz_init(Nnull_string->mpg_i); + Nnull_string->flags = (MALLOC|STRCUR|STRING|MPZN|NUMCUR|NUMBER); + } else #endif + { + Nnull_string->numbr = 0.0; + Nnull_string->flags = (MALLOC|STRCUR|STRING|NUMCUR|NUMBER); + } - case 'n': - do_flags |= DO_NON_DEC_DATA; - break; + /* + * Tell the regex routines how they should work. + * Do this before initializing variables, since + * they could want to do a regexp compile. + */ + resetup(); - case 'N': - use_lc_numeric = true; - break; - - case 'O': - do_optimize = true; - break; - - case 'p': - do_flags |= DO_PROFILE; - /* fall through */ - case 'o': - do_flags |= DO_PRETTY_PRINT; - if (optarg != NULL) - set_prof_file(optarg); - else - set_prof_file(DEFAULT_PROFILE); - break; - - case 'M': -#ifdef HAVE_MPFR - do_flags |= DO_MPFR; -#else - warning(_("-M ignored: MPFR/GMP support not compiled in")); -#endif - break; - - case 'P': - do_flags |= DO_POSIX; - break; - - case 'r': - do_flags |= DO_INTERVALS; - break; - - case 'S': - do_flags |= DO_SANDBOX; - break; - - case 'V': - do_version = true; - break; - - case 'W': /* gawk specific options - now in getopt_long */ - fprintf(stderr, _("%s: option `-W %s' unrecognized, ignored\n"), - argv[0], optarg); - break; - - case 0: - /* - * getopt_long found an option that sets a variable - * instead of returning a letter. Do nothing, just - * cycle around for the next one. - */ - break; - - case 'Y': -#if defined(YYDEBUG) || defined(GAWKDEBUG) - if (c == 'Y') { - yydebug = 2; - break; - } -#endif - /* if not debugging, fall through */ - case '?': - default: - /* - * If not posix, an unrecognized option stops argument - * processing so that it can go into ARGV for the awk - * program to see. This makes use of ``#! /bin/gawk -f'' - * easier. - * - * However, it's never simple. If optopt is set, - * an option that requires an argument didn't get the - * argument. We care because if opterr is 0, then - * getopt_long won't print the error message for us. - */ - if (! do_posix - && (optopt == '\0' || strchr(optlist, optopt) == NULL)) { - /* - * can't just do optind--. In case of an - * option with >= 2 letters, getopt_long - * won't have incremented optind. - */ - optind = old_optind; - stopped_early = true; - goto out; - } else if (optopt != '\0') { - /* Use POSIX required message format */ - fprintf(stderr, - _("%s: option requires an argument -- %c\n"), - myname, optopt); - usage(EXIT_FAILURE, stderr); - } - /* else - let getopt print error message for us */ - break; - } - if (c == 'E') /* --exec ends option processing */ - break; - } -out: - - if (do_nostalgia) - nostalgia(); - - /* check for POSIXLY_CORRECT environment variable */ - if (! do_posix && getenv("POSIXLY_CORRECT") != NULL) { - do_flags |= DO_POSIX; - if (do_lint) - lintwarn( - _("environment variable `POSIXLY_CORRECT' set: turning on `--posix'")); - } - - if (do_posix) { - use_lc_numeric = true; - if (do_traditional) /* both on command line */ - warning(_("`--posix' overrides `--traditional'")); - else - do_flags |= DO_TRADITIONAL; - /* - * POSIX compliance also implies - * no GNU extensions either. - */ - } - - if (do_traditional && do_non_decimal_data) { - do_flags &= ~DO_NON_DEC_DATA; - warning(_("`--posix'/`--traditional' overrides `--non-decimal-data'")); - } - - if (do_lint && os_is_setuid()) - warning(_("running %s setuid root may be a security problem"), myname); - -#if MBS_SUPPORT - if (do_binary) { - if (do_posix) - warning(_("`--posix' overrides `--characters-as-bytes'")); - else - gawk_mb_cur_max = 1; /* hands off my data! */ -#if defined(LC_ALL) - setlocale(LC_ALL, "C"); -#endif - } -#endif - - if (do_debug) /* Need to register the debugger pre-exec hook before any other */ - init_debug(); - -#ifdef HAVE_MPFR - /* Set up MPFR defaults, and register pre-exec hook to process arithmetic opcodes */ - if (do_mpfr) - init_mpfr(DEFAULT_PREC, DEFAULT_ROUNDMODE); -#endif - - /* load group set */ - init_groupset(); - -#ifdef HAVE_MPFR - if (do_mpfr) { - mpz_init(Nnull_string->mpg_i); - Nnull_string->flags = (MALLOC|STRCUR|STRING|MPZN|NUMCUR|NUMBER); - } else -#endif - { - Nnull_string->numbr = 0.0; - Nnull_string->flags = (MALLOC|STRCUR|STRING|NUMCUR|NUMBER); - } - - /* - * Tell the regex routines how they should work. - * Do this before initializing variables, since - * they could want to do a regexp compile. - */ - resetup(); - - /* Set up the special variables */ - init_vars(); + /* Set up the special variables */ + init_vars(); /* Set up the field variables */ init_fields(); @@ -745,8 +497,9 @@ out: * data using the local decimal point. */ if (use_lc_numeric) - setlocale(LC_NUMERIC, ""); + setlocale(LC_NUMERIC, locale); #endif +// fprintf(stderr, "locale is <%s>\n", locale); fflush(stderr); init_io(); output_fp = stdout; @@ -856,6 +609,9 @@ usage(int exitval, FILE *fp) #ifdef GAWKDEBUG fputs(_("\t-Y\t\t--parsedebug\n"), fp); #endif +#if defined(LOCALEDEBUG) + fputs(_("\t-Z\t\t--locale\n"), fp); +#endif /* This is one string to make things easier on translators. */ /* TRANSLATORS: --help output 5 (end) @@ -1387,7 +1143,7 @@ arg_assign(char *arg, bool initing) setlocale(LC_NUMERIC, "C"); (void) force_number(it); if (do_posix) - setlocale(LC_NUMERIC, ""); + setlocale(LC_NUMERIC, locale); #endif /* LC_NUMERIC */ /* @@ -1651,3 +1407,285 @@ getenv_long(const char *name) } return -1; } + +/* parse_args --- do the getopt_long thing */ + +static void +parse_args(int argc, char **argv) +{ + /* + * The + on the front tells GNU getopt not to rearrange argv. + */ + const char *optlist = "+F:f:v:W;bcCd::D::e:E:ghi:l:L:nNo::Op::MPrStVYZ:"; + int old_optind; + int c; + char *scan; + char *src; + + /* we do error messages ourselves on invalid options */ + opterr = false; + + /* copy argv before getopt gets to it; used to restart the debugger */ + save_argv(argc, argv); + + /* option processing. ready, set, go! */ + for (optopt = 0, old_optind = 1; + (c = getopt_long(argc, argv, optlist, optab, NULL)) != EOF; + optopt = 0, old_optind = optind) { + if (do_posix) + opterr = true; + + switch (c) { + case 'F': + add_preassign(PRE_ASSIGN_FS, optarg); + break; + + case 'E': + disallow_var_assigns = true; + /* fall through */ + case 'f': + /* + * Allow multiple -f options. + * This makes function libraries real easy. + * Most of the magic is in the scanner. + * + * The following is to allow for whitespace at the end + * of a #! /bin/gawk line in an executable file + */ + scan = optarg; + if (argv[optind-1] != optarg) + while (isspace((unsigned char) *scan)) + scan++; + src = (*scan == '\0' ? argv[optind++] : optarg); + (void) add_srcfile((src && src[0] == '-' && src[1] == '\0') ? + SRC_STDIN : SRC_FILE, + src, srcfiles, NULL, NULL); + + break; + + case 'v': + add_preassign(PRE_ASSIGN, optarg); + break; + + case 'b': + do_binary = true; + break; + + case 'c': + do_flags |= DO_TRADITIONAL; + break; + + case 'C': + copyleft(); + break; + + case 'd': + do_flags |= DO_DUMP_VARS; + if (optarg != NULL && optarg[0] != '\0') + varfile = optarg; + break; + + case 'D': + do_flags |= DO_DEBUG; + if (optarg != NULL && optarg[0] != '\0') + command_file = optarg; + break; + + case 'e': + if (optarg[0] == '\0') + warning(_("empty argument to `-e/--source' ignored")); + else + (void) add_srcfile(SRC_CMDLINE, optarg, srcfiles, NULL, NULL); + break; + + case 'g': + do_flags |= DO_INTL; + break; + + case 'h': + /* write usage to stdout, per GNU coding stds */ + usage(EXIT_SUCCESS, stdout); + break; + + case 'i': + (void) add_srcfile(SRC_INC, optarg, srcfiles, NULL, NULL); + break; + + case 'l': + (void) add_srcfile(SRC_EXTLIB, optarg, srcfiles, NULL, NULL); + break; + +#ifndef NO_LINT + case 'L': + do_flags |= DO_LINT_ALL; + if (optarg != NULL) { + if (strcmp(optarg, "fatal") == 0) + lintfunc = r_fatal; + else if (strcmp(optarg, "invalid") == 0) { + do_flags &= ~DO_LINT_ALL; + do_flags |= DO_LINT_INVALID; + } + } + break; + + case 't': + do_flags |= DO_LINT_OLD; + break; +#else + case 'L': + case 't': + break; +#endif + + case 'n': + do_flags |= DO_NON_DEC_DATA; + break; + + case 'N': + use_lc_numeric = true; + break; + + case 'O': + do_optimize = true; + break; + + case 'p': + do_flags |= DO_PROFILE; + /* fall through */ + case 'o': + do_flags |= DO_PRETTY_PRINT; + if (optarg != NULL) + set_prof_file(optarg); + else + set_prof_file(DEFAULT_PROFILE); + break; + + case 'M': +#ifdef HAVE_MPFR + do_flags |= DO_MPFR; +#else + warning(_("-M ignored: MPFR/GMP support not compiled in")); +#endif + break; + + case 'P': + do_flags |= DO_POSIX; + break; + + case 'r': + do_flags |= DO_INTERVALS; + break; + + case 'S': + do_flags |= DO_SANDBOX; + break; + + case 'V': + do_version = true; + break; + + case 'W': /* gawk specific options - now in getopt_long */ + fprintf(stderr, _("%s: option `-W %s' unrecognized, ignored\n"), + argv[0], optarg); + break; + + case 0: + /* + * getopt_long found an option that sets a variable + * instead of returning a letter. Do nothing, just + * cycle around for the next one. + */ + break; + + case 'Y': + case 'Z': +#if defined(YYDEBUG) || defined(GAWKDEBUG) + if (c == 'Y') { + yydebug = 2; + break; + } +#endif +#if defined(LOCALEDEBUG) + if (c == 'Z') { + locale = optarg; + break; + } +#endif + /* if not debugging, fall through */ + case '?': + default: + /* + * If not posix, an unrecognized option stops argument + * processing so that it can go into ARGV for the awk + * program to see. This makes use of ``#! /bin/gawk -f'' + * easier. + * + * However, it's never simple. If optopt is set, + * an option that requires an argument didn't get the + * argument. We care because if opterr is 0, then + * getopt_long won't print the error message for us. + */ + if (! do_posix + && (optopt == '\0' || strchr(optlist, optopt) == NULL)) { + /* + * can't just do optind--. In case of an + * option with >= 2 letters, getopt_long + * won't have incremented optind. + */ + optind = old_optind; + stopped_early = true; + goto out; + } else if (optopt != '\0') { + /* Use POSIX required message format */ + fprintf(stderr, + _("%s: option requires an argument -- %c\n"), + myname, optopt); + usage(EXIT_FAILURE, stderr); + } + /* else + let getopt print error message for us */ + break; + } + if (c == 'E') /* --exec ends option processing */ + break; + } +out: + return; +} + +/* set_locale_stuff --- setup the locale stuff */ + +static void +set_locale_stuff(void) +{ +#if defined(LC_CTYPE) + setlocale(LC_CTYPE, locale); +#endif +#if defined(LC_COLLATE) + setlocale(LC_COLLATE, locale); +#endif +#if defined(LC_MESSAGES) + setlocale(LC_MESSAGES, locale); +#endif +#if defined(LC_NUMERIC) && defined(HAVE_LOCALE_H) + /* + * Force the issue here. According to POSIX 2001, decimal + * point is used for parsing source code and for command-line + * assignments and the locale value for processing input, + * number to string conversion, and printing output. + * + * 10/2005 --- see below also; we now only use the locale's + * decimal point if do_posix in effect. + * + * 9/2007: + * This is a mess. We need to get the locale's numeric info for + * the thousands separator for the %'d flag. + */ + setlocale(LC_NUMERIC, locale); + init_locale(& loc); + setlocale(LC_NUMERIC, "C"); +#endif +#if defined(LC_TIME) + setlocale(LC_TIME, locale); +#endif +} -- cgit v1.2.3 From 350265fafb2a0153d4207c67d626f135b308ad34 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Mon, 10 Nov 2014 23:08:53 +0200 Subject: Don't add -Z to usage. --- main.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index e3440b8c..b9b76618 100644 --- a/main.c +++ b/main.c @@ -609,9 +609,6 @@ usage(int exitval, FILE *fp) #ifdef GAWKDEBUG fputs(_("\t-Y\t\t--parsedebug\n"), fp); #endif -#if defined(LOCALEDEBUG) - fputs(_("\t-Z\t\t--locale\n"), fp); -#endif /* This is one string to make things easier on translators. */ /* TRANSLATORS: --help output 5 (end) -- cgit v1.2.3 From 8b863f8852067b0638e09dc7c82355b96381dc12 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Sat, 15 Nov 2014 18:35:45 +0200 Subject: Remove MBS_SUPPORT ifdefs. --- main.c | 7 ------- 1 file changed, 7 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index b9b76618..ddda1d66 100644 --- a/main.c +++ b/main.c @@ -155,9 +155,7 @@ static const char *locale = ""; /* default value to setlocale */ int use_lc_numeric = false; /* obey locale for decimal point */ -#if MBS_SUPPORT int gawk_mb_cur_max; /* MB_CUR_MAX value, see comment in main() */ -#endif FILE *output_fp; /* default gawk output, can be redirected in the debugger */ bool output_is_tty = false; /* control flushing of output */ @@ -290,14 +288,12 @@ main(int argc, char **argv) set_locale_stuff(); -#if MBS_SUPPORT /* * In glibc, MB_CUR_MAX is actually a function. This value is * tested *a lot* in many speed-critical places in gawk. Caching * this value once makes a speed difference. */ gawk_mb_cur_max = MB_CUR_MAX; - /* Without MBS_SUPPORT, gawk_mb_cur_max is 1. */ #ifdef LIBC_IS_BORKED { const char *env_lc; @@ -312,7 +308,6 @@ main(int argc, char **argv) /* init the cache for checking bytes if they're characters */ init_btowc_cache(); -#endif if (do_nostalgia) @@ -346,7 +341,6 @@ main(int argc, char **argv) if (do_lint && os_is_setuid()) warning(_("running %s setuid root may be a security problem"), myname); -#if MBS_SUPPORT if (do_binary) { if (do_posix) warning(_("`--posix' overrides `--characters-as-bytes'")); @@ -356,7 +350,6 @@ main(int argc, char **argv) setlocale(LC_ALL, "C"); #endif } -#endif if (do_debug) /* Need to register the debugger pre-exec hook before any other */ init_debug(); -- cgit v1.2.3 From d8035c3f7d40d741d7be27e323dcad5757a32759 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 21 Nov 2014 10:39:53 +0200 Subject: Some minor cleanups. --- main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index ddda1d66..1323330c 100644 --- a/main.c +++ b/main.c @@ -492,8 +492,7 @@ main(int argc, char **argv) if (use_lc_numeric) setlocale(LC_NUMERIC, locale); #endif -// fprintf(stderr, "locale is <%s>\n", locale); fflush(stderr); - + init_io(); output_fp = stdout; -- cgit v1.2.3