gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gawk-diffs] [SCM] gawk branch, master, updated. gawk-4.1.0-925-g5cd73ff


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, master, updated. gawk-4.1.0-925-g5cd73ff
Date: Mon, 10 Nov 2014 21:11:40 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, master has been updated
       via  5cd73ffdcdbd5de2d03b9db781ca26c5a5af516d (commit)
       via  350265fafb2a0153d4207c67d626f135b308ad34 (commit)
       via  b549d4314c75c5136bfc5ede78df5ecdfbd85690 (commit)
      from  2375b235875e65e2238b7723d29b9bcb527192e1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=5cd73ffdcdbd5de2d03b9db781ca26c5a5af516d

commit 5cd73ffdcdbd5de2d03b9db781ca26c5a5af516d
Merge: 2375b23 350265f
Author: Arnold D. Robbins <address@hidden>
Date:   Mon Nov 10 23:11:30 2014 +0200

    Merge branch 'gawk-4.1-stable'

diff --cc main.c
index 44021e5,b9b7661..f71b3e0
--- a/main.c
+++ b/main.c
@@@ -330,328 -286,135 +286,123 @@@ main(int argc, char **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;
+       parse_args(argc, argv);
  
-               switch (c) {
-               case 'F':
-                       add_preassign(PRE_ASSIGN_FS, optarg);
-                       break;
+       set_locale_stuff();
  
-               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);
+ #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
  
-                       break;
+       /* init the cache for checking bytes if they're characters */
+       init_btowc_cache();
+ #endif
  
-               case 'v':
-                       add_preassign(PRE_ASSIGN, optarg);
-                       break;
  
-               case 'b':
-                       do_binary = true;
-                       break;
+       if (do_nostalgia)
+               nostalgia();
  
-               case 'c':
+       /* 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;
-                       break;
+                       /*
+                        * POSIX compliance also implies
+                        * no GNU extensions either.
+                        */
+       }
  
-               case 'C':
-                       copyleft();
-                       break;
+       if (do_traditional && do_non_decimal_data) {
+               do_flags &= ~DO_NON_DEC_DATA;
+               warning(_("`--posix'/`--traditional' overrides 
`--non-decimal-data'"));
+       }
  
-               case 'd':
-                       do_flags |= DO_DUMP_VARS;
-                       if (optarg != NULL && optarg[0] != '\0')
-                               varfile = optarg;
-                       break;
+       if (do_lint && os_is_setuid())
+               warning(_("running %s setuid root may be a security problem"), 
myname);
  
-               case 'D':
-                       do_flags |= DO_DEBUG;
-                       if (optarg != NULL && optarg[0] != '\0')
-                               command_file = optarg;
-                       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 '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_debug)   /* Need to register the debugger pre-exec hook before 
any other */
+               init_debug();
  
-               case 'g':
-                       do_flags |= DO_INTL;
-                       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
  
-               case 'h':
-                       /* write usage to stdout, per GNU coding stds */
-                       usage(EXIT_SUCCESS, stdout);
-                       break;
+       /* load group set */
+       init_groupset();
  
-               case 'i':
-                       (void) add_srcfile(SRC_INC, optarg, srcfiles, NULL, 
NULL);
-                       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 'l':
-                       (void) add_srcfile(SRC_EXTLIB, optarg, srcfiles, NULL, 
NULL);
-                       break;
+       /*
+        * Tell the regex routines how they should work.
+        * Do this before initializing variables, since
+        * they could want to do a regexp compile.
+        */
+       resetup();
  
- #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;
+       /* Set up the special variables */
+       init_vars();
  
-               case 't':
-                       do_flags |= DO_LINT_OLD;
-                       break;
- #else
-               case 'L':
-               case 't':
-                       break;
- #endif
+       /* Set up the field variables */
+       init_fields();
  
-               case 'n':
-                       do_flags |= DO_NON_DEC_DATA;
-                       break;
+       /* Now process the pre-assignments */
+       for (i = 0; i <= numassigns; i++) {
+               if (preassigns[i].type == PRE_ASSIGN)
+                       (void) arg_assign(preassigns[i].val, true);
+               else    /* PRE_ASSIGN_FS */
+                       cmdline_fs(preassigns[i].val);
+               efree(preassigns[i].val);
+       }
  
-               case 'N':
-                       use_lc_numeric = true;
-                       break;
+       if (preassigns != NULL)
+               efree(preassigns);
  
-               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 field variables */
-       init_fields();
- 
-       /* Now process the pre-assignments */
-       for (i = 0; i <= numassigns; i++) {
-               if (preassigns[i].type == PRE_ASSIGN)
-                       (void) arg_assign(preassigns[i].val, true);
-               else    /* PRE_ASSIGN_FS */
-                       cmdline_fs(preassigns[i].val);
-               efree(preassigns[i].val);
-       }
- 
-       if (preassigns != NULL)
-               efree(preassigns);
- 
-       if ((BINMODE & BINMODE_INPUT) != 0)
-               if (os_setbinmode(fileno(stdin), O_BINARY) == -1)
-                       fatal(_("can't set binary mode on stdin (%s)"), 
strerror(errno));
-       if ((BINMODE & BINMODE_OUTPUT) != 0) {
-               if (os_setbinmode(fileno(stdout), O_BINARY) == -1)
-                       fatal(_("can't set binary mode on stdout (%s)"), 
strerror(errno));
-               if (os_setbinmode(fileno(stderr), O_BINARY) == -1)
-                       fatal(_("can't set binary mode on stderr (%s)"), 
strerror(errno));
-       }
+       if ((BINMODE & BINMODE_INPUT) != 0)
+               if (os_setbinmode(fileno(stdin), O_BINARY) == -1)
+                       fatal(_("can't set binary mode on stdin (%s)"), 
strerror(errno));
+       if ((BINMODE & BINMODE_OUTPUT) != 0) {
+               if (os_setbinmode(fileno(stdout), O_BINARY) == -1)
+                       fatal(_("can't set binary mode on stdout (%s)"), 
strerror(errno));
+               if (os_setbinmode(fileno(stderr), O_BINARY) == -1)
+                       fatal(_("can't set binary mode on stderr (%s)"), 
strerror(errno));
+       }
  
  #ifdef GAWKDEBUG
        setbuf(stdout, (char *) NULL);  /* make debugging easier */

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog    |   10 +
 configure    |    2 +-
 configure.ac |    2 +-
 main.c       |  754 ++++++++++++++++++++++++++++++----------------------------
 4 files changed, 406 insertions(+), 362 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]