"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "main.c" between
gawk-5.0.1.tar.xz and gawk-5.1.0.tar.xz

About: GNU awk - pattern scanning and processing language.

main.c  (gawk-5.0.1.tar.xz):main.c  (gawk-5.1.0.tar.xz)
/* /*
* main.c -- Code generator and main program for gawk. * main.c -- Code generator and main program for gawk.
*/ */
/* /*
* Copyright (C) 1986, 1988, 1989, 1991-2019 the Free Software Foundation, Inc. * Copyright (C) 1986, 1988, 1989, 1991-2020,
* the Free Software Foundation, Inc.
* *
* This file is part of GAWK, the GNU implementation of the * This file is part of GAWK, the GNU implementation of the
* AWK Programming Language. * AWK Programming Language.
* *
* GAWK is free software; you can redistribute it and/or modify * GAWK is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GAWK is distributed in the hope that it will be useful, * GAWK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US A * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US A
*/ */
/* FIX THIS BEFORE EVERY RELEASE: */ /* FIX THIS BEFORE EVERY RELEASE: */
#define UPDATE_YEAR 2019 #define UPDATE_YEAR 2020
#include "awk.h" #include "awk.h"
#include "getopt.h" #include "getopt.h"
#ifdef HAVE_MCHECK_H #ifdef HAVE_MCHECK_H
#include <mcheck.h> #include <mcheck.h>
#endif #endif
#ifdef HAVE_LIBSIGSEGV #ifdef HAVE_LIBSIGSEGV
#include <sigsegv.h> #include <sigsegv.h>
skipping to change at line 367 skipping to change at line 368
if (do_posix) if (do_posix)
warning(_("`--posix' overrides `--characters-as-bytes'")) ; warning(_("`--posix' overrides `--characters-as-bytes'")) ;
else else
gawk_mb_cur_max = 1; /* hands off my data! */ gawk_mb_cur_max = 1; /* hands off my data! */
#if defined(LC_ALL) #if defined(LC_ALL)
setlocale(LC_ALL, "C"); setlocale(LC_ALL, "C");
#endif #endif
} }
if (do_lint && os_is_setuid()) if (do_lint && os_is_setuid())
warning(_("running %s setuid root may be a security problem"), my name); lintwarn(_("running %s setuid root may be a security problem"), m yname);
if (do_debug) /* Need to register the debugger pre-exec hook before any other */ if (do_debug) /* Need to register the debugger pre-exec hook before any other */
init_debug(); init_debug();
#ifdef HAVE_MPFR #ifdef HAVE_MPFR
/* Set up MPFR defaults, and register pre-exec hook to process arithmetic opcodes */ /* Set up MPFR defaults, and register pre-exec hook to process arithmetic opcodes */
if (do_mpfr) if (do_mpfr)
init_mpfr(DEFAULT_PREC, DEFAULT_ROUNDMODE); init_mpfr(DEFAULT_PREC, DEFAULT_ROUNDMODE);
#endif #endif
skipping to change at line 420 skipping to change at line 421
else /* PRE_ASSIGN_FS */ else /* PRE_ASSIGN_FS */
cmdline_fs(preassigns[i].val); cmdline_fs(preassigns[i].val);
efree(preassigns[i].val); efree(preassigns[i].val);
} }
if (preassigns != NULL) if (preassigns != NULL)
efree(preassigns); efree(preassigns);
if ((BINMODE & BINMODE_INPUT) != 0) if ((BINMODE & BINMODE_INPUT) != 0)
if (os_setbinmode(fileno(stdin), O_BINARY) == -1) if (os_setbinmode(fileno(stdin), O_BINARY) == -1)
fatal(_("can't set binary mode on stdin (%s)"), strerror( errno)); fatal(_("cannot set binary mode on stdin: %s"), strerror( errno));
if ((BINMODE & BINMODE_OUTPUT) != 0) { if ((BINMODE & BINMODE_OUTPUT) != 0) {
if (os_setbinmode(fileno(stdout), O_BINARY) == -1) if (os_setbinmode(fileno(stdout), O_BINARY) == -1)
fatal(_("can't set binary mode on stdout (%s)"), strerror (errno)); fatal(_("cannot set binary mode on stdout: %s"), strerror (errno));
if (os_setbinmode(fileno(stderr), O_BINARY) == -1) if (os_setbinmode(fileno(stderr), O_BINARY) == -1)
fatal(_("can't set binary mode on stderr (%s)"), strerror (errno)); fatal(_("cannot set binary mode on stderr: %s"), strerror (errno));
} }
#ifdef GAWKDEBUG #ifdef GAWKDEBUG
setbuf(stdout, (char *) NULL); /* make debugging easier */ setbuf(stdout, (char *) NULL); /* make debugging easier */
#endif #endif
if (os_isatty(fileno(stdout))) if (os_isatty(fileno(stdout)))
output_is_tty = true; output_is_tty = true;
/* initialize API before loading extension libraries */ /* initialize API before loading extension libraries */
init_ext_api(); init_ext_api();
/* load extension libs */ /* load extension libs */
for (s = srcfiles->next; s != srcfiles; s = s->next) { for (s = srcfiles->next; s != srcfiles; s = s->next) {
if (s->stype == SRC_EXTLIB) if (s->stype == SRC_EXTLIB)
load_ext(s->fullpath); load_ext(s->fullpath);
else if (s->stype != SRC_INC) else if (s->stype != SRC_INC)
have_srcfile++; have_srcfile++;
} }
/* do version check after extensions are loaded to get extension info */ /* do version check after extensions are loaded to get extension info */
if (do_version) if (do_version)
version(); version();
/* No -f or --source options, use next arg */ /* No -f or --source options, use next arg */
if (! have_srcfile) { if (! have_srcfile) {
if (optind > argc - 1 || stopped_early) /* no args left or no pro gram */ if (optind > argc - 1 || stopped_early) /* no args left or no pro gram */
usage(EXIT_FAILURE, stderr); usage(EXIT_FAILURE, stderr);
(void) add_srcfile(SRC_CMDLINE, argv[optind], srcfiles, NULL, NUL L); (void) add_srcfile(SRC_CMDLINE, argv[optind], srcfiles, NULL, NUL L);
skipping to change at line 632 skipping to change at line 633
fputs(_("\t-W nostalgia\t\t--nostalgia\n"), fp); fputs(_("\t-W nostalgia\t\t--nostalgia\n"), fp);
#endif #endif
#ifdef GAWKDEBUG #ifdef GAWKDEBUG
fputs(_("\t-Y\t\t\t--parsedebug\n"), fp); fputs(_("\t-Y\t\t\t--parsedebug\n"), fp);
#endif #endif
#ifdef GAWKDEBUG #ifdef GAWKDEBUG
fputs(_("\t-Z locale-name\t\t--locale=locale-name\n"), fp); fputs(_("\t-Z locale-name\t\t--locale=locale-name\n"), fp);
#endif #endif
/* This is one string to make things easier on translators. */ /* This is one string to make things easier on translators. */
/* TRANSLATORS: --help output 5 (end) /* TRANSLATORS: --help output (end)
TRANSLATORS: the placeholder indicates the bug-reporting address
for this application. Please add _another line_ with the
address for translation bugs.
no-wrap */ no-wrap */
fputs(_("\nTo report bugs, see node `Bugs' in `gawk.info'\n\ fputs(_("\nTo report bugs, see node `Bugs' in `gawk.info'\n\
which is section `Reporting Problems and Bugs' in the\n\ which is section `Reporting Problems and Bugs' in the\n\
printed version. This same information may be found at\n\ printed version. This same information may be found at\n\
https://www.gnu.org/software/gawk/manual/html_node/Bugs.html.\n\ https://www.gnu.org/software/gawk/manual/html_node/Bugs.html.\n\
PLEASE do NOT try to report bugs by posting in comp.lang.awk,\n\ PLEASE do NOT try to report bugs by posting in comp.lang.awk,\n\
or by using a web forum such as Stack Overflow.\n\n"), fp); or by using a web forum such as Stack Overflow.\n\n"), fp);
/* ditto */ /* ditto */
fputs(_("gawk is a pattern scanning and processing language.\n\ fputs(_("gawk is a pattern scanning and processing language.\n\
By default it reads standard input and writes standard output.\n\n"), fp); By default it reads standard input and writes standard output.\n\n"), fp);
/* ditto */ /* ditto */
fputs(_("Examples:\n\tgawk '{ sum += $1 }; END { print sum }' file\n\ fprintf(fp, _("Examples:\n\t%s '{ sum += $1 }; END { print sum }' file\n\
\tgawk -F: '{ print $1 }' /etc/passwd\n"), fp); \t%s -F: '{ print $1 }' /etc/passwd\n"), myname, myname);
fflush(fp); fflush(fp);
if (ferror(fp)) { if (ferror(fp)) {
#ifdef __MINGW32__ #ifdef __MINGW32__
if (errno == 0 || errno == EINVAL) if (errno == 0 || errno == EINVAL)
w32_maybe_set_errno(); w32_maybe_set_errno();
#endif #endif
/* don't warn about stdout/stderr if EPIPE, but do error exit */ /* don't warn about stdout/stderr if EPIPE, but do error exit */
if (errno == EPIPE) if (errno == EPIPE)
die_via_sigpipe(); die_via_sigpipe();
if (fp == stdout) if (fp == stdout)
warning(_("error writing standard output (%s)"), strerror (errno)); warning(_("error writing standard output: %s"), strerror( errno));
else if (fp == stderr) else if (fp == stderr)
warning(_("error writing standard error (%s)"), strerror( errno)); warning(_("error writing standard error: %s"), strerror(e rrno));
// some other problem than SIGPIPE // some other problem than SIGPIPE
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
exit(exitval); exit(exitval);
} }
/* copyleft --- print out the short GNU copyright information */ /* copyleft --- print out the short GNU copyright information */
skipping to change at line 711 skipping to change at line 709
fputs(_(blurb_part3), stdout); fputs(_(blurb_part3), stdout);
fflush(stdout); fflush(stdout);
if (ferror(stdout)) { if (ferror(stdout)) {
#ifdef __MINGW32__ #ifdef __MINGW32__
if (errno == 0 || errno == EINVAL) if (errno == 0 || errno == EINVAL)
w32_maybe_set_errno(); w32_maybe_set_errno();
#endif #endif
/* don't warn about stdout if EPIPE, but do error exit */ /* don't warn about stdout if EPIPE, but do error exit */
if (errno != EPIPE) if (errno != EPIPE)
warning(_("error writing standard output (%s)"), strerror (errno)); warning(_("error writing standard output: %s"), strerror( errno));
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }
/* cmdline_fs --- set FS from the command line */ /* cmdline_fs --- set FS from the command line */
static void static void
cmdline_fs(char *str) cmdline_fs(char *str)
skipping to change at line 1694 skipping to change at line 1692
case 'r': case 'r':
do_flags |= DO_INTERVALS; do_flags |= DO_INTERVALS;
break; break;
case 's': case 's':
do_optimize = false; do_optimize = false;
break; break;
case 'S': case 'S':
do_flags |= DO_SANDBOX; do_flags |= DO_SANDBOX;
break; break;
case 'V': case 'V':
do_version = true; do_version = true;
break; break;
case 'W': /* gawk specific options - now in getopt_long */ case 'W': /* gawk specific options - now in getopt_long */
fprintf(stderr, _("%s: option `-W %s' unrecognized, ignor ed\n"), fprintf(stderr, _("%s: option `-W %s' unrecognized, ignor ed\n"),
argv[0], optarg); argv[0], optarg);
break; break;
 End of changes. 14 change blocks. 
19 lines changed or deleted 17 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)