diff options
-rw-r--r-- | ChangeLog | 29 | ||||
-rw-r--r-- | awk.h | 12 | ||||
-rw-r--r-- | builtin.c | 21 | ||||
-rwxr-xr-x | config.guess | 12 | ||||
-rwxr-xr-x | config.rpath | 2 | ||||
-rwxr-xr-x | config.sub | 5 | ||||
-rwxr-xr-x | configure | 33 | ||||
-rw-r--r-- | configure.ac | 33 | ||||
-rw-r--r-- | doc/ChangeLog | 6 | ||||
-rw-r--r-- | doc/gawk.info | 1122 | ||||
-rw-r--r-- | doc/gawk.texi | 59 | ||||
-rw-r--r-- | doc/gawktexi.in | 59 | ||||
-rw-r--r-- | extension/build-aux/ChangeLog | 5 | ||||
-rwxr-xr-x | extension/build-aux/config.guess | 12 | ||||
-rwxr-xr-x | extension/build-aux/config.rpath | 2 | ||||
-rwxr-xr-x | extension/build-aux/config.sub | 5 | ||||
-rwxr-xr-x | extension/build-aux/install-sh | 4 | ||||
-rwxr-xr-x | install-sh | 4 | ||||
-rw-r--r-- | io.c | 69 | ||||
-rw-r--r-- | main.c | 5 | ||||
-rw-r--r-- | test/ChangeLog | 7 | ||||
-rw-r--r-- | test/Makefile.am | 12 | ||||
-rw-r--r-- | test/Makefile.in | 12 | ||||
-rw-r--r-- | test/argarray.ok | 4 |
24 files changed, 888 insertions, 646 deletions
@@ -1,3 +1,32 @@ +2017-03-20 Arnold D. Robbins <arnold@skeeve.com> + + Improve handling of EPIPE. Problems reported by + Alexandre Ferrieux <alexandre.ferrieux@orange.com> + and David Kerns <david.t.kerns@gmail.com>. + + * awk.h (ignore_sigpipe, set_sigpipe_to_default, + non_fatal_flush_std): Declare new functions. + (ignore_sigpipe, set_sigpipe_to_default, + non_fatal_flush_std): New macros. + * builtin.c (do_fflush): When nonfatal not in force, flush + of stdout/stderr and EPIPE exits, simulating SIGPIPE, as + in nawk/mawk. Flush of other redirections with EPIPE now + also fatals. + (do_system): Use ignore_sipipe and set_sigpipe_to_default + instead of uglier inline ifdefed code. + * main.c (main): Ditto. + * io.c (redirect_string, two_way_open, gawk_popen): Ditto. + (flush_io): Use non_fatal_flush_std for stdout and stderr. + + Unrelated: + + * config.guess, config.rpath, config.sub, install-sh: + Sync with GNULIB. + +2017-03-16 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac: Some cleanups. + 2017-03-09 Andrew J. Schorr <aschorr@telemetry-investments.com> * gawkapi.h (awk_input_field_info_t): Define new structure to contain @@ -1586,6 +1586,10 @@ extern bool inrec(IOBUF *iop, int *errcode); extern int nextfile(IOBUF **curfile, bool skipping); extern bool is_non_fatal_std(FILE *fp); extern bool is_non_fatal_redirect(const char *str, size_t len); +extern void ignore_sigpipe(void); +extern void set_sigpipe_to_default(void); +extern bool non_fatal_flush_std_file(FILE *fp); + /* main.c */ extern int arg_assign(char *arg, bool initing); extern int is_std_var(const char *var); @@ -1960,3 +1964,11 @@ erealloc_real(void *ptr, size_t count, const char *where, const char *var, const return ret; } + +#ifdef SIGPIPE +#define ignore_sigpipe() signal(SIGPIPE, SIG_IGN) +#define set_sigpipe_to_default() signal(SIGPIPE, SIG_DFL) +#else +#define ignore_sigpipe() +#define set_sigpipe_to_default() +#endif @@ -133,7 +133,6 @@ wrerror: if (fp == stdout && errno == EPIPE) gawk_exit(EXIT_FATAL); - /* otherwise die verbosely */ if ((rp != NULL) ? is_non_fatal_redirect(rp->value, strlen(rp->value)) : is_non_fatal_std(fp)) update_ERRNO_int(errno); @@ -245,13 +244,19 @@ do_fflush(int nargs) return make_number((AWKNUM) status); } fp = rp->output.fp; - if (fp != NULL) + if (fp != NULL) { status = rp->output.gawk_fflush(fp, rp->output.opaque); - else if ((rp->flag & RED_TWOWAY) != 0) + + if (status != 0) { + if (! is_non_fatal_redirect(tmp->stptr, tmp->stlen)) + fatal(_("fflush: cannot flush file `%.*s': %s"), + len, file, strerror(errno)); + } + } else if ((rp->flag & RED_TWOWAY) != 0) warning(_("fflush: cannot flush: two-way pipe `%.*s' has closed write end"), len, file); } else if ((fp = stdfile(tmp->stptr, tmp->stlen)) != NULL) { - status = fflush(fp); + status = (non_fatal_flush_std_file(fp) == false); } else { status = -1; warning(_("fflush: `%.*s' is not an open file, pipe or co-process"), len, file); @@ -2148,9 +2153,7 @@ do_system(int nargs) cmd[tmp->stlen] = '\0'; os_restore_mode(fileno(stdin)); -#ifdef SIGPIPE - signal(SIGPIPE, SIG_DFL); -#endif + set_sigpipe_to_default(); status = system(cmd); /* @@ -2176,9 +2179,7 @@ do_system(int nargs) if ((BINMODE & BINMODE_INPUT) != 0) os_setbinmode(fileno(stdin), O_BINARY); -#ifdef SIGPIPE - signal(SIGPIPE, SIG_IGN); -#endif + ignore_sigpipe(); cmd[tmp->stlen] = save; } diff --git a/config.guess b/config.guess index bbd48b60..69ed3e57 100755 --- a/config.guess +++ b/config.guess @@ -2,7 +2,7 @@ # Attempt to guess a canonical system name. # Copyright 1992-2017 Free Software Foundation, Inc. -timestamp='2017-01-01' +timestamp='2017-03-05' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -837,10 +837,11 @@ EOF UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + UNAME_PROCESSOR=x86_64 ;; + i386) + UNAME_PROCESSOR=i586 ;; esac + echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin @@ -1343,6 +1344,9 @@ EOF NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; + NSX-?:NONSTOP_KERNEL:*:*) + echo nsx-tandem-nsk${UNAME_RELEASE} + exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; diff --git a/config.rpath b/config.rpath index 98183ff2..af3c4155 100755 --- a/config.rpath +++ b/config.rpath @@ -2,7 +2,7 @@ # Output a system dependent set of variables, describing how to set the # run time search path of shared libraries in an executable. # -# Copyright 1996-2016 Free Software Foundation, Inc. +# Copyright 1996-2017 Free Software Foundation, Inc. # Taken from GNU libtool, 2001 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 # @@ -2,7 +2,7 @@ # Configuration validation subroutine script. # Copyright 1992-2017 Free Software Foundation, Inc. -timestamp='2017-01-01' +timestamp='2017-02-07' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -948,6 +948,9 @@ case $basic_machine in nsr-tandem) basic_machine=nsr-tandem ;; + nsx-tandem) + basic_machine=nsx-tandem + ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf @@ -1409,8 +1409,9 @@ Optional Features: --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") - --disable-lint Disable gawk lint checking - --enable-severe-portability-problems Enable really nasty portability problems + --disable-lint Disable gawk lint checking + --enable-severe-portability-problems + Enable really nasty portability problems --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking @@ -1423,7 +1424,9 @@ Optional Features: Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-whiny-user-strftime Force use of included version of strftime for deficient systems + --with-whiny-user-strftime + Force use of included version of strftime for + deficient systems --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib --without-libiconv-prefix don't search for libiconv in includedir and libdir @@ -8803,8 +8806,10 @@ else # Systems have either "struct sockaddr *" or # "void *" as the second argument to getpeername rsync_cv_socklen_t_equiv= - for arg2 in "struct sockaddr" void; do - for t in int size_t unsigned long "unsigned long"; do + for arg2 in "struct sockaddr" void + do + for t in int size_t unsigned long "unsigned long" + do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -8834,7 +8839,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done done - if test "x$rsync_cv_socklen_t_equiv" = x; then + if test "x$rsync_cv_socklen_t_equiv" = x + then rsync_cv_socklen_t_equiv=int fi @@ -9966,7 +9972,8 @@ if test "${enable_extensions+set}" = set; then : enableval=$enable_extensions; fi -if test "x$enable_extensions" != "xno"; then +if test "x$enable_extensions" != "xno" +then extensions_supported=no case $host_os in @@ -10046,7 +10053,8 @@ fi $as_echo "#define DYNAMIC 1" >>confdefs.h # Add -export-dynamic for old extensions. Only works for GCC - if test "$GCC" = yes; then + if test "$GCC" = yes + then case $host_os in linux*|freebsd*) LDFLAGS="$LDFLAGS -Wl,-export-dynamic" @@ -10061,7 +10069,8 @@ fi ;; esac - if test "x$enable_extensions$extensions_supported" = "xyesno"; then + if test "x$enable_extensions$extensions_supported" = "xyesno" + then as_fn_error $? "extension support requested, but unavailable" "$LINENO" 5 fi enable_extensions=$extensions_supported @@ -10150,7 +10159,8 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi -if test "$has_f_format" = yes; then +if test "$has_f_format" = yes +then $as_echo "#define PRINTF_HAS_F_FORMAT 1" >>confdefs.h @@ -10973,7 +10983,8 @@ esac ac_config_files="$ac_config_files Makefile support/Makefile awklib/Makefile doc/Makefile extras/Makefile po/Makefile.in test/Makefile" -if test "x$enable_extensions" = "xyes"; then +if test "x$enable_extensions" = "xyes" +then subdirs="$subdirs extension" diff --git a/configure.ac b/configure.ac index 5a57904b..ec5f1abe 100644 --- a/configure.ac +++ b/configure.ac @@ -45,20 +45,23 @@ AM_INIT_AUTOMAKE([1.15 dist-xz dist-lzip]) AC_CONFIG_MACRO_DIR([m4]) dnl Additional argument stuff -AC_ARG_WITH(whiny-user-strftime, [ --with-whiny-user-strftime Force use of included version of strftime for deficient systems], +AC_ARG_WITH(whiny-user-strftime, + [AS_HELP_STRING([--with-whiny-user-strftime], [Force use of included version of strftime for deficient systems])], if test "$withval" = yes then AC_DEFINE(USE_INCLUDED_STRFTIME, 1, [force use of our version of strftime]) fi ) -AC_ARG_ENABLE([lint], [ --disable-lint Disable gawk lint checking], +AC_ARG_ENABLE([lint], + [AS_HELP_STRING([--disable-lint],[Disable gawk lint checking])], if test "$enableval" = no then AC_DEFINE(NO_LINT, 1, [disable lint checks]) fi ) -AC_ARG_ENABLE([severe-portability-problems], [ --enable-severe-portability-problems Enable really nasty portability problems], +AC_ARG_ENABLE([severe-portability-problems], + [AS_HELP_STRING([--enable-severe-portability-problems],[Enable really nasty portability problems])], if test "$enableval" = yes then AC_DEFINE(I_DONT_KNOW_WHAT_IM_DOING, 1, [enable severe portability problems]) @@ -206,8 +209,10 @@ AC_DEFUN([TYPE_SOCKLEN_T], # Systems have either "struct sockaddr *" or # "void *" as the second argument to getpeername rsync_cv_socklen_t_equiv= - for arg2 in "struct sockaddr" void; do - for t in int size_t unsigned long "unsigned long"; do + for arg2 in "struct sockaddr" void + do + for t in int size_t unsigned long "unsigned long" + do AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> #include <sys/socket.h> @@ -223,7 +228,8 @@ AC_DEFUN([TYPE_SOCKLEN_T], done done - if test "x$rsync_cv_socklen_t_equiv" = x; then + if test "x$rsync_cv_socklen_t_equiv" = x + then dnl Some systems get this. Default to int. -- ADR dnl AC_MSG_ERROR([Cannot find a type to use in place of socklen_t]) rsync_cv_socklen_t_equiv=int @@ -280,7 +286,8 @@ dnl check for dynamic linking dnl This is known to be very primitive AC_ARG_ENABLE([extensions], [AS_HELP_STRING([--disable-extensions], [disable dynamic extensions (default is detect)])]) -if test "x$enable_extensions" != "xno"; then +if test "x$enable_extensions" != "xno" +then extensions_supported=no dnl On MirBSD (and probably other systems), don't even try. @@ -301,7 +308,8 @@ if test "x$enable_extensions" != "xno"; then extensions_supported=yes AC_DEFINE([DYNAMIC], 1, [dynamic loading is possible]) # Add -export-dynamic for old extensions. Only works for GCC - if test "$GCC" = yes; then + if test "$GCC" = yes + then case $host_os in linux*|freebsd*) LDFLAGS="$LDFLAGS -Wl,-export-dynamic" @@ -313,7 +321,8 @@ if test "x$enable_extensions" != "xno"; then ;; esac - if test "x$enable_extensions$extensions_supported" = "xyesno"; then + if test "x$enable_extensions$extensions_supported" = "xyesno" + then AC_MSG_ERROR([extension support requested, but unavailable]) fi enable_extensions=$extensions_supported @@ -354,7 +363,8 @@ int main() has_f_format=no, has_f_format=no dnl Cross-compiling, assuming the worst. ) -if test "$has_f_format" = yes; then +if test "$has_f_format" = yes +then AC_DEFINE(PRINTF_HAS_F_FORMAT, 1, [Define to 1 if *printf supports %F format]) fi AC_MSG_RESULT($has_f_format) @@ -413,7 +423,8 @@ AC_CONFIG_FILES(Makefile extras/Makefile po/Makefile.in test/Makefile) -if test "x$enable_extensions" = "xyes"; then +if test "x$enable_extensions" = "xyes" +then AC_CONFIG_SUBDIRS(extension) fi AC_OUTPUT diff --git a/doc/ChangeLog b/doc/ChangeLog index f6b77ed8..142f035e 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,9 @@ +2017-03-17 Arnold D. Robbins <arnold@skeeve.com> + + * gawktexi.in: Improve the discussion of quoting on + MS-Windows. Original text contributed by + Vincent Belaiche <vincent.belaiche@gmail.com>. + 2017-03-03 Arnold D. Robbins <arnold@skeeve.com> * gawktexi.in: Additional small writing tip in the notes diff --git a/doc/gawk.info b/doc/gawk.info index 8e3dc9dd..197dc2f7 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -1859,11 +1859,45 @@ that it is worth addressing. The "shells" on Microsoft Windows systems use the double-quote character for quoting, and make it difficult or impossible to include an escaped double-quote character in a command-line script. The following -example, courtesy of Jeroen Brink, shows how to print all lines in a -file surrounded by double quotes: +example, courtesy of Jeroen Brink, shows how to escape the double quotes +from this one liner script that prints all lines in a file surrounded by +double quotes: + + { print "\"" $0 "\"" } + +In an MS-Windows command-line the one-liner script above may be passed +as follows: gawk "{ print \"\042\" $0 \"\042\" }" FILE + In this example the '\042' is the octal code for a double-quote; +'gawk' converts it into a real double-quote for output by the 'print' +statement. + + In MS-Windows escaping double-quotes is a little tricky because you +use backslashes to escape double-quotes, but backslashes themselves are +not escaped in the usual way; indeed they are either duplicated or not, +depending upon whether there is a subsequent double-quote. The +MS-Windows rule for double-quoting a string is the following: + + 1. For each double quote in the orginal string, let N be the number of + backslash(es) before it, N might be zero. Replace these N + backslash(es) by 2*N+1 backslash(es) + + 2. Let N be the number of backslash(es) tailing the original string, N + might be zero. Replace these N backslash(es) by 2*N backslash(es) + + 3. Surround the resulting string by double-quotes. + + So to double-quote the one-liner script '{ print "\"" $0 "\"" }' from +the previous example you would do it this way: + + gawk "{ print \"\\\"\" $0 \"\\\"\" }" FILE + +However, the use of '\042' instead of '\\\"' is also possible and easier +to read, because backslashes that are not followed by a double-quote +don't need duplication. + File: gawk.info, Node: Sample Data Files, Next: Very Simple, Prev: Running gawk, Up: Getting Started @@ -35463,547 +35497,547 @@ Ref: Executable Scripts-Footnote-184482 Node: Comments84585 Node: Quoting87069 Node: DOS Quoting92586 -Node: Sample Data Files93261 -Node: Very Simple95856 -Node: Two Rules100758 -Node: More Complex102643 -Node: Statements/Lines105509 -Ref: Statements/Lines-Footnote-1109968 -Node: Other Features110233 -Node: When111169 -Ref: When-Footnote-1112923 -Node: Intro Summary112988 -Node: Invoking Gawk113872 -Node: Command Line115386 -Node: Options116184 -Ref: Options-Footnote-1132283 -Ref: Options-Footnote-2132513 -Node: Other Arguments132538 -Node: Naming Standard Input135485 -Node: Environment Variables136578 -Node: AWKPATH Variable137136 -Ref: AWKPATH Variable-Footnote-1140547 -Ref: AWKPATH Variable-Footnote-2140581 -Node: AWKLIBPATH Variable140842 -Node: Other Environment Variables142099 -Node: Exit Status145920 -Node: Include Files146597 -Node: Loading Shared Libraries150192 -Node: Obsolete151620 -Node: Undocumented152312 -Node: Invoking Summary152609 -Node: Regexp154269 -Node: Regexp Usage155723 -Node: Escape Sequences157760 -Node: Regexp Operators163992 -Ref: Regexp Operators-Footnote-1171408 -Ref: Regexp Operators-Footnote-2171555 -Node: Bracket Expressions171653 -Ref: table-char-classes174129 -Node: Leftmost Longest177266 -Node: Computed Regexps178569 -Node: GNU Regexp Operators181996 -Node: Case-sensitivity185675 -Ref: Case-sensitivity-Footnote-1188562 -Ref: Case-sensitivity-Footnote-2188797 -Node: Regexp Summary188905 -Node: Reading Files190371 -Node: Records192534 -Node: awk split records193267 -Node: gawk split records198198 -Ref: gawk split records-Footnote-1202738 -Node: Fields202775 -Node: Nonconstant Fields205516 -Ref: Nonconstant Fields-Footnote-1207752 -Node: Changing Fields207956 -Node: Field Separators213884 -Node: Default Field Splitting216582 -Node: Regexp Field Splitting217700 -Node: Single Character Fields221053 -Node: Command Line Field Separator222113 -Node: Full Line Fields225331 -Ref: Full Line Fields-Footnote-1226853 -Ref: Full Line Fields-Footnote-2226899 -Node: Field Splitting Summary227000 -Node: Constant Size229074 -Node: Splitting By Content233652 -Ref: Splitting By Content-Footnote-1237623 -Node: Multiple Line237786 -Ref: Multiple Line-Footnote-1243668 -Node: Getline243847 -Node: Plain Getline246314 -Node: Getline/Variable248953 -Node: Getline/File250102 -Node: Getline/Variable/File251488 -Ref: Getline/Variable/File-Footnote-1253091 -Node: Getline/Pipe253179 -Node: Getline/Variable/Pipe255884 -Node: Getline/Coprocess257017 -Node: Getline/Variable/Coprocess258282 -Node: Getline Notes259022 -Node: Getline Summary261817 -Ref: table-getline-variants262239 -Node: Read Timeout262987 -Ref: Read Timeout-Footnote-1266893 -Node: Retrying Input266951 -Node: Command-line directories268150 -Node: Input Summary269056 -Node: Input Exercises272228 -Node: Printing272956 -Node: Print274790 -Node: Print Examples276247 -Node: Output Separators279027 -Node: OFMT281044 -Node: Printf282400 -Node: Basic Printf283185 -Node: Control Letters284759 -Node: Format Modifiers288747 -Node: Printf Examples294762 -Node: Redirection297248 -Node: Special FD304089 -Ref: Special FD-Footnote-1307257 -Node: Special Files307331 -Node: Other Inherited Files307948 -Node: Special Network308949 -Node: Special Caveats309809 -Node: Close Files And Pipes310758 -Ref: table-close-pipe-return-values317665 -Ref: Close Files And Pipes-Footnote-1318448 -Ref: Close Files And Pipes-Footnote-2318596 -Node: Nonfatal318748 -Node: Output Summary321073 -Node: Output Exercises322295 -Node: Expressions322974 -Node: Values324162 -Node: Constants324840 -Node: Scalar Constants325531 -Ref: Scalar Constants-Footnote-1326395 -Node: Nondecimal-numbers326645 -Node: Regexp Constants329646 -Node: Using Constant Regexps330172 -Node: Standard Regexp Constants330794 -Node: Strong Regexp Constants333982 -Node: Variables336940 -Node: Using Variables337597 -Node: Assignment Options339507 -Node: Conversion341380 -Node: Strings And Numbers341904 -Ref: Strings And Numbers-Footnote-1344967 -Node: Locale influences conversions345076 -Ref: table-locale-affects347834 -Node: All Operators348452 -Node: Arithmetic Ops349081 -Node: Concatenation351587 -Ref: Concatenation-Footnote-1354434 -Node: Assignment Ops354541 -Ref: table-assign-ops359532 -Node: Increment Ops360845 -Node: Truth Values and Conditions364305 -Node: Truth Values365379 -Node: Typing and Comparison366427 -Node: Variable Typing367247 -Ref: Variable Typing-Footnote-1373710 -Ref: Variable Typing-Footnote-2373782 -Node: Comparison Operators373859 -Ref: table-relational-ops374278 -Node: POSIX String Comparison377773 -Ref: POSIX String Comparison-Footnote-1379468 -Ref: POSIX String Comparison-Footnote-2379607 -Node: Boolean Ops379691 -Ref: Boolean Ops-Footnote-1384173 -Node: Conditional Exp384265 -Node: Function Calls386001 -Node: Precedence389878 -Node: Locales393537 -Node: Expressions Summary395169 -Node: Patterns and Actions397742 -Node: Pattern Overview398862 -Node: Regexp Patterns400539 -Node: Expression Patterns401081 -Node: Ranges404862 -Node: BEGIN/END407970 -Node: Using BEGIN/END408731 -Ref: Using BEGIN/END-Footnote-1411467 -Node: I/O And BEGIN/END411573 -Node: BEGINFILE/ENDFILE413887 -Node: Empty416794 -Node: Using Shell Variables417111 -Node: Action Overview419385 -Node: Statements421710 -Node: If Statement423558 -Node: While Statement425053 -Node: Do Statement427081 -Node: For Statement428229 -Node: Switch Statement431387 -Node: Break Statement433773 -Node: Continue Statement435865 -Node: Next Statement437692 -Node: Nextfile Statement440075 -Node: Exit Statement442727 -Node: Built-in Variables445130 -Node: User-modified446263 -Node: Auto-set453849 -Ref: Auto-set-Footnote-1468502 -Ref: Auto-set-Footnote-2468708 -Node: ARGC and ARGV468764 -Node: Pattern Action Summary472977 -Node: Arrays475407 -Node: Array Basics476736 -Node: Array Intro477580 -Ref: figure-array-elements479555 -Ref: Array Intro-Footnote-1482259 -Node: Reference to Elements482387 -Node: Assigning Elements484851 -Node: Array Example485342 -Node: Scanning an Array487101 -Node: Controlling Scanning490123 -Ref: Controlling Scanning-Footnote-1495522 -Node: Numeric Array Subscripts495838 -Node: Uninitialized Subscripts498022 -Node: Delete499641 -Ref: Delete-Footnote-1502393 -Node: Multidimensional502450 -Node: Multiscanning505545 -Node: Arrays of Arrays507136 -Node: Arrays Summary511903 -Node: Functions513996 -Node: Built-in515034 -Node: Calling Built-in516115 -Node: Numeric Functions518111 -Ref: Numeric Functions-Footnote-1522944 -Ref: Numeric Functions-Footnote-2523301 -Ref: Numeric Functions-Footnote-3523349 -Node: String Functions523621 -Ref: String Functions-Footnote-1547125 -Ref: String Functions-Footnote-2547253 -Ref: String Functions-Footnote-3547501 -Node: Gory Details547588 -Ref: table-sub-escapes549379 -Ref: table-sub-proposed550898 -Ref: table-posix-sub552261 -Ref: table-gensub-escapes553802 -Ref: Gory Details-Footnote-1554625 -Node: I/O Functions554779 -Ref: table-system-return-values561361 -Ref: I/O Functions-Footnote-1563341 -Ref: I/O Functions-Footnote-2563489 -Node: Time Functions563609 -Ref: Time Functions-Footnote-1574276 -Ref: Time Functions-Footnote-2574344 -Ref: Time Functions-Footnote-3574502 -Ref: Time Functions-Footnote-4574613 -Ref: Time Functions-Footnote-5574725 -Ref: Time Functions-Footnote-6574952 -Node: Bitwise Functions575218 -Ref: table-bitwise-ops575812 -Ref: Bitwise Functions-Footnote-1581845 -Ref: Bitwise Functions-Footnote-2582018 -Node: Type Functions582209 -Node: I18N Functions584884 -Node: User-defined586535 -Node: Definition Syntax587340 -Ref: Definition Syntax-Footnote-1593027 -Node: Function Example593098 -Ref: Function Example-Footnote-1596020 -Node: Function Caveats596042 -Node: Calling A Function596560 -Node: Variable Scope597518 -Node: Pass By Value/Reference600512 -Node: Return Statement604011 -Node: Dynamic Typing606990 -Node: Indirect Calls607920 -Ref: Indirect Calls-Footnote-1618171 -Node: Functions Summary618299 -Node: Library Functions621004 -Ref: Library Functions-Footnote-1624611 -Ref: Library Functions-Footnote-2624754 -Node: Library Names624925 -Ref: Library Names-Footnote-1628385 -Ref: Library Names-Footnote-2628608 -Node: General Functions628694 -Node: Strtonum Function629797 -Node: Assert Function632819 -Node: Round Function636145 -Node: Cliff Random Function637686 -Node: Ordinal Functions638702 -Ref: Ordinal Functions-Footnote-1641765 -Ref: Ordinal Functions-Footnote-2642017 -Node: Join Function642227 -Ref: Join Function-Footnote-1643997 -Node: Getlocaltime Function644197 -Node: Readfile Function647939 -Node: Shell Quoting649911 -Node: Data File Management651312 -Node: Filetrans Function651944 -Node: Rewind Function656040 -Node: File Checking657946 -Ref: File Checking-Footnote-1659280 -Node: Empty Files659481 -Node: Ignoring Assigns661460 -Node: Getopt Function663010 -Ref: Getopt Function-Footnote-1674479 -Node: Passwd Functions674679 -Ref: Passwd Functions-Footnote-1683518 -Node: Group Functions683606 -Ref: Group Functions-Footnote-1691504 -Node: Walking Arrays691711 -Node: Library Functions Summary694719 -Node: Library Exercises696125 -Node: Sample Programs696590 -Node: Running Examples697360 -Node: Clones698088 -Node: Cut Program699312 -Node: Egrep Program709241 -Ref: Egrep Program-Footnote-1716753 -Node: Id Program716863 -Node: Split Program720543 -Ref: Split Program-Footnote-1724002 -Node: Tee Program724131 -Node: Uniq Program726921 -Node: Wc Program734347 -Ref: Wc Program-Footnote-1738602 -Node: Miscellaneous Programs738696 -Node: Dupword Program739909 -Node: Alarm Program741939 -Node: Translate Program746794 -Ref: Translate Program-Footnote-1751359 -Node: Labels Program751629 -Ref: Labels Program-Footnote-1754980 -Node: Word Sorting755064 -Node: History Sorting759136 -Node: Extract Program760971 -Node: Simple Sed768500 -Node: Igawk Program771574 -Ref: Igawk Program-Footnote-1785905 -Ref: Igawk Program-Footnote-2786107 -Ref: Igawk Program-Footnote-3786229 -Node: Anagram Program786344 -Node: Signature Program789406 -Node: Programs Summary790653 -Node: Programs Exercises791867 -Ref: Programs Exercises-Footnote-1795996 -Node: Advanced Features796087 -Node: Nondecimal Data798077 -Node: Array Sorting799668 -Node: Controlling Array Traversal800368 -Ref: Controlling Array Traversal-Footnote-1808735 -Node: Array Sorting Functions808853 -Ref: Array Sorting Functions-Footnote-1813944 -Node: Two-way I/O814140 -Ref: Two-way I/O-Footnote-1820691 -Ref: Two-way I/O-Footnote-2820878 -Node: TCP/IP Networking820960 -Node: Profiling824078 -Ref: Profiling-Footnote-1832750 -Node: Advanced Features Summary833073 -Node: Internationalization834917 -Node: I18N and L10N836397 -Node: Explaining gettext837084 -Ref: Explaining gettext-Footnote-1842976 -Ref: Explaining gettext-Footnote-2843161 -Node: Programmer i18n843326 -Ref: Programmer i18n-Footnote-1848275 -Node: Translator i18n848324 -Node: String Extraction849118 -Ref: String Extraction-Footnote-1850250 -Node: Printf Ordering850336 -Ref: Printf Ordering-Footnote-1853122 -Node: I18N Portability853186 -Ref: I18N Portability-Footnote-1855642 -Node: I18N Example855705 -Ref: I18N Example-Footnote-1858511 -Node: Gawk I18N858584 -Node: I18N Summary859229 -Node: Debugger860570 -Node: Debugging861592 -Node: Debugging Concepts862033 -Node: Debugging Terms863842 -Node: Awk Debugging866417 -Node: Sample Debugging Session867323 -Node: Debugger Invocation867857 -Node: Finding The Bug869243 -Node: List of Debugger Commands875721 -Node: Breakpoint Control877054 -Node: Debugger Execution Control880748 -Node: Viewing And Changing Data884110 -Node: Execution Stack887484 -Node: Debugger Info889121 -Node: Miscellaneous Debugger Commands893192 -Node: Readline Support898280 -Node: Limitations899176 -Node: Debugging Summary901285 -Node: Arbitrary Precision Arithmetic902564 -Node: Computer Arithmetic903980 -Ref: table-numeric-ranges907571 -Ref: Computer Arithmetic-Footnote-1908293 -Node: Math Definitions908350 -Ref: table-ieee-formats911664 -Ref: Math Definitions-Footnote-1912267 -Node: MPFR features912372 -Node: FP Math Caution914089 -Ref: FP Math Caution-Footnote-1915161 -Node: Inexactness of computations915530 -Node: Inexact representation916490 -Node: Comparing FP Values917850 -Node: Errors accumulate918932 -Node: Getting Accuracy920365 -Node: Try To Round923075 -Node: Setting precision923974 -Ref: table-predefined-precision-strings924671 -Node: Setting the rounding mode926501 -Ref: table-gawk-rounding-modes926875 -Ref: Setting the rounding mode-Footnote-1930283 -Node: Arbitrary Precision Integers930462 -Ref: Arbitrary Precision Integers-Footnote-1935379 -Node: POSIX Floating Point Problems935528 -Ref: POSIX Floating Point Problems-Footnote-1939410 -Node: Floating point summary939448 -Node: Dynamic Extensions941638 -Node: Extension Intro943191 -Node: Plugin License944457 -Node: Extension Mechanism Outline945254 -Ref: figure-load-extension945693 -Ref: figure-register-new-function947258 -Ref: figure-call-new-function948350 -Node: Extension API Description950412 -Node: Extension API Functions Introduction952054 -Node: General Data Types957388 -Ref: General Data Types-Footnote-1964593 -Node: Memory Allocation Functions964892 -Ref: Memory Allocation Functions-Footnote-1967737 -Node: Constructor Functions967836 -Node: Registration Functions970835 -Node: Extension Functions971520 -Node: Exit Callback Functions976733 -Node: Extension Version String977983 -Node: Input Parsers978646 -Node: Output Wrappers988528 -Node: Two-way processors993040 -Node: Printing Messages995305 -Ref: Printing Messages-Footnote-1996476 -Node: Updating ERRNO996629 -Node: Requesting Values997368 -Ref: table-value-types-returned998105 -Node: Accessing Parameters999041 -Node: Symbol Table Access1000276 -Node: Symbol table by name1000788 -Node: Symbol table by cookie1002577 -Ref: Symbol table by cookie-Footnote-11006762 -Node: Cached values1006826 -Ref: Cached values-Footnote-11010362 -Node: Array Manipulation1010453 -Ref: Array Manipulation-Footnote-11011544 -Node: Array Data Types1011581 -Ref: Array Data Types-Footnote-11014239 -Node: Array Functions1014331 -Node: Flattening Arrays1018730 -Node: Creating Arrays1025671 -Node: Redirection API1030440 -Node: Extension API Variables1033282 -Node: Extension Versioning1033915 -Ref: gawk-api-version1034352 -Node: Extension API Informational Variables1036080 -Node: Extension API Boilerplate1037144 -Node: Changes from API V11041006 -Node: Finding Extensions1041666 -Node: Extension Example1042225 -Node: Internal File Description1043023 -Node: Internal File Ops1047103 -Ref: Internal File Ops-Footnote-11058503 -Node: Using Internal File Ops1058643 -Ref: Using Internal File Ops-Footnote-11061026 -Node: Extension Samples1061300 -Node: Extension Sample File Functions1062829 -Node: Extension Sample Fnmatch1070478 -Node: Extension Sample Fork1071965 -Node: Extension Sample Inplace1073183 -Node: Extension Sample Ord1076393 -Node: Extension Sample Readdir1077229 -Ref: table-readdir-file-types1078118 -Node: Extension Sample Revout1078923 -Node: Extension Sample Rev2way1079512 -Node: Extension Sample Read write array1080252 -Node: Extension Sample Readfile1082194 -Node: Extension Sample Time1083289 -Node: Extension Sample API Tests1084637 -Node: gawkextlib1085129 -Node: Extension summary1087576 -Node: Extension Exercises1091278 -Node: Language History1092776 -Node: V7/SVR3.11094432 -Node: SVR41096584 -Node: POSIX1098018 -Node: BTL1099397 -Node: POSIX/GNU1100126 -Node: Feature History1106018 -Node: Common Extensions1120388 -Node: Ranges and Locales1121671 -Ref: Ranges and Locales-Footnote-11126287 -Ref: Ranges and Locales-Footnote-21126314 -Ref: Ranges and Locales-Footnote-31126549 -Node: Contributors1126770 -Node: History summary1132330 -Node: Installation1133710 -Node: Gawk Distribution1134654 -Node: Getting1135138 -Node: Extracting1136099 -Node: Distribution contents1137737 -Node: Unix Installation1144079 -Node: Quick Installation1144761 -Node: Shell Startup Files1147175 -Node: Additional Configuration Options1148264 -Node: Configuration Philosophy1150069 -Node: Non-Unix Installation1152438 -Node: PC Installation1152898 -Node: PC Binary Installation1153736 -Node: PC Compiling1154171 -Node: PC Using1155288 -Node: Cygwin1158333 -Node: MSYS1159103 -Node: VMS Installation1159604 -Node: VMS Compilation1160395 -Ref: VMS Compilation-Footnote-11161624 -Node: VMS Dynamic Extensions1161682 -Node: VMS Installation Details1163367 -Node: VMS Running1165620 -Node: VMS GNV1169899 -Node: VMS Old Gawk1170634 -Node: Bugs1171105 -Node: Bug address1171768 -Node: Usenet1174165 -Node: Maintainers1174942 -Node: Other Versions1176318 -Node: Installation summary1182902 -Node: Notes1183937 -Node: Compatibility Mode1184802 -Node: Additions1185584 -Node: Accessing The Source1186509 -Node: Adding Code1187944 -Node: New Ports1194162 -Node: Derived Files1198650 -Ref: Derived Files-Footnote-11204135 -Ref: Derived Files-Footnote-21204170 -Ref: Derived Files-Footnote-31204768 -Node: Future Extensions1204882 -Node: Implementation Limitations1205540 -Node: Extension Design1206723 -Node: Old Extension Problems1207877 -Ref: Old Extension Problems-Footnote-11209395 -Node: Extension New Mechanism Goals1209452 -Ref: Extension New Mechanism Goals-Footnote-11212816 -Node: Extension Other Design Decisions1213005 -Node: Extension Future Growth1215118 -Node: Old Extension Mechanism1215954 -Node: Notes summary1217717 -Node: Basic Concepts1218899 -Node: Basic High Level1219580 -Ref: figure-general-flow1219862 -Ref: figure-process-flow1220547 -Ref: Basic High Level-Footnote-11223848 -Node: Basic Data Typing1224033 -Node: Glossary1227361 -Node: Copying1259308 -Node: GNU Free Documentation License1296847 -Node: Index1321965 +Node: Sample Data Files94641 +Node: Very Simple97236 +Node: Two Rules102138 +Node: More Complex104023 +Node: Statements/Lines106889 +Ref: Statements/Lines-Footnote-1111348 +Node: Other Features111613 +Node: When112549 +Ref: When-Footnote-1114303 +Node: Intro Summary114368 +Node: Invoking Gawk115252 +Node: Command Line116766 +Node: Options117564 +Ref: Options-Footnote-1133663 +Ref: Options-Footnote-2133893 +Node: Other Arguments133918 +Node: Naming Standard Input136865 +Node: Environment Variables137958 +Node: AWKPATH Variable138516 +Ref: AWKPATH Variable-Footnote-1141927 +Ref: AWKPATH Variable-Footnote-2141961 +Node: AWKLIBPATH Variable142222 +Node: Other Environment Variables143479 +Node: Exit Status147300 +Node: Include Files147977 +Node: Loading Shared Libraries151572 +Node: Obsolete153000 +Node: Undocumented153692 +Node: Invoking Summary153989 +Node: Regexp155649 +Node: Regexp Usage157103 +Node: Escape Sequences159140 +Node: Regexp Operators165372 +Ref: Regexp Operators-Footnote-1172788 +Ref: Regexp Operators-Footnote-2172935 +Node: Bracket Expressions173033 +Ref: table-char-classes175509 +Node: Leftmost Longest178646 +Node: Computed Regexps179949 +Node: GNU Regexp Operators183376 +Node: Case-sensitivity187055 +Ref: Case-sensitivity-Footnote-1189942 +Ref: Case-sensitivity-Footnote-2190177 +Node: Regexp Summary190285 +Node: Reading Files191751 +Node: Records193914 +Node: awk split records194647 +Node: gawk split records199578 +Ref: gawk split records-Footnote-1204118 +Node: Fields204155 +Node: Nonconstant Fields206896 +Ref: Nonconstant Fields-Footnote-1209132 +Node: Changing Fields209336 +Node: Field Separators215264 +Node: Default Field Splitting217962 +Node: Regexp Field Splitting219080 +Node: Single Character Fields222433 +Node: Command Line Field Separator223493 +Node: Full Line Fields226711 +Ref: Full Line Fields-Footnote-1228233 +Ref: Full Line Fields-Footnote-2228279 +Node: Field Splitting Summary228380 +Node: Constant Size230454 +Node: Splitting By Content235032 +Ref: Splitting By Content-Footnote-1239003 +Node: Multiple Line239166 +Ref: Multiple Line-Footnote-1245048 +Node: Getline245227 +Node: Plain Getline247694 +Node: Getline/Variable250333 +Node: Getline/File251482 +Node: Getline/Variable/File252868 +Ref: Getline/Variable/File-Footnote-1254471 +Node: Getline/Pipe254559 +Node: Getline/Variable/Pipe257264 +Node: Getline/Coprocess258397 +Node: Getline/Variable/Coprocess259662 +Node: Getline Notes260402 +Node: Getline Summary263197 +Ref: table-getline-variants263619 +Node: Read Timeout264367 +Ref: Read Timeout-Footnote-1268273 +Node: Retrying Input268331 +Node: Command-line directories269530 +Node: Input Summary270436 +Node: Input Exercises273608 +Node: Printing274336 +Node: Print276170 +Node: Print Examples277627 +Node: Output Separators280407 +Node: OFMT282424 +Node: Printf283780 +Node: Basic Printf284565 +Node: Control Letters286139 +Node: Format Modifiers290127 +Node: Printf Examples296142 +Node: Redirection298628 +Node: Special FD305469 +Ref: Special FD-Footnote-1308637 +Node: Special Files308711 +Node: Other Inherited Files309328 +Node: Special Network310329 +Node: Special Caveats311189 +Node: Close Files And Pipes312138 +Ref: table-close-pipe-return-values319045 +Ref: Close Files And Pipes-Footnote-1319828 +Ref: Close Files And Pipes-Footnote-2319976 +Node: Nonfatal320128 +Node: Output Summary322453 +Node: Output Exercises323675 +Node: Expressions324354 +Node: Values325542 +Node: Constants326220 +Node: Scalar Constants326911 +Ref: Scalar Constants-Footnote-1327775 +Node: Nondecimal-numbers328025 +Node: Regexp Constants331026 +Node: Using Constant Regexps331552 +Node: Standard Regexp Constants332174 +Node: Strong Regexp Constants335362 +Node: Variables338320 +Node: Using Variables338977 +Node: Assignment Options340887 +Node: Conversion342760 +Node: Strings And Numbers343284 +Ref: Strings And Numbers-Footnote-1346347 +Node: Locale influences conversions346456 +Ref: table-locale-affects349214 +Node: All Operators349832 +Node: Arithmetic Ops350461 +Node: Concatenation352967 +Ref: Concatenation-Footnote-1355814 +Node: Assignment Ops355921 +Ref: table-assign-ops360912 +Node: Increment Ops362225 +Node: Truth Values and Conditions365685 +Node: Truth Values366759 +Node: Typing and Comparison367807 +Node: Variable Typing368627 +Ref: Variable Typing-Footnote-1375090 +Ref: Variable Typing-Footnote-2375162 +Node: Comparison Operators375239 +Ref: table-relational-ops375658 +Node: POSIX String Comparison379153 +Ref: POSIX String Comparison-Footnote-1380848 +Ref: POSIX String Comparison-Footnote-2380987 +Node: Boolean Ops381071 +Ref: Boolean Ops-Footnote-1385553 +Node: Conditional Exp385645 +Node: Function Calls387381 +Node: Precedence391258 +Node: Locales394917 +Node: Expressions Summary396549 +Node: Patterns and Actions399122 +Node: Pattern Overview400242 +Node: Regexp Patterns401919 +Node: Expression Patterns402461 +Node: Ranges406242 +Node: BEGIN/END409350 +Node: Using BEGIN/END410111 +Ref: Using BEGIN/END-Footnote-1412847 +Node: I/O And BEGIN/END412953 +Node: BEGINFILE/ENDFILE415267 +Node: Empty418174 +Node: Using Shell Variables418491 +Node: Action Overview420765 +Node: Statements423090 +Node: If Statement424938 +Node: While Statement426433 +Node: Do Statement428461 +Node: For Statement429609 +Node: Switch Statement432767 +Node: Break Statement435153 +Node: Continue Statement437245 +Node: Next Statement439072 +Node: Nextfile Statement441455 +Node: Exit Statement444107 +Node: Built-in Variables446510 +Node: User-modified447643 +Node: Auto-set455229 +Ref: Auto-set-Footnote-1469882 +Ref: Auto-set-Footnote-2470088 +Node: ARGC and ARGV470144 +Node: Pattern Action Summary474357 +Node: Arrays476787 +Node: Array Basics478116 +Node: Array Intro478960 +Ref: figure-array-elements480935 +Ref: Array Intro-Footnote-1483639 +Node: Reference to Elements483767 +Node: Assigning Elements486231 +Node: Array Example486722 +Node: Scanning an Array488481 +Node: Controlling Scanning491503 +Ref: Controlling Scanning-Footnote-1496902 +Node: Numeric Array Subscripts497218 +Node: Uninitialized Subscripts499402 +Node: Delete501021 +Ref: Delete-Footnote-1503773 +Node: Multidimensional503830 +Node: Multiscanning506925 +Node: Arrays of Arrays508516 +Node: Arrays Summary513283 +Node: Functions515376 +Node: Built-in516414 +Node: Calling Built-in517495 +Node: Numeric Functions519491 +Ref: Numeric Functions-Footnote-1524324 +Ref: Numeric Functions-Footnote-2524681 +Ref: Numeric Functions-Footnote-3524729 +Node: String Functions525001 +Ref: String Functions-Footnote-1548505 +Ref: String Functions-Footnote-2548633 +Ref: String Functions-Footnote-3548881 +Node: Gory Details548968 +Ref: table-sub-escapes550759 +Ref: table-sub-proposed552278 +Ref: table-posix-sub553641 +Ref: table-gensub-escapes555182 +Ref: Gory Details-Footnote-1556005 +Node: I/O Functions556159 +Ref: table-system-return-values562741 +Ref: I/O Functions-Footnote-1564721 +Ref: I/O Functions-Footnote-2564869 +Node: Time Functions564989 +Ref: Time Functions-Footnote-1575656 +Ref: Time Functions-Footnote-2575724 +Ref: Time Functions-Footnote-3575882 +Ref: Time Functions-Footnote-4575993 +Ref: Time Functions-Footnote-5576105 +Ref: Time Functions-Footnote-6576332 +Node: Bitwise Functions576598 +Ref: table-bitwise-ops577192 +Ref: Bitwise Functions-Footnote-1583225 +Ref: Bitwise Functions-Footnote-2583398 +Node: Type Functions583589 +Node: I18N Functions586264 +Node: User-defined587915 +Node: Definition Syntax588720 +Ref: Definition Syntax-Footnote-1594407 +Node: Function Example594478 +Ref: Function Example-Footnote-1597400 +Node: Function Caveats597422 +Node: Calling A Function597940 +Node: Variable Scope598898 +Node: Pass By Value/Reference601892 +Node: Return Statement605391 +Node: Dynamic Typing608370 +Node: Indirect Calls609300 +Ref: Indirect Calls-Footnote-1619551 +Node: Functions Summary619679 +Node: Library Functions622384 +Ref: Library Functions-Footnote-1625991 +Ref: Library Functions-Footnote-2626134 +Node: Library Names626305 +Ref: Library Names-Footnote-1629765 +Ref: Library Names-Footnote-2629988 +Node: General Functions630074 +Node: Strtonum Function631177 +Node: Assert Function634199 +Node: Round Function637525 +Node: Cliff Random Function639066 +Node: Ordinal Functions640082 +Ref: Ordinal Functions-Footnote-1643145 +Ref: Ordinal Functions-Footnote-2643397 +Node: Join Function643607 +Ref: Join Function-Footnote-1645377 +Node: Getlocaltime Function645577 +Node: Readfile Function649319 +Node: Shell Quoting651291 +Node: Data File Management652692 +Node: Filetrans Function653324 +Node: Rewind Function657420 +Node: File Checking659326 +Ref: File Checking-Footnote-1660660 +Node: Empty Files660861 +Node: Ignoring Assigns662840 +Node: Getopt Function664390 +Ref: Getopt Function-Footnote-1675859 +Node: Passwd Functions676059 +Ref: Passwd Functions-Footnote-1684898 +Node: Group Functions684986 +Ref: Group Functions-Footnote-1692884 +Node: Walking Arrays693091 +Node: Library Functions Summary696099 +Node: Library Exercises697505 +Node: Sample Programs697970 +Node: Running Examples698740 +Node: Clones699468 +Node: Cut Program700692 +Node: Egrep Program710621 +Ref: Egrep Program-Footnote-1718133 +Node: Id Program718243 +Node: Split Program721923 +Ref: Split Program-Footnote-1725382 +Node: Tee Program725511 +Node: Uniq Program728301 +Node: Wc Program735727 +Ref: Wc Program-Footnote-1739982 +Node: Miscellaneous Programs740076 +Node: Dupword Program741289 +Node: Alarm Program743319 +Node: Translate Program748174 +Ref: Translate Program-Footnote-1752739 +Node: Labels Program753009 +Ref: Labels Program-Footnote-1756360 +Node: Word Sorting756444 +Node: History Sorting760516 +Node: Extract Program762351 +Node: Simple Sed769880 +Node: Igawk Program772954 +Ref: Igawk Program-Footnote-1787285 +Ref: Igawk Program-Footnote-2787487 +Ref: Igawk Program-Footnote-3787609 +Node: Anagram Program787724 +Node: Signature Program790786 +Node: Programs Summary792033 +Node: Programs Exercises793247 +Ref: Programs Exercises-Footnote-1797376 +Node: Advanced Features797467 +Node: Nondecimal Data799457 +Node: Array Sorting801048 +Node: Controlling Array Traversal801748 +Ref: Controlling Array Traversal-Footnote-1810115 +Node: Array Sorting Functions810233 +Ref: Array Sorting Functions-Footnote-1815324 +Node: Two-way I/O815520 +Ref: Two-way I/O-Footnote-1822071 +Ref: Two-way I/O-Footnote-2822258 +Node: TCP/IP Networking822340 +Node: Profiling825458 +Ref: Profiling-Footnote-1834130 +Node: Advanced Features Summary834453 +Node: Internationalization836297 +Node: I18N and L10N837777 +Node: Explaining gettext838464 +Ref: Explaining gettext-Footnote-1844356 +Ref: Explaining gettext-Footnote-2844541 +Node: Programmer i18n844706 +Ref: Programmer i18n-Footnote-1849655 +Node: Translator i18n849704 +Node: String Extraction850498 +Ref: String Extraction-Footnote-1851630 +Node: Printf Ordering851716 +Ref: Printf Ordering-Footnote-1854502 +Node: I18N Portability854566 +Ref: I18N Portability-Footnote-1857022 +Node: I18N Example857085 +Ref: I18N Example-Footnote-1859891 +Node: Gawk I18N859964 +Node: I18N Summary860609 +Node: Debugger861950 +Node: Debugging862972 +Node: Debugging Concepts863413 +Node: Debugging Terms865222 +Node: Awk Debugging867797 +Node: Sample Debugging Session868703 +Node: Debugger Invocation869237 +Node: Finding The Bug870623 +Node: List of Debugger Commands877101 +Node: Breakpoint Control878434 +Node: Debugger Execution Control882128 +Node: Viewing And Changing Data885490 +Node: Execution Stack888864 +Node: Debugger Info890501 +Node: Miscellaneous Debugger Commands894572 +Node: Readline Support899660 +Node: Limitations900556 +Node: Debugging Summary902665 +Node: Arbitrary Precision Arithmetic903944 +Node: Computer Arithmetic905360 +Ref: table-numeric-ranges908951 +Ref: Computer Arithmetic-Footnote-1909673 +Node: Math Definitions909730 +Ref: table-ieee-formats913044 +Ref: Math Definitions-Footnote-1913647 +Node: MPFR features913752 +Node: FP Math Caution915469 +Ref: FP Math Caution-Footnote-1916541 +Node: Inexactness of computations916910 +Node: Inexact representation917870 +Node: Comparing FP Values919230 +Node: Errors accumulate920312 +Node: Getting Accuracy921745 +Node: Try To Round924455 +Node: Setting precision925354 +Ref: table-predefined-precision-strings926051 +Node: Setting the rounding mode927881 +Ref: table-gawk-rounding-modes928255 +Ref: Setting the rounding mode-Footnote-1931663 +Node: Arbitrary Precision Integers931842 +Ref: Arbitrary Precision Integers-Footnote-1936759 +Node: POSIX Floating Point Problems936908 +Ref: POSIX Floating Point Problems-Footnote-1940790 +Node: Floating point summary940828 +Node: Dynamic Extensions943018 +Node: Extension Intro944571 +Node: Plugin License945837 +Node: Extension Mechanism Outline946634 +Ref: figure-load-extension947073 +Ref: figure-register-new-function948638 +Ref: figure-call-new-function949730 +Node: Extension API Description951792 +Node: Extension API Functions Introduction953434 +Node: General Data Types958768 +Ref: General Data Types-Footnote-1965973 +Node: Memory Allocation Functions966272 +Ref: Memory Allocation Functions-Footnote-1969117 +Node: Constructor Functions969216 +Node: Registration Functions972215 +Node: Extension Functions972900 +Node: Exit Callback Functions978113 +Node: Extension Version String979363 +Node: Input Parsers980026 +Node: Output Wrappers989908 +Node: Two-way processors994420 +Node: Printing Messages996685 +Ref: Printing Messages-Footnote-1997856 +Node: Updating ERRNO998009 +Node: Requesting Values998748 +Ref: table-value-types-returned999485 +Node: Accessing Parameters1000421 +Node: Symbol Table Access1001656 +Node: Symbol table by name1002168 +Node: Symbol table by cookie1003957 +Ref: Symbol table by cookie-Footnote-11008142 +Node: Cached values1008206 +Ref: Cached values-Footnote-11011742 +Node: Array Manipulation1011833 +Ref: Array Manipulation-Footnote-11012924 +Node: Array Data Types1012961 +Ref: Array Data Types-Footnote-11015619 +Node: Array Functions1015711 +Node: Flattening Arrays1020110 +Node: Creating Arrays1027051 +Node: Redirection API1031820 +Node: Extension API Variables1034662 +Node: Extension Versioning1035295 +Ref: gawk-api-version1035732 +Node: Extension API Informational Variables1037460 +Node: Extension API Boilerplate1038524 +Node: Changes from API V11042386 +Node: Finding Extensions1043046 +Node: Extension Example1043605 +Node: Internal File Description1044403 +Node: Internal File Ops1048483 +Ref: Internal File Ops-Footnote-11059883 +Node: Using Internal File Ops1060023 +Ref: Using Internal File Ops-Footnote-11062406 +Node: Extension Samples1062680 +Node: Extension Sample File Functions1064209 +Node: Extension Sample Fnmatch1071858 +Node: Extension Sample Fork1073345 +Node: Extension Sample Inplace1074563 +Node: Extension Sample Ord1077773 +Node: Extension Sample Readdir1078609 +Ref: table-readdir-file-types1079498 +Node: Extension Sample Revout1080303 +Node: Extension Sample Rev2way1080892 +Node: Extension Sample Read write array1081632 +Node: Extension Sample Readfile1083574 +Node: Extension Sample Time1084669 +Node: Extension Sample API Tests1086017 +Node: gawkextlib1086509 +Node: Extension summary1088956 +Node: Extension Exercises1092658 +Node: Language History1094156 +Node: V7/SVR3.11095812 +Node: SVR41097964 +Node: POSIX1099398 +Node: BTL1100777 +Node: POSIX/GNU1101506 +Node: Feature History1107398 +Node: Common Extensions1121768 +Node: Ranges and Locales1123051 +Ref: Ranges and Locales-Footnote-11127667 +Ref: Ranges and Locales-Footnote-21127694 +Ref: Ranges and Locales-Footnote-31127929 +Node: Contributors1128150 +Node: History summary1133710 +Node: Installation1135090 +Node: Gawk Distribution1136034 +Node: Getting1136518 +Node: Extracting1137479 +Node: Distribution contents1139117 +Node: Unix Installation1145459 +Node: Quick Installation1146141 +Node: Shell Startup Files1148555 +Node: Additional Configuration Options1149644 +Node: Configuration Philosophy1151449 +Node: Non-Unix Installation1153818 +Node: PC Installation1154278 +Node: PC Binary Installation1155116 +Node: PC Compiling1155551 +Node: PC Using1156668 +Node: Cygwin1159713 +Node: MSYS1160483 +Node: VMS Installation1160984 +Node: VMS Compilation1161775 +Ref: VMS Compilation-Footnote-11163004 +Node: VMS Dynamic Extensions1163062 +Node: VMS Installation Details1164747 +Node: VMS Running1167000 +Node: VMS GNV1171279 +Node: VMS Old Gawk1172014 +Node: Bugs1172485 +Node: Bug address1173148 +Node: Usenet1175545 +Node: Maintainers1176322 +Node: Other Versions1177698 +Node: Installation summary1184282 +Node: Notes1185317 +Node: Compatibility Mode1186182 +Node: Additions1186964 +Node: Accessing The Source1187889 +Node: Adding Code1189324 +Node: New Ports1195542 +Node: Derived Files1200030 +Ref: Derived Files-Footnote-11205515 +Ref: Derived Files-Footnote-21205550 +Ref: Derived Files-Footnote-31206148 +Node: Future Extensions1206262 +Node: Implementation Limitations1206920 +Node: Extension Design1208103 +Node: Old Extension Problems1209257 +Ref: Old Extension Problems-Footnote-11210775 +Node: Extension New Mechanism Goals1210832 +Ref: Extension New Mechanism Goals-Footnote-11214196 +Node: Extension Other Design Decisions1214385 +Node: Extension Future Growth1216498 +Node: Old Extension Mechanism1217334 +Node: Notes summary1219097 +Node: Basic Concepts1220279 +Node: Basic High Level1220960 +Ref: figure-general-flow1221242 +Ref: figure-process-flow1221927 +Ref: Basic High Level-Footnote-11225228 +Node: Basic Data Typing1225413 +Node: Glossary1228741 +Node: Copying1260688 +Node: GNU Free Documentation License1298227 +Node: Index1323345 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index 22234241..658ac17e 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -49,6 +49,14 @@ @set MINUS @end ifdocbook +@iftex +@set TIMES @times +@end iftex +@ifnottex +@set TIMES * +@end ifnottex + + @set xref-automatic-section-title @c The following information should be updated here only! @@ -3032,14 +3040,59 @@ it is worth addressing. @cindex Brink, Jeroen The ``shells'' on Microsoft Windows systems use the double-quote character for quoting, and make it difficult or impossible to include an -escaped double-quote character in a command-line script. -The following example, courtesy of Jeroen Brink, shows -how to print all lines in a file surrounded by double quotes: +escaped double-quote character in a command-line script. The following +example, courtesy of Jeroen Brink, shows how to escape the double quotes +from this one liner script that prints all lines in a file surrounded by +double quotes: + +@example +@{ print "\"" $0 "\"" @} +@end example + +@noindent +In an MS-Windows command-line the one-liner script above may be passed as +follows: @example gawk "@{ print \"\042\" $0 \"\042\" @}" @var{file} @end example +In this example the @samp{\042} is the octal code for a double-quote; +@command{gawk} converts it into a real double-quote for output by +the @code{print} statement. + +In MS-Windows escaping double-quotes is a little tricky because you use +backslashes to escape double-quotes, but backslashes themselves are not +escaped in the usual way; indeed they are either duplicated or not, +depending upon whether there is a subsequent double-quote. The MS-Windows +rule for double-quoting a string is the following: + +@enumerate +@item +For each double quote in the orginal string, let @var{N} be the number +of backslash(es) before it, @var{N} might be zero. Replace these @var{N} +backslash(es) by @math{2@value{TIMES}@var{N}+1} backslash(es) + +@item +Let @var{N} be the number of backslash(es) tailing the original string, +@var{N} might be zero. Replace these @var{N} backslash(es) by +@math{2@value{TIMES}@var{N}} backslash(es) + +@item +Surround the resulting string by double-quotes. +@end enumerate + +So to double-quote the one-liner script @samp{@{ print "\"" $0 "\"" @}} +from the previous example you would do it this way: + +@example +gawk "@{ print \"\\\"\" $0 \"\\\"\" @}" @var{file} +@end example + +@noindent +However, the use of @samp{\042} instead of @samp{\\\"} is also possible +and easier to read, because backslashes that are not followed by a +double-quote don't need duplication. @node Sample Data Files @section @value{DDF}s for the Examples diff --git a/doc/gawktexi.in b/doc/gawktexi.in index d2b24312..d8e9654f 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -44,6 +44,14 @@ @set MINUS @end ifdocbook +@iftex +@set TIMES @times +@end iftex +@ifnottex +@set TIMES * +@end ifnottex + + @set xref-automatic-section-title @c The following information should be updated here only! @@ -2943,14 +2951,59 @@ it is worth addressing. @cindex Brink, Jeroen The ``shells'' on Microsoft Windows systems use the double-quote character for quoting, and make it difficult or impossible to include an -escaped double-quote character in a command-line script. -The following example, courtesy of Jeroen Brink, shows -how to print all lines in a file surrounded by double quotes: +escaped double-quote character in a command-line script. The following +example, courtesy of Jeroen Brink, shows how to escape the double quotes +from this one liner script that prints all lines in a file surrounded by +double quotes: + +@example +@{ print "\"" $0 "\"" @} +@end example + +@noindent +In an MS-Windows command-line the one-liner script above may be passed as +follows: @example gawk "@{ print \"\042\" $0 \"\042\" @}" @var{file} @end example +In this example the @samp{\042} is the octal code for a double-quote; +@command{gawk} converts it into a real double-quote for output by +the @code{print} statement. + +In MS-Windows escaping double-quotes is a little tricky because you use +backslashes to escape double-quotes, but backslashes themselves are not +escaped in the usual way; indeed they are either duplicated or not, +depending upon whether there is a subsequent double-quote. The MS-Windows +rule for double-quoting a string is the following: + +@enumerate +@item +For each double quote in the orginal string, let @var{N} be the number +of backslash(es) before it, @var{N} might be zero. Replace these @var{N} +backslash(es) by @math{2@value{TIMES}@var{N}+1} backslash(es) + +@item +Let @var{N} be the number of backslash(es) tailing the original string, +@var{N} might be zero. Replace these @var{N} backslash(es) by +@math{2@value{TIMES}@var{N}} backslash(es) + +@item +Surround the resulting string by double-quotes. +@end enumerate + +So to double-quote the one-liner script @samp{@{ print "\"" $0 "\"" @}} +from the previous example you would do it this way: + +@example +gawk "@{ print \"\\\"\" $0 \"\\\"\" @}" @var{file} +@end example + +@noindent +However, the use of @samp{\042} instead of @samp{\\\"} is also possible +and easier to read, because backslashes that are not followed by a +double-quote don't need duplication. @node Sample Data Files @section @value{DDF}s for the Examples diff --git a/extension/build-aux/ChangeLog b/extension/build-aux/ChangeLog index 35e5cfd8..af726346 100644 --- a/extension/build-aux/ChangeLog +++ b/extension/build-aux/ChangeLog @@ -1,3 +1,8 @@ +2017-03-20 Arnold D. Robbins <arnold@skeeve.com> + + * config.guess, config.rpath, config.sub, install-sh: + Sync with GNULIB. + 2017-01-04 Arnold Robbins <arnold@skeeve.com> * config.guess, config.sub, compile, depcomp: Sync from latest diff --git a/extension/build-aux/config.guess b/extension/build-aux/config.guess index bbd48b60..69ed3e57 100755 --- a/extension/build-aux/config.guess +++ b/extension/build-aux/config.guess @@ -2,7 +2,7 @@ # Attempt to guess a canonical system name. # Copyright 1992-2017 Free Software Foundation, Inc. -timestamp='2017-01-01' +timestamp='2017-03-05' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -837,10 +837,11 @@ EOF UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + UNAME_PROCESSOR=x86_64 ;; + i386) + UNAME_PROCESSOR=i586 ;; esac + echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin @@ -1343,6 +1344,9 @@ EOF NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; + NSX-?:NONSTOP_KERNEL:*:*) + echo nsx-tandem-nsk${UNAME_RELEASE} + exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; diff --git a/extension/build-aux/config.rpath b/extension/build-aux/config.rpath index 98183ff2..af3c4155 100755 --- a/extension/build-aux/config.rpath +++ b/extension/build-aux/config.rpath @@ -2,7 +2,7 @@ # Output a system dependent set of variables, describing how to set the # run time search path of shared libraries in an executable. # -# Copyright 1996-2016 Free Software Foundation, Inc. +# Copyright 1996-2017 Free Software Foundation, Inc. # Taken from GNU libtool, 2001 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 # diff --git a/extension/build-aux/config.sub b/extension/build-aux/config.sub index 7e792b4a..87abeab6 100755 --- a/extension/build-aux/config.sub +++ b/extension/build-aux/config.sub @@ -2,7 +2,7 @@ # Configuration validation subroutine script. # Copyright 1992-2017 Free Software Foundation, Inc. -timestamp='2017-01-01' +timestamp='2017-02-07' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -948,6 +948,9 @@ case $basic_machine in nsr-tandem) basic_machine=nsr-tandem ;; + nsx-tandem) + basic_machine=nsx-tandem + ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf diff --git a/extension/build-aux/install-sh b/extension/build-aux/install-sh index 0b0fdcbb..0360b79e 100755 --- a/extension/build-aux/install-sh +++ b/extension/build-aux/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2013-12-25.23; # UTC +scriptversion=2016-01-11.22; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -496,6 +496,6 @@ done # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2013-12-25.23; # UTC +scriptversion=2016-01-11.22; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -496,6 +496,6 @@ done # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: @@ -900,9 +900,7 @@ redirect_string(const char *str, size_t explen, bool not_string, (void) flush_io(); os_restore_mode(fileno(stdin)); -#ifdef SIGPIPE - signal(SIGPIPE, SIG_DFL); -#endif + set_sigpipe_to_default(); /* * Don't check failure_fatal; see input pipe below. * Note that the failure happens upon failure to fork, @@ -912,9 +910,7 @@ redirect_string(const char *str, size_t explen, bool not_string, if ((rp->output.fp = popen(str, binmode("w"))) == NULL) fatal(_("can't open pipe `%s' for output (%s)"), str, strerror(errno)); -#ifdef SIGPIPE - signal(SIGPIPE, SIG_IGN); -#endif + ignore_sigpipe(); /* set close-on-exec */ os_close_on_exec(fileno(rp->output.fp), str, "pipe", "to"); @@ -1393,6 +1389,36 @@ checkwarn: return status; } +/* non_fatal_flush_std_file --- flush a standard output file allowing for nonfatal setting */ + +bool +non_fatal_flush_std_file(FILE *fp) +{ + int status = fflush(fp); + + if (status != 0) { + bool is_fatal = ! is_non_fatal_std(fp); + + if (is_fatal) { + if (errno == EPIPE) + exit(EXIT_SUCCESS); // simulate SIGPIPE + else + fatal(fp == stdout + ? _("fflush: cannot flush standard output: %s") + : _("fflush: cannot flush standard error: %s"), + strerror(errno)); + } else { + warning(fp == stdout + ? _("error writing standard output (%s)") + : _("error writing standard error (%s)"), + strerror(errno)); + } + return false; + } + + return true; +} + /* flush_io --- flush all open output files */ int @@ -1402,21 +1428,18 @@ flush_io() int status = 0; errno = 0; - /* we don't warn about stdout/stderr if EPIPE, but we do error exit */ - if (fflush(stdout)) { - if (errno != EPIPE) - warning(_("error writing standard output (%s)"), strerror(errno)); + if (! non_fatal_flush_std_file(stdout)) status++; - } - if (fflush(stderr)) { - if (errno != EPIPE) - warning(_("error writing standard error (%s)"), strerror(errno)); + + errno = 0; + if (! non_fatal_flush_std_file(stderr)) status++; - } + + // now for all open redirections for (rp = red_head; rp != NULL; rp = rp->next) { /* flush both files and pipes, what the heck */ if ((rp->flag & RED_WRITE) != 0 && rp->output.fp != NULL) { - if (rp->output.gawk_fflush(rp->output.fp, rp->output.opaque)) { + if (rp->output.gawk_fflush(rp->output.fp, rp->output.opaque) != 0) { if ((rp->flag & RED_PIPE) != 0) warning(_("pipe flush of `%s' failed (%s)."), rp->value, strerror(errno)); @@ -2077,7 +2100,7 @@ two_way_open(const char *str, struct redirect *rp, int extfd) /* stderr does NOT get dup'ed onto child's stdout */ - signal(SIGPIPE, SIG_DFL); + set_sigpipe_to_default(); execl("/bin/sh", "sh", "-c", str, NULL); _exit(errno == ENOENT ? 127 : 126); @@ -2254,7 +2277,7 @@ use_pipes: || close(ctop[0]) == -1 || close(ctop[1]) == -1) fatal(_("close of pipe failed (%s)"), strerror(errno)); /* stderr does NOT get dup'ed onto child's stdout */ - signal(SIGPIPE, SIG_DFL); + set_sigpipe_to_default(); execl("/bin/sh", "sh", "-c", str, NULL); _exit(errno == ENOENT ? 127 : 126); } @@ -2491,7 +2514,7 @@ gawk_popen(const char *cmd, struct redirect *rp) fatal(_("moving pipe to stdout in child failed (dup: %s)"), strerror(errno)); if (close(p[0]) == -1 || close(p[1]) == -1) fatal(_("close of pipe failed (%s)"), strerror(errno)); - signal(SIGPIPE, SIG_DFL); + set_sigpipe_to_default(); execl("/bin/sh", "sh", "-c", cmd, NULL); _exit(errno == ENOENT ? 127 : 126); } @@ -2556,17 +2579,13 @@ gawk_popen(const char *cmd, struct redirect *rp) FILE *current; os_restore_mode(fileno(stdin)); -#ifdef SIGPIPE - signal(SIGPIPE, SIG_DFL); -#endif + set_sigpipe_to_default(); current = popen(cmd, binmode("r")); if ((BINMODE & BINMODE_INPUT) != 0) os_setbinmode(fileno(stdin), O_BINARY); -#ifdef SIGPIPE - signal(SIGPIPE, SIG_IGN); -#endif + ignore_sigpipe(); if (current == NULL) return NULL; @@ -255,7 +255,7 @@ main(int argc, char **argv) #ifdef SIGBUS (void) signal(SIGBUS, catchsig); #endif -#ifdef SIGPIPE + /* * Ignore SIGPIPE so that writes to pipes that fail don't * kill the process but instead return -1 and set errno. @@ -269,8 +269,7 @@ main(int argc, char **argv) * should not give us "broken pipe" messages --- mainly because * it did not do so in the past and people would complain. */ - signal(SIGPIPE, SIG_IGN); -#endif + ignore_sigpipe(); (void) sigsegv_install_handler(catchsegv); #define STACK_SIZE (16*1024) diff --git a/test/ChangeLog b/test/ChangeLog index acd2bf72..ad1b35b1 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,10 @@ +2017-03-19 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * Makefile.am (argarray): Always copy argarray.in to the local + directory as argarray.input instead of trying to figure out whether + $(srcdir) is the current directory. + * argarray.ok: Replace argarray.in with argarray.input. + 2017-03-06 Andrew J. Schorr <aschorr@telemetry-investments.com> * Makefile.am (readdir_test): New test to check whether get_record diff --git a/test/Makefile.am b/test/Makefile.am index c41e9dd9..855958f1 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1461,15 +1461,9 @@ messages:: argarray:: @echo $@ - @case "$(srcdir)" in \ - .) : ;; \ - *) cp "$(srcdir)"/argarray.in . ;; \ - esac - @TEST=test echo just a test | $(AWK) -f "$(srcdir)"/argarray.awk ./argarray.in - >_$@ - @case "$(srcdir)" in \ - .) : ;; \ - *) rm -f ./argarray.in ;; \ - esac + @cp "$(srcdir)"/argarray.in ./argarray.input + @TEST=test echo just a test | $(AWK) -f "$(srcdir)"/argarray.awk ./argarray.input - >_$@ + @rm -f ./argarray.input @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ regtest:: diff --git a/test/Makefile.in b/test/Makefile.in index c07bc6d7..c23156df 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -1901,15 +1901,9 @@ messages:: argarray:: @echo $@ - @case "$(srcdir)" in \ - .) : ;; \ - *) cp "$(srcdir)"/argarray.in . ;; \ - esac - @TEST=test echo just a test | $(AWK) -f "$(srcdir)"/argarray.awk ./argarray.in - >_$@ - @case "$(srcdir)" in \ - .) : ;; \ - *) rm -f ./argarray.in ;; \ - esac + @cp "$(srcdir)"/argarray.in ./argarray.input + @TEST=test echo just a test | $(AWK) -f "$(srcdir)"/argarray.awk ./argarray.input - >_$@ + @rm -f ./argarray.input @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ regtest:: diff --git a/test/argarray.ok b/test/argarray.ok index 18eb841c..3c026634 100644 --- a/test/argarray.ok +++ b/test/argarray.ok @@ -1,9 +1,9 @@ here we have 3 arguments which are gawk - ./argarray.in + ./argarray.input - Environment variable TEST= and the current input file is called "" -in main loop, this input file is known as "./argarray.in" +in main loop, this input file is known as "./argarray.input" in main loop, this input file is known as "-" |