From 5e739d0e99d4833092dff655bc4e9d9e05046e74 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Thu, 18 Apr 2019 19:58:51 +0300 Subject: Add an easter egg in msg.c. --- ChangeLog | 4 ++++ doc/ChangeLog | 4 ++++ doc/gawk.texi | 13 +++++++++++++ doc/gawktexi.in | 13 +++++++++++++ msg.c | 9 ++++++++- 5 files changed, 42 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8c92378b..47e5cdd3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2019-04-18 Arnold D. Robbins + + * msg.c (msg): Add an undocumented feature. "Use the Source, Luke." + 2019-04-12 Arnold D. Robbins * configure.ac: Update version to 5.0.0. diff --git a/doc/ChangeLog b/doc/ChangeLog index 6f4467d9..f3964012 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2019-04-18 Arnold D. Robbins + + * gawktexi.in (Undocumented): Note an undocumented feature. + 2019-04-14 Arnold D. Robbins * gawktexi.in (Case-sensitivity): Document that single-byte diff --git a/doc/gawk.texi b/doc/gawk.texi index e5371c61..02481a7c 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -5035,6 +5035,19 @@ returns a textual version of the flags for scalar variables, and the array back-end implementation type for arrays. This interface is subject to change and may not be stable. +When not in POSIX or compatibility mode, if you set @code{LINENO} to a +numeric value using the @option{-v} option, @command{gawk} adds that value +to the real line number for use in error messages. This is intended for +use within Bash shell scripts, such that the error message will reflect +the line number in the shell script, instead of in the @command{awk} +program. To demonstrate: + +@exmaple +$ @kbd{gawk -v LINENO=10 'BEGIN @{ print("hi" @}'} +@error{} gawk: cmd. line:11: BEGIN @{ print("hi" @} +@error{} gawk: cmd. line:11: ^ syntax error +@end example + @end ignore @node Invoking Summary diff --git a/doc/gawktexi.in b/doc/gawktexi.in index 14e20b7a..0408d61c 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -4945,6 +4945,19 @@ returns a textual version of the flags for scalar variables, and the array back-end implementation type for arrays. This interface is subject to change and may not be stable. +When not in POSIX or compatibility mode, if you set @code{LINENO} to a +numeric value using the @option{-v} option, @command{gawk} adds that value +to the real line number for use in error messages. This is intended for +use within Bash shell scripts, such that the error message will reflect +the line number in the shell script, instead of in the @command{awk} +program. To demonstrate: + +@exmaple +$ @kbd{gawk -v LINENO=10 'BEGIN @{ print("hi" @}'} +@error{} gawk: cmd. line:11: BEGIN @{ print("hi" @} +@error{} gawk: cmd. line:11: ^ syntax error +@end example + @end ignore @node Invoking Summary diff --git a/msg.c b/msg.c index 12cc2aac..ca988ad3 100644 --- a/msg.c +++ b/msg.c @@ -46,10 +46,17 @@ err(bool isfatal, const char *s, const char *emsg, va_list argp) static bool first = true; static bool add_src_info = false; + static long lineno_val = 0; // Easter Egg if (first) { first = false; add_src_info = (getenv("GAWK_MSG_SRC") != NULL); + if (! do_traditional) { + NODE *n = lookup("LINENO"); + + if (n != NULL && n->type == Node_var) + lineno_val = get_number_d(n->var_value); + } } (void) fflush(output_fp); @@ -67,7 +74,7 @@ err(bool isfatal, const char *s, const char *emsg, va_list argp) else (void) fprintf(stderr, _("cmd. line:")); - (void) fprintf(stderr, "%d: ", sourceline); + (void) fprintf(stderr, "%d: ", sourceline + lineno_val); } #ifdef HAVE_MPFR -- cgit v1.2.3 From eb2b214d7471660ea087ecee5bc684a23c02395d Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Thu, 18 Apr 2019 20:00:10 +0300 Subject: Fix permissions on top-level ChangeLog.1. --- ChangeLog.1 | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 ChangeLog.1 diff --git a/ChangeLog.1 b/ChangeLog.1 old mode 100755 new mode 100644 -- cgit v1.2.3 From e5851c224d9fd7dce31ba06ee58f07f8370bec48 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Thu, 18 Apr 2019 20:02:38 +0300 Subject: Ensure that ChangeLog.1 gets into the distribution. --- ChangeLog | 2 ++ Checklist | 4 +++- Makefile.am | 1 + Makefile.in | 1 + awklib/ChangeLog | 4 ++++ awklib/Makefile.am | 3 ++- awklib/Makefile.in | 4 +++- doc/ChangeLog | 1 + doc/Makefile.am | 3 ++- doc/Makefile.in | 3 ++- extension/ChangeLog | 4 ++++ extension/Makefile.am | 1 + extension/Makefile.in | 1 + test/ChangeLog | 4 ++++ test/Makefile.am | 1 + test/Makefile.in | 1 + 16 files changed, 33 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 47e5cdd3..582aa91b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 2019-04-18 Arnold D. Robbins * msg.c (msg): Add an undocumented feature. "Use the Source, Luke." + * Makefile.am (EXTRA_DIST): Add ChangeLog.1 to the list. Ooops. + * CheckList: Updated. 2019-04-12 Arnold D. Robbins diff --git a/Checklist b/Checklist index e5aa3932..579e6184 100644 --- a/Checklist +++ b/Checklist @@ -1,4 +1,4 @@ -Thu Feb 28 21:19:43 IST 2019 +Thu Apr 18 20:01:43 IDT 2019 ============================ A checklist for making releases @@ -59,6 +59,8 @@ run the following command just before rolling a new release: Major releases: - Rotate the ChangeLog and NEWS files. +- When doing so, update any necessary Makefile.am files to + list the rotated ChangeLog file! ========== For Releasing ============ diff --git a/Makefile.am b/Makefile.am index d544b1cc..3b55ff3b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -34,6 +34,7 @@ AM_MAKEFLAGS = 'CFLAGS=$(CFLAGS)' 'LDFLAGS=$(LDFLAGS)' # Makefile.am files EXTRA_DIST = \ ChangeLog.0 \ + ChangeLog.1 \ COPYING \ INSTALL \ NEWS \ diff --git a/Makefile.in b/Makefile.in index b8b0b441..61f37a2d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -467,6 +467,7 @@ AM_MAKEFLAGS = 'CFLAGS=$(CFLAGS)' 'LDFLAGS=$(LDFLAGS)' # Makefile.am files EXTRA_DIST = \ ChangeLog.0 \ + ChangeLog.1 \ COPYING \ INSTALL \ NEWS \ diff --git a/awklib/ChangeLog b/awklib/ChangeLog index 862c2b87..ef4f632c 100644 --- a/awklib/ChangeLog +++ b/awklib/ChangeLog @@ -1,3 +1,7 @@ +2019-04-18 Arnold D. Robbins + + * Makefile.am (EXTRA_DIST): Add ChangeLog.1 to the list. Ooops. + 2019-04-12 Arnold D. Robbins * ChangeLog.1: Rotated ChangeLog into this file. diff --git a/awklib/Makefile.am b/awklib/Makefile.am index adb607b3..20e9edba 100644 --- a/awklib/Makefile.am +++ b/awklib/Makefile.am @@ -23,7 +23,8 @@ ## process this file with automake to produce Makefile.in -EXTRA_DIST = ChangeLog ChangeLog.0 extract.awk eg $(srcdir)/stamp-eg +EXTRA_DIST = ChangeLog ChangeLog.0 ChangeLog.1 \ + extract.awk eg $(srcdir)/stamp-eg # With some locales, the script extract.awk fails. # So we fix the locale to some sensible value. diff --git a/awklib/Makefile.in b/awklib/Makefile.in index c198acc8..449a5bf7 100644 --- a/awklib/Makefile.in +++ b/awklib/Makefile.in @@ -327,7 +327,9 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -EXTRA_DIST = ChangeLog ChangeLog.0 extract.awk eg $(srcdir)/stamp-eg +EXTRA_DIST = ChangeLog ChangeLog.0 ChangeLog.1 \ + extract.awk eg $(srcdir)/stamp-eg + @TEST_CROSS_COMPILE_FALSE@AWKPROG = LC_ALL=C LANG=C "$(abs_top_builddir)/gawk$(EXEEXT)" # With some locales, the script extract.awk fails. # So we fix the locale to some sensible value. diff --git a/doc/ChangeLog b/doc/ChangeLog index f3964012..d51a9a17 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,6 +1,7 @@ 2019-04-18 Arnold D. Robbins * gawktexi.in (Undocumented): Note an undocumented feature. + * Makefile.am (EXTRA_DIST): Add ChangeLog.1 to the list. Ooops. 2019-04-14 Arnold D. Robbins diff --git a/doc/Makefile.am b/doc/Makefile.am index 1e5d86ac..24dd0405 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -28,7 +28,8 @@ info_TEXINFOS = gawk.texi gawkinet.texi gawkworkflow.texi man_MANS = gawk.1 -EXTRA_DIST = ChangeLog ChangeLog.0 README.card ad.block setter.outline \ +EXTRA_DIST = ChangeLog ChangeLog.0 ChangeLog.1 \ + README.card ad.block setter.outline \ awkcard.in awkforai.txt texinfo.tex cardfonts \ api-figure1.eps api-figure1.fig api-figure1.pdf \ api-figure1.png api-figure1.txt \ diff --git a/doc/Makefile.in b/doc/Makefile.in index 7fd6603d..9bce117d 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -357,7 +357,8 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ info_TEXINFOS = gawk.texi gawkinet.texi gawkworkflow.texi man_MANS = gawk.1 -EXTRA_DIST = ChangeLog ChangeLog.0 README.card ad.block setter.outline \ +EXTRA_DIST = ChangeLog ChangeLog.0 ChangeLog.1 \ + README.card ad.block setter.outline \ awkcard.in awkforai.txt texinfo.tex cardfonts \ api-figure1.eps api-figure1.fig api-figure1.pdf \ api-figure1.png api-figure1.txt \ diff --git a/extension/ChangeLog b/extension/ChangeLog index 862c2b87..ef4f632c 100644 --- a/extension/ChangeLog +++ b/extension/ChangeLog @@ -1,3 +1,7 @@ +2019-04-18 Arnold D. Robbins + + * Makefile.am (EXTRA_DIST): Add ChangeLog.1 to the list. Ooops. + 2019-04-12 Arnold D. Robbins * ChangeLog.1: Rotated ChangeLog into this file. diff --git a/extension/Makefile.am b/extension/Makefile.am index 58650ca3..f8be8d2b 100644 --- a/extension/Makefile.am +++ b/extension/Makefile.am @@ -138,6 +138,7 @@ uninstall-recursive: uninstall-so EXTRA_DIST = build-aux/config.rpath \ ChangeLog \ ChangeLog.0 \ + ChangeLog.1 \ ext_custom.h \ fts.3 \ m4 \ diff --git a/extension/Makefile.in b/extension/Makefile.in index 8a904ba5..13d8ffd6 100644 --- a/extension/Makefile.in +++ b/extension/Makefile.in @@ -635,6 +635,7 @@ readdir_test_la_LIBADD = $(MY_LIBS) EXTRA_DIST = build-aux/config.rpath \ ChangeLog \ ChangeLog.0 \ + ChangeLog.1 \ ext_custom.h \ fts.3 \ m4 \ diff --git a/test/ChangeLog b/test/ChangeLog index 862c2b87..ef4f632c 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,7 @@ +2019-04-18 Arnold D. Robbins + + * Makefile.am (EXTRA_DIST): Add ChangeLog.1 to the list. Ooops. + 2019-04-12 Arnold D. Robbins * ChangeLog.1: Rotated ChangeLog into this file. diff --git a/test/Makefile.am b/test/Makefile.am index 57d0444c..a7e972af 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -27,6 +27,7 @@ EXTRA_DIST = \ reg \ lib \ ChangeLog.0 \ + ChangeLog.1 \ Gentests \ Maketests \ README \ diff --git a/test/Makefile.in b/test/Makefile.in index fea54584..305277e3 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -286,6 +286,7 @@ EXTRA_DIST = \ reg \ lib \ ChangeLog.0 \ + ChangeLog.1 \ Gentests \ Maketests \ README \ -- cgit v1.2.3 From 33218616b4987c7afd860d0b3f4dad9cdb703547 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Thu, 18 Apr 2019 20:05:35 +0300 Subject: Update Italian manual. --- doc/it/ChangeLog | 4 ++++ doc/it/gawktexi.in | 13 ++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/doc/it/ChangeLog b/doc/it/ChangeLog index a384a80e..739d60d7 100644 --- a/doc/it/ChangeLog +++ b/doc/it/ChangeLog @@ -1,3 +1,7 @@ +2019-04-18 Antonio Giovanni Colombo + + * gawktexi.in: Updated. + 2019-04-12 Arnold D. Robbins * 5.0.0: Release tar ball made. diff --git a/doc/it/gawktexi.in b/doc/it/gawktexi.in index b0ff86e6..2c7e5ebe 100644 --- a/doc/it/gawktexi.in +++ b/doc/it/gawktexi.in @@ -6711,15 +6711,14 @@ un programma insensibile a maiuscolo/minuscolo senza doverlo modificare. @c @cindex ISO 8859-1 @c @cindex ISO Latin-1 -In localizzazioni multibyte, -le equivalenze tra caratteri maiuscoli +In localizzazioni multibyte, le equivalenze tra caratteri maiuscoli e minuscoli sono controllate usando i valori in formato esteso dell'insieme di caratteri della localizzazione. -Per il resto, i caratteri sono controllati usando l'insieme di caratteri -ISO-8859-1 (ISO Latin-1). -Questo insieme di caratteri @`e un'estensione del tradizionale insieme con 128 -caratteri ASCII, che include anche molti caratteri adatti -per le lingue europee.@footnote{Se questo sembra oscuro, +Prima della @value{PVERSION} 5.0, i caratteri che usano un solo byte +erano confrontati usando l'insieme di caratteri ISO-8859-1 (ISO Latin-1). +Tuttavia, a partire dalla @value{PVERSION} 5.0, i caratteri che usano +un solo byte sono confrontati usando anche i valori dell'insieme di +caratteri della localizzazione.@footnote{Se questo sembra oscuro, non c'@`e ragione di preoccuparsi; significa solo che @command{gawk} fa la cosa giusta.} -- cgit v1.2.3 From 9abeda33e7ce111a266d5e3ec4dafe65c26d5cd0 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Thu, 18 Apr 2019 20:15:15 +0300 Subject: Fix core dump upon syntax error. --- ChangeLog | 7 +++++++ awk.h | 1 + awkgram.c | 2 +- awkgram.y | 2 +- command.c | 14 +++++++------- command.y | 14 +++++++------- main.c | 6 ++++++ test/ChangeLog | 2 ++ test/Makefile.am | 4 +++- test/Makefile.in | 9 ++++++++- test/Maketests | 5 +++++ test/synerr3.awk | 1 + test/synerr3.ok | 5 +++++ 13 files changed, 54 insertions(+), 18 deletions(-) create mode 100644 test/synerr3.awk create mode 100644 test/synerr3.ok diff --git a/ChangeLog b/ChangeLog index 582aa91b..b18a7ba6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,13 @@ * Makefile.am (EXTRA_DIST): Add ChangeLog.1 to the list. Ooops. * CheckList: Updated. + Fix core dump reported by Steve Kemp : + + * awk.h (errcount): Declare. + * awkgram.y (errcount): No longer static. + * command.y (dbg_errcount): Renamed from errcount.j + * main.c (catchsig, catchsegv): If errcount > 0, just exit, + don't abort. 2019-04-12 Arnold D. Robbins * configure.ac: Update version to 5.0.0. diff --git a/awk.h b/awk.h index 2d87d5af..19a5eb5f 100644 --- a/awk.h +++ b/awk.h @@ -1116,6 +1116,7 @@ extern NODE *Null_field; extern NODE **fields_arr; extern int sourceline; extern char *source; +extern int errcount; extern int (*interpret)(INSTRUCTION *); /* interpreter routine */ extern NODE *(*make_number)(double); /* double instead of AWKNUM on purpose */ extern NODE *(*str2number)(NODE *); diff --git a/awkgram.c b/awkgram.c index a568f5da..150cfdc9 100644 --- a/awkgram.c +++ b/awkgram.c @@ -198,7 +198,7 @@ static int continue_allowed; /* kludge for continue */ static char *tokstart = NULL; static char *tok = NULL; static char *tokend; -static int errcount = 0; +int errcount = 0; extern char *source; extern int sourceline; diff --git a/awkgram.y b/awkgram.y index 87570dfa..08bd096e 100644 --- a/awkgram.y +++ b/awkgram.y @@ -154,7 +154,7 @@ static int continue_allowed; /* kludge for continue */ static char *tokstart = NULL; static char *tok = NULL; static char *tokend; -static int errcount = 0; +int errcount = 0; extern char *source; extern int sourceline; diff --git a/command.c b/command.c index 16c99673..87211ee7 100644 --- a/command.c +++ b/command.c @@ -94,7 +94,7 @@ static bool want_nodeval = false; static int cmd_idx = -1; /* index of current command in cmd table */ static int repeat_idx = -1; /* index of last repeatable command in command table */ static CMDARG *arg_list = NULL; /* list of arguments */ -static long errcount = 0; +static long dbg_errcount = 0; static char *lexptr_begin = NULL; static bool in_commands = false; static int num_dim; @@ -1553,7 +1553,7 @@ yyreduce: case 5: #line 130 "command.y" /* yacc.c:1652 */ { - if (errcount == 0 && cmd_idx >= 0) { + if (dbg_errcount == 0 && cmd_idx >= 0) { Func_cmd cmdfunc; bool terminate = false; CMDARG *args; @@ -1621,7 +1621,7 @@ yyreduce: case 23: #line 219 "command.y" /* yacc.c:1652 */ { - if (errcount == 0) { + if (dbg_errcount == 0) { /* don't free arg_list; passed on to statement_list * non-terminal (empty rule action). See below. */ @@ -1788,7 +1788,7 @@ yyreduce: if (yyvsp[0] != NULL) num = yyvsp[0]->a_int; - if (errcount != 0) + if (dbg_errcount != 0) ; else if (in_commands) yyerror(_("Can't use command `commands' for breakpoint/watchpoint commands")); @@ -2774,7 +2774,7 @@ yyerror(const char *mesg, ...) vfprintf(out_fp, mesg, args); fprintf(out_fp, "\n"); va_end(args); - errcount++; + dbg_errcount++; repeat_idx = -1; } @@ -2796,9 +2796,9 @@ yylex(void) yylval = (CMDARG *) NULL; - if (errcount > 0 && lexptr_begin == NULL) { + if (dbg_errcount > 0 && lexptr_begin == NULL) { /* fake a new line */ - errcount = 0; + dbg_errcount = 0; return '\n'; } diff --git a/command.y b/command.y index 1af3ad12..6d2c9ef2 100644 --- a/command.y +++ b/command.y @@ -44,7 +44,7 @@ static bool want_nodeval = false; static int cmd_idx = -1; /* index of current command in cmd table */ static int repeat_idx = -1; /* index of last repeatable command in command table */ static CMDARG *arg_list = NULL; /* list of arguments */ -static long errcount = 0; +static long dbg_errcount = 0; static char *lexptr_begin = NULL; static bool in_commands = false; static int num_dim; @@ -128,7 +128,7 @@ line : nls | command nls { - if (errcount == 0 && cmd_idx >= 0) { + if (dbg_errcount == 0 && cmd_idx >= 0) { Func_cmd cmdfunc; bool terminate = false; CMDARG *args; @@ -217,7 +217,7 @@ set_want_nodeval eval_prologue : D_EVAL set_want_nodeval opt_param_list nls { - if (errcount == 0) { + if (dbg_errcount == 0) { /* don't free arg_list; passed on to statement_list * non-terminal (empty rule action). See below. */ @@ -335,7 +335,7 @@ command if ($2 != NULL) num = $2->a_int; - if (errcount != 0) + if (dbg_errcount != 0) ; else if (in_commands) yyerror(_("Can't use command `commands' for breakpoint/watchpoint commands")); @@ -1017,7 +1017,7 @@ yyerror(const char *mesg, ...) vfprintf(out_fp, mesg, args); fprintf(out_fp, "\n"); va_end(args); - errcount++; + dbg_errcount++; repeat_idx = -1; } @@ -1039,9 +1039,9 @@ yylex(void) yylval = (CMDARG *) NULL; - if (errcount > 0 && lexptr_begin == NULL) { + if (dbg_errcount > 0 && lexptr_begin == NULL) { /* fake a new line */ - errcount = 0; + dbg_errcount = 0; return '\n'; } diff --git a/main.c b/main.c index d6e34266..8327cc74 100644 --- a/main.c +++ b/main.c @@ -1262,6 +1262,9 @@ catchsig(int sig) || sig == SIGBUS #endif ) { + if (errcount > 0) // assume a syntax error corrupted our data structures + exit(EXIT_FATAL); + set_loc(__FILE__, __LINE__); msg(_("fatal error: internal error")); /* fatal won't abort() if not compiled for debugging */ @@ -1279,6 +1282,9 @@ catchsig(int sig) static int catchsegv(void *fault_address, int serious) { + if (errcount > 0) // assume a syntax error corrupted our data structures + exit(EXIT_FATAL); + set_loc(__FILE__, __LINE__); msg(_("fatal error: internal error: segfault")); fflush(NULL); diff --git a/test/ChangeLog b/test/ChangeLog index ef4f632c..a6398975 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,6 +1,8 @@ 2019-04-18 Arnold D. Robbins * Makefile.am (EXTRA_DIST): Add ChangeLog.1 to the list. Ooops. + (synerr3): New test. + * synerr3.awk, synerr3.ok: New files. 2019-04-12 Arnold D. Robbins diff --git a/test/Makefile.am b/test/Makefile.am index a7e972af..8c794d62 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1188,6 +1188,8 @@ EXTRA_DIST = \ synerr1.ok \ synerr2.awk \ synerr2.ok \ + synerr3.awk \ + synerr3.ok \ tailrecurse.awk \ tailrecurse.ok \ testext.ok \ @@ -1311,7 +1313,7 @@ BASIC_TESTS = \ scalar sclforin sclifin setrec0 setrec1 \ sigpipe1 sortempty sortglos spacere splitargv splitarr \ splitdef splitvar splitwht status-close strcat1 strnum1 strnum2 strtod \ - subamp subback subi18n subsepnm subslash substr swaplns synerr1 synerr2 \ + subamp subback subi18n subsepnm subslash substr swaplns synerr1 synerr2 synerr3 \ tailrecurse tradanch trailbs tweakfld \ uninit2 uninit3 uninit4 uninit5 uninitialized unterm uparrfs uplus \ wideidx wideidx2 widesub widesub2 widesub3 widesub4 wjposer1 \ diff --git a/test/Makefile.in b/test/Makefile.in index 305277e3..ee821c9a 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -1447,6 +1447,8 @@ EXTRA_DIST = \ synerr1.ok \ synerr2.awk \ synerr2.ok \ + synerr3.awk \ + synerr3.ok \ tailrecurse.awk \ tailrecurse.ok \ testext.ok \ @@ -1570,7 +1572,7 @@ BASIC_TESTS = \ scalar sclforin sclifin setrec0 setrec1 \ sigpipe1 sortempty sortglos spacere splitargv splitarr \ splitdef splitvar splitwht status-close strcat1 strnum1 strnum2 strtod \ - subamp subback subi18n subsepnm subslash substr swaplns synerr1 synerr2 \ + subamp subback subi18n subsepnm subslash substr swaplns synerr1 synerr2 synerr3 \ tailrecurse tradanch trailbs tweakfld \ uninit2 uninit3 uninit4 uninit5 uninitialized unterm uparrfs uplus \ wideidx wideidx2 widesub widesub2 widesub3 widesub4 wjposer1 \ @@ -3841,6 +3843,11 @@ synerr2: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +synerr3: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + tailrecurse: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/Maketests b/test/Maketests index e557cb2b..dadba2ee 100644 --- a/test/Maketests +++ b/test/Maketests @@ -1104,6 +1104,11 @@ synerr2: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +synerr3: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + tailrecurse: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/synerr3.awk b/test/synerr3.awk new file mode 100644 index 00000000..49b9e30a --- /dev/null +++ b/test/synerr3.awk @@ -0,0 +1 @@ +for (i = ) in foo bar baz diff --git a/test/synerr3.ok b/test/synerr3.ok new file mode 100644 index 00000000..b8b9dd89 --- /dev/null +++ b/test/synerr3.ok @@ -0,0 +1,5 @@ +gawk: synerr3.awk:1: for (i = ) in foo bar baz +gawk: synerr3.awk:1: ^ syntax error +gawk: synerr3.awk:1: for (i = ) in foo bar baz +gawk: synerr3.awk:1: ^ syntax error +EXIT CODE: 2 -- cgit v1.2.3 From 7386af3ac9510a3f06d140548e6051db322e3ec2 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Sun, 21 Apr 2019 14:00:10 +0300 Subject: Doc on workaround for debugger -f limitation. --- doc/ChangeLog | 7 + doc/gawk.info | 387 +++++++++++++++++++++++++++++--------------------------- doc/gawk.texi | 14 ++ doc/gawktexi.in | 14 ++ 4 files changed, 233 insertions(+), 189 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index d51a9a17..2f802349 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,10 @@ +2019-04-21 Arnold D. Robbins + + * gawktexi.in (Limitations): Provide brief instructions + on how to use use a temporary file in a script with + the debugger. Thanks to Holger Klene + for the discussion. + 2019-04-18 Arnold D. Robbins * gawktexi.in (Undocumented): Note an undocumented feature. diff --git a/doc/gawk.info b/doc/gawk.info index f7b93f6a..aacd68ed 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -22766,7 +22766,16 @@ some limitations. A few that it's worth being aware of are: language that is used mainly for quickly executing, short programs. * The 'gawk' debugger only accepts source code supplied with the '-f' - option. + option. If you have a shell script that provides an 'awk' program + as a command line parameter, and you need to use the debugger, you + can write the script to a temporary file, and use that as the + program, with the '-f' option. This might look like this: + + cat << \EOF > /tmp/script.$$ + ... Your program here + EOF + gawk -D -f /tmp/script.$$ + rm /tmp/script.$$  File: gawk.info, Node: Debugging Summary, Prev: Limitations, Up: Debugger @@ -37276,193 +37285,193 @@ Node: Debugger Info910229 Node: Miscellaneous Debugger Commands914300 Node: Readline Support919362 Node: Limitations920258 -Node: Debugging Summary922367 -Node: Namespaces923646 -Node: Global Namespace924725 -Node: Qualified Names926123 -Node: Default Namespace927122 -Node: Changing The Namespace927863 -Node: Naming Rules929477 -Node: Internal Name Management931325 -Node: Namespace Example932367 -Node: Namespace And Features934929 -Node: Namespace Summary936364 -Node: Arbitrary Precision Arithmetic937841 -Node: Computer Arithmetic939328 -Ref: table-numeric-ranges943094 -Ref: table-floating-point-ranges943587 -Ref: Computer Arithmetic-Footnote-1944245 -Node: Math Definitions944302 -Ref: table-ieee-formats947618 -Ref: Math Definitions-Footnote-1948221 -Node: MPFR features948326 -Node: FP Math Caution950044 -Ref: FP Math Caution-Footnote-1951116 -Node: Inexactness of computations951485 -Node: Inexact representation952445 -Node: Comparing FP Values953805 -Node: Errors accumulate955046 -Node: Getting Accuracy956479 -Node: Try To Round959189 -Node: Setting precision960088 -Ref: table-predefined-precision-strings960785 -Node: Setting the rounding mode962615 -Ref: table-gawk-rounding-modes962989 -Ref: Setting the rounding mode-Footnote-1966920 -Node: Arbitrary Precision Integers967099 -Ref: Arbitrary Precision Integers-Footnote-1970274 -Node: Checking for MPFR970423 -Node: POSIX Floating Point Problems971897 -Ref: POSIX Floating Point Problems-Footnote-1976182 -Node: Floating point summary976220 -Node: Dynamic Extensions978410 -Node: Extension Intro979963 -Node: Plugin License981229 -Node: Extension Mechanism Outline982026 -Ref: figure-load-extension982465 -Ref: figure-register-new-function984030 -Ref: figure-call-new-function985122 -Node: Extension API Description987184 -Node: Extension API Functions Introduction988826 -Ref: table-api-std-headers990662 -Node: General Data Types994527 -Ref: General Data Types-Footnote-11002888 -Node: Memory Allocation Functions1003187 -Ref: Memory Allocation Functions-Footnote-11007397 -Node: Constructor Functions1007496 -Node: Registration Functions1011082 -Node: Extension Functions1011767 -Node: Exit Callback Functions1017089 -Node: Extension Version String1018339 -Node: Input Parsers1019002 -Node: Output Wrappers1031723 -Node: Two-way processors1036235 -Node: Printing Messages1038500 -Ref: Printing Messages-Footnote-11039671 -Node: Updating ERRNO1039824 -Node: Requesting Values1040563 -Ref: table-value-types-returned1041300 -Node: Accessing Parameters1042236 -Node: Symbol Table Access1043471 -Node: Symbol table by name1043983 -Ref: Symbol table by name-Footnote-11047007 -Node: Symbol table by cookie1047135 -Ref: Symbol table by cookie-Footnote-11051320 -Node: Cached values1051384 -Ref: Cached values-Footnote-11054920 -Node: Array Manipulation1055073 -Ref: Array Manipulation-Footnote-11056164 -Node: Array Data Types1056201 -Ref: Array Data Types-Footnote-11058859 -Node: Array Functions1058951 -Node: Flattening Arrays1063449 -Node: Creating Arrays1070425 -Node: Redirection API1075192 -Node: Extension API Variables1078025 -Node: Extension Versioning1078736 -Ref: gawk-api-version1079165 -Node: Extension GMP/MPFR Versioning1080896 -Node: Extension API Informational Variables1082524 -Node: Extension API Boilerplate1083597 -Node: Changes from API V11087571 -Node: Finding Extensions1089143 -Node: Extension Example1089702 -Node: Internal File Description1090500 -Node: Internal File Ops1094580 -Ref: Internal File Ops-Footnote-11105930 -Node: Using Internal File Ops1106070 -Ref: Using Internal File Ops-Footnote-11108453 -Node: Extension Samples1108727 -Node: Extension Sample File Functions1110256 -Node: Extension Sample Fnmatch1117905 -Node: Extension Sample Fork1119392 -Node: Extension Sample Inplace1120610 -Node: Extension Sample Ord1123914 -Node: Extension Sample Readdir1124750 -Ref: table-readdir-file-types1125639 -Node: Extension Sample Revout1126444 -Node: Extension Sample Rev2way1127033 -Node: Extension Sample Read write array1127773 -Node: Extension Sample Readfile1129715 -Node: Extension Sample Time1130810 -Node: Extension Sample API Tests1132158 -Node: gawkextlib1132650 -Node: Extension summary1135568 -Node: Extension Exercises1139270 -Node: Language History1140512 -Node: V7/SVR3.11142168 -Node: SVR41144320 -Node: POSIX1145754 -Node: BTL1147134 -Node: POSIX/GNU1147863 -Node: Feature History1153641 -Node: Common Extensions1169687 -Node: Ranges and Locales1170970 -Ref: Ranges and Locales-Footnote-11175586 -Ref: Ranges and Locales-Footnote-21175613 -Ref: Ranges and Locales-Footnote-31175848 -Node: Contributors1176069 -Node: History summary1182014 -Node: Installation1183394 -Node: Gawk Distribution1184338 -Node: Getting1184822 -Node: Extracting1185785 -Node: Distribution contents1187423 -Node: Unix Installation1193903 -Node: Quick Installation1194585 -Node: Shell Startup Files1196999 -Node: Additional Configuration Options1198088 -Node: Configuration Philosophy1200253 -Node: Non-Unix Installation1202622 -Node: PC Installation1203082 -Node: PC Binary Installation1203920 -Node: PC Compiling1204355 -Node: PC Using1205472 -Node: Cygwin1209025 -Node: MSYS1210124 -Node: VMS Installation1210625 -Node: VMS Compilation1211416 -Ref: VMS Compilation-Footnote-11212645 -Node: VMS Dynamic Extensions1212703 -Node: VMS Installation Details1214388 -Node: VMS Running1216641 -Node: VMS GNV1220920 -Node: VMS Old Gawk1221655 -Node: Bugs1222126 -Node: Bug address1222789 -Node: Usenet1225771 -Node: Maintainers1226775 -Node: Other Versions1228036 -Node: Installation summary1234950 -Node: Notes1236152 -Node: Compatibility Mode1236946 -Node: Additions1237728 -Node: Accessing The Source1238653 -Node: Adding Code1240090 -Node: New Ports1246309 -Node: Derived Files1250684 -Ref: Derived Files-Footnote-11256344 -Ref: Derived Files-Footnote-21256379 -Ref: Derived Files-Footnote-31256977 -Node: Future Extensions1257091 -Node: Implementation Limitations1257749 -Node: Extension Design1258932 -Node: Old Extension Problems1260076 -Ref: Old Extension Problems-Footnote-11261594 -Node: Extension New Mechanism Goals1261651 -Ref: Extension New Mechanism Goals-Footnote-11265015 -Node: Extension Other Design Decisions1265204 -Node: Extension Future Growth1267317 -Node: Notes summary1268153 -Node: Basic Concepts1269311 -Node: Basic High Level1269992 -Ref: figure-general-flow1270274 -Ref: figure-process-flow1270959 -Ref: Basic High Level-Footnote-11274260 -Node: Basic Data Typing1274445 -Node: Glossary1277773 -Node: Copying1309611 -Node: GNU Free Documentation License1347154 -Node: Index1372274 +Node: Debugging Summary922812 +Node: Namespaces924091 +Node: Global Namespace925170 +Node: Qualified Names926568 +Node: Default Namespace927567 +Node: Changing The Namespace928308 +Node: Naming Rules929922 +Node: Internal Name Management931770 +Node: Namespace Example932812 +Node: Namespace And Features935374 +Node: Namespace Summary936809 +Node: Arbitrary Precision Arithmetic938286 +Node: Computer Arithmetic939773 +Ref: table-numeric-ranges943539 +Ref: table-floating-point-ranges944032 +Ref: Computer Arithmetic-Footnote-1944690 +Node: Math Definitions944747 +Ref: table-ieee-formats948063 +Ref: Math Definitions-Footnote-1948666 +Node: MPFR features948771 +Node: FP Math Caution950489 +Ref: FP Math Caution-Footnote-1951561 +Node: Inexactness of computations951930 +Node: Inexact representation952890 +Node: Comparing FP Values954250 +Node: Errors accumulate955491 +Node: Getting Accuracy956924 +Node: Try To Round959634 +Node: Setting precision960533 +Ref: table-predefined-precision-strings961230 +Node: Setting the rounding mode963060 +Ref: table-gawk-rounding-modes963434 +Ref: Setting the rounding mode-Footnote-1967365 +Node: Arbitrary Precision Integers967544 +Ref: Arbitrary Precision Integers-Footnote-1970719 +Node: Checking for MPFR970868 +Node: POSIX Floating Point Problems972342 +Ref: POSIX Floating Point Problems-Footnote-1976627 +Node: Floating point summary976665 +Node: Dynamic Extensions978855 +Node: Extension Intro980408 +Node: Plugin License981674 +Node: Extension Mechanism Outline982471 +Ref: figure-load-extension982910 +Ref: figure-register-new-function984475 +Ref: figure-call-new-function985567 +Node: Extension API Description987629 +Node: Extension API Functions Introduction989271 +Ref: table-api-std-headers991107 +Node: General Data Types994972 +Ref: General Data Types-Footnote-11003333 +Node: Memory Allocation Functions1003632 +Ref: Memory Allocation Functions-Footnote-11007842 +Node: Constructor Functions1007941 +Node: Registration Functions1011527 +Node: Extension Functions1012212 +Node: Exit Callback Functions1017534 +Node: Extension Version String1018784 +Node: Input Parsers1019447 +Node: Output Wrappers1032168 +Node: Two-way processors1036680 +Node: Printing Messages1038945 +Ref: Printing Messages-Footnote-11040116 +Node: Updating ERRNO1040269 +Node: Requesting Values1041008 +Ref: table-value-types-returned1041745 +Node: Accessing Parameters1042681 +Node: Symbol Table Access1043916 +Node: Symbol table by name1044428 +Ref: Symbol table by name-Footnote-11047452 +Node: Symbol table by cookie1047580 +Ref: Symbol table by cookie-Footnote-11051765 +Node: Cached values1051829 +Ref: Cached values-Footnote-11055365 +Node: Array Manipulation1055518 +Ref: Array Manipulation-Footnote-11056609 +Node: Array Data Types1056646 +Ref: Array Data Types-Footnote-11059304 +Node: Array Functions1059396 +Node: Flattening Arrays1063894 +Node: Creating Arrays1070870 +Node: Redirection API1075637 +Node: Extension API Variables1078470 +Node: Extension Versioning1079181 +Ref: gawk-api-version1079610 +Node: Extension GMP/MPFR Versioning1081341 +Node: Extension API Informational Variables1082969 +Node: Extension API Boilerplate1084042 +Node: Changes from API V11088016 +Node: Finding Extensions1089588 +Node: Extension Example1090147 +Node: Internal File Description1090945 +Node: Internal File Ops1095025 +Ref: Internal File Ops-Footnote-11106375 +Node: Using Internal File Ops1106515 +Ref: Using Internal File Ops-Footnote-11108898 +Node: Extension Samples1109172 +Node: Extension Sample File Functions1110701 +Node: Extension Sample Fnmatch1118350 +Node: Extension Sample Fork1119837 +Node: Extension Sample Inplace1121055 +Node: Extension Sample Ord1124359 +Node: Extension Sample Readdir1125195 +Ref: table-readdir-file-types1126084 +Node: Extension Sample Revout1126889 +Node: Extension Sample Rev2way1127478 +Node: Extension Sample Read write array1128218 +Node: Extension Sample Readfile1130160 +Node: Extension Sample Time1131255 +Node: Extension Sample API Tests1132603 +Node: gawkextlib1133095 +Node: Extension summary1136013 +Node: Extension Exercises1139715 +Node: Language History1140957 +Node: V7/SVR3.11142613 +Node: SVR41144765 +Node: POSIX1146199 +Node: BTL1147579 +Node: POSIX/GNU1148308 +Node: Feature History1154086 +Node: Common Extensions1170132 +Node: Ranges and Locales1171415 +Ref: Ranges and Locales-Footnote-11176031 +Ref: Ranges and Locales-Footnote-21176058 +Ref: Ranges and Locales-Footnote-31176293 +Node: Contributors1176514 +Node: History summary1182459 +Node: Installation1183839 +Node: Gawk Distribution1184783 +Node: Getting1185267 +Node: Extracting1186230 +Node: Distribution contents1187868 +Node: Unix Installation1194348 +Node: Quick Installation1195030 +Node: Shell Startup Files1197444 +Node: Additional Configuration Options1198533 +Node: Configuration Philosophy1200698 +Node: Non-Unix Installation1203067 +Node: PC Installation1203527 +Node: PC Binary Installation1204365 +Node: PC Compiling1204800 +Node: PC Using1205917 +Node: Cygwin1209470 +Node: MSYS1210569 +Node: VMS Installation1211070 +Node: VMS Compilation1211861 +Ref: VMS Compilation-Footnote-11213090 +Node: VMS Dynamic Extensions1213148 +Node: VMS Installation Details1214833 +Node: VMS Running1217086 +Node: VMS GNV1221365 +Node: VMS Old Gawk1222100 +Node: Bugs1222571 +Node: Bug address1223234 +Node: Usenet1226216 +Node: Maintainers1227220 +Node: Other Versions1228481 +Node: Installation summary1235395 +Node: Notes1236597 +Node: Compatibility Mode1237391 +Node: Additions1238173 +Node: Accessing The Source1239098 +Node: Adding Code1240535 +Node: New Ports1246754 +Node: Derived Files1251129 +Ref: Derived Files-Footnote-11256789 +Ref: Derived Files-Footnote-21256824 +Ref: Derived Files-Footnote-31257422 +Node: Future Extensions1257536 +Node: Implementation Limitations1258194 +Node: Extension Design1259377 +Node: Old Extension Problems1260521 +Ref: Old Extension Problems-Footnote-11262039 +Node: Extension New Mechanism Goals1262096 +Ref: Extension New Mechanism Goals-Footnote-11265460 +Node: Extension Other Design Decisions1265649 +Node: Extension Future Growth1267762 +Node: Notes summary1268598 +Node: Basic Concepts1269756 +Node: Basic High Level1270437 +Ref: figure-general-flow1270719 +Ref: figure-process-flow1271404 +Ref: Basic High Level-Footnote-11274705 +Node: Basic Data Typing1274890 +Node: Glossary1278218 +Node: Copying1310056 +Node: GNU Free Documentation License1347599 +Node: Index1372719  End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index 02481a7c..dd7389b8 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -31721,6 +31721,18 @@ executing, short programs. @item The @command{gawk} debugger only accepts source code supplied with the @option{-f} option. +If you have a shell script that provides an @command{awk} program as a command +line parameter, and you need to use the debugger, you can write the script +to a temporary file, and use that as the program, with the @option{-f} option. This +might look like this: + +@example +cat << \EOF > /tmp/script.$$ +@dots{} @ii{Your program here} +EOF +gawk -D -f /tmp/script.$$ +rm /tmp/script.$$ +@end example @end itemize @ignore @@ -45178,3 +45190,5 @@ Add a section explaining recursion from ground zero. Probably easiest to do it with factorial as the example. Explain that recursion needs a stopping condition. Thanks to Bill Duncan for the suggestion. + +4/2109: Go through and check @print{} vs. @error{} in examples diff --git a/doc/gawktexi.in b/doc/gawktexi.in index 0408d61c..6b17f5ea 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -30733,6 +30733,18 @@ executing, short programs. @item The @command{gawk} debugger only accepts source code supplied with the @option{-f} option. +If you have a shell script that provides an @command{awk} program as a command +line parameter, and you need to use the debugger, you can write the script +to a temporary file, and use that as the program, with the @option{-f} option. This +might look like this: + +@example +cat << \EOF > /tmp/script.$$ +@dots{} @ii{Your program here} +EOF +gawk -D -f /tmp/script.$$ +rm /tmp/script.$$ +@end example @end itemize @ignore @@ -44151,3 +44163,5 @@ Add a section explaining recursion from ground zero. Probably easiest to do it with factorial as the example. Explain that recursion needs a stopping condition. Thanks to Bill Duncan for the suggestion. + +4/2109: Go through and check @print{} vs. @error{} in examples -- cgit v1.2.3 From 4c28839cbd2c40f7dacc5185fee352eb28f69ac5 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Sun, 21 Apr 2019 14:34:23 +0300 Subject: Doc fix: POSIX language on RS. --- ChangeLog | 5 + POSIX.STD | 12 +- doc/ChangeLog | 3 + doc/gawk.info | 1155 ++++++++++++++++++++++++++++--------------------------- doc/gawk.texi | 14 +- doc/gawktexi.in | 14 +- 6 files changed, 621 insertions(+), 582 deletions(-) diff --git a/ChangeLog b/ChangeLog index b18a7ba6..e8b37e3e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2019-04-21 Arnold D. Robbins + + * POSIX.STD: Updated. + 2019-04-18 Arnold D. Robbins * msg.c (msg): Add an undocumented feature. "Use the Source, Luke." @@ -11,6 +15,7 @@ * command.y (dbg_errcount): Renamed from errcount.j * main.c (catchsig, catchsegv): If errcount > 0, just exit, don't abort. + 2019-04-12 Arnold D. Robbins * configure.ac: Update version to 5.0.0. diff --git a/POSIX.STD b/POSIX.STD index a2368949..d40433ff 100644 --- a/POSIX.STD +++ b/POSIX.STD @@ -1,11 +1,11 @@ - Copyright (C) 1992, 1995, 1998, 2001, 2006, 2007, 2010, 2011, 2015 + Copyright (C) 1992, 1995, 1998, 2001, 2006, 2007, 2010, 2011, 2015, 2019 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. -------------------------------------------------------------------------- -Thu Feb 12 08:51:22 IST 2015 +Sun Apr 21 14:27:19 IDT 2019 ============================ This file documents several things related to the 2008 POSIX standard that I noted after reviewing it. @@ -43,6 +43,14 @@ that I noted after reviewing it. Gawk enforces this only with --posix. +5. According to POSIX (following the A, K, & W book), when RS = "", then + newline is also a separator, "no matter what the value of FS is", implying + that this is true even if FS is a regexp. + + In fact, UNIX awk has never behaved that, way; it adds \n to the list + for FS = " " or any other single character, and gawk does too. This is + essentially a bug in POSIX. + The following things aren't described by POSIX but ought to be: 1. The value of $0 in an END rule diff --git a/doc/ChangeLog b/doc/ChangeLog index 2f802349..2af0aa5e 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -4,6 +4,9 @@ on how to use use a temporary file in a script with the debugger. Thanks to Holger Klene for the discussion. + (Multiple Lines): Note that POSIX seems to require \n as + separator for all values of FS, but that in reality it + doesn't apply to regexps; this is a POSIX bug. 2019-04-18 Arnold D. Robbins diff --git a/doc/gawk.info b/doc/gawk.info index aacd68ed..513be76b 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -5586,98 +5586,102 @@ each of the lines into fields in the normal manner. This happens by default as the result of a special feature. When 'RS' is set to the empty string _and_ 'FS' is set to a single character, the newline character _always_ acts as a field separator. This is in addition to -whatever field separations result from 'FS'.(1) - - The original motivation for this special exception was probably to -provide useful behavior in the default case (i.e., 'FS' is equal to -'" "'). This feature can be a problem if you really don't want the -newline character to separate fields, because there is no way to prevent -it. However, you can work around this by using the 'split()' function -to break up the record manually (*note String Functions::). If you have -a single-character field separator, you can work around the special -feature in a different way, by making 'FS' into a regexp for that single -character. For example, if the field separator is a percent character, -instead of 'FS = "%"', use 'FS = "[%]"'. - - Another way to separate fields is to put each field on a separate -line: to do this, just set the variable 'FS' to the string '"\n"'. -(This single-character separator matches a single newline.) A practical -example of a data file organized this way might be a mailing list, where -blank lines separate the entries. Consider a mailing list in a file -named 'addresses', which looks like this: - - Jane Doe - 123 Main Street - Anywhere, SE 12345-6789 - - John Smith - 456 Tree-lined Avenue - Smallville, MW 98765-4321 - ... - -A simple program to process this file is as follows: - - # addrs.awk --- simple mailing list program +whatever field separations result from 'FS'. + + NOTE: When 'FS' is the null string ('""') or a regexp, this special + feature of 'RS' does not apply. It does apply to the default field + separator of a single space: 'FS = " "'. + + Note that language in the POSIX specification implies that this + special feature should apply when 'FS' is a regexp. However, Unix + 'awk' has never behaved that way, nor has 'gawk'. This is + essentially a bug in POSIX. + + The original motivation for this special exception was probably to + provide useful behavior in the default case (i.e., 'FS' is equal to + '" "'). This feature can be a problem if you really don't want the + newline character to separate fields, because there is no way to + prevent it. However, you can work around this by using the + 'split()' function to break up the record manually (*note String + Functions::). If you have a single-character field separator, you + can work around the special feature in a different way, by making + 'FS' into a regexp for that single character. For example, if the + field separator is a percent character, instead of 'FS = "%"', use + 'FS = "[%]"'. + + Another way to separate fields is to put each field on a separate + line: to do this, just set the variable 'FS' to the string '"\n"'. + (This single-character separator matches a single newline.) A + practical example of a data file organized this way might be a + mailing list, where blank lines separate the entries. Consider a + mailing list in a file named 'addresses', which looks like this: + + Jane Doe + 123 Main Street + Anywhere, SE 12345-6789 + + John Smith + 456 Tree-lined Avenue + Smallville, MW 98765-4321 + ... - # Records are separated by blank lines. - # Each line is one field. - BEGIN { RS = "" ; FS = "\n" } + A simple program to process this file is as follows: - { - print "Name is:", $1 - print "Address is:", $2 - print "City and State are:", $3 - print "" - } + # addrs.awk --- simple mailing list program - Running the program produces the following output: + # Records are separated by blank lines. + # Each line is one field. + BEGIN { RS = "" ; FS = "\n" } - $ awk -f addrs.awk addresses - -| Name is: Jane Doe - -| Address is: 123 Main Street - -| City and State are: Anywhere, SE 12345-6789 - -| - -| Name is: John Smith - -| Address is: 456 Tree-lined Avenue - -| City and State are: Smallville, MW 98765-4321 - -| - ... + { + print "Name is:", $1 + print "Address is:", $2 + print "City and State are:", $3 + print "" + } - *Note Labels Program:: for a more realistic program dealing with -address lists. The following list summarizes how records are split, -based on the value of 'RS'. ('==' means "is equal to.") + Running the program produces the following output: -'RS == "\n"' - Records are separated by the newline character ('\n'). In effect, - every line in the data file is a separate record, including blank - lines. This is the default. + $ awk -f addrs.awk addresses + -| Name is: Jane Doe + -| Address is: 123 Main Street + -| City and State are: Anywhere, SE 12345-6789 + -| + -| Name is: John Smith + -| Address is: 456 Tree-lined Avenue + -| City and State are: Smallville, MW 98765-4321 + -| + ... -'RS == ANY SINGLE CHARACTER' - Records are separated by each occurrence of the character. - Multiple successive occurrences delimit empty records. + *Note Labels Program:: for a more realistic program dealing with + address lists. The following list summarizes how records are + split, based on the value of 'RS'. ('==' means "is equal to.") -'RS == ""' - Records are separated by runs of blank lines. When 'FS' is a - single character, then the newline character always serves as a - field separator, in addition to whatever value 'FS' may have. - Leading and trailing newlines in a file are ignored. + 'RS == "\n"' + Records are separated by the newline character ('\n'). In + effect, every line in the data file is a separate record, + including blank lines. This is the default. -'RS == REGEXP' - Records are separated by occurrences of characters that match - REGEXP. Leading and trailing matches of REGEXP delimit empty - records. (This is a 'gawk' extension; it is not specified by the - POSIX standard.) + 'RS == ANY SINGLE CHARACTER' + Records are separated by each occurrence of the character. + Multiple successive occurrences delimit empty records. - If not in compatibility mode (*note Options::), 'gawk' sets 'RT' to -the input text that matched the value specified by 'RS'. But if the -input file ended without any text that matches 'RS', then 'gawk' sets -'RT' to the null string. + 'RS == ""' + Records are separated by runs of blank lines. When 'FS' is a + single character, then the newline character always serves as + a field separator, in addition to whatever value 'FS' may + have. Leading and trailing newlines in a file are ignored. - ---------- Footnotes ---------- + 'RS == REGEXP' + Records are separated by occurrences of characters that match + REGEXP. Leading and trailing matches of REGEXP delimit empty + records. (This is a 'gawk' extension; it is not specified by + the POSIX standard.) - (1) When 'FS' is the null string ('""') or a regexp, this special -feature of 'RS' does not apply. It does apply to the default field -separator of a single space: 'FS = " "'. + If not in compatibility mode (*note Options::), 'gawk' sets 'RT' to + the input text that matched the value specified by 'RS'. But if + the input file ended without any text that matches 'RS', then + 'gawk' sets 'RT' to the null string.  File: gawk.info, Node: Getline, Next: Read Timeout, Prev: Multiple Line, Up: Reading Files @@ -34786,7 +34790,7 @@ Index * differences in awk and gawk, RS/RT variables <1>: gawk split records. (line 58) * differences in awk and gawk, RS/RT variables <2>: Multiple Line. - (line 130) + (line 140) * differences in awk and gawk, RS/RT variables <3>: Auto-set. (line 348) * differences in awk and gawk, single-character fields: Single Character Fields. (line 6) @@ -35314,7 +35318,7 @@ Index (line 136) * gawk, RT variable in: awk split records. (line 131) * gawk, RT variable in <1>: gawk split records. (line 58) -* gawk, RT variable in <2>: Multiple Line. (line 130) +* gawk, RT variable in <2>: Multiple Line. (line 140) * gawk, RT variable in <3>: Auto-set. (line 348) * gawk, See Also awk: Preface. (line 34) * gawk, source code, obtaining: Getting. (line 6) @@ -36348,7 +36352,7 @@ Index * RSTART variable, match() function and: String Functions. (line 228) * RT variable: awk split records. (line 131) * RT variable <1>: gawk split records. (line 58) -* RT variable <2>: Multiple Line. (line 130) +* RT variable <2>: Multiple Line. (line 140) * RT variable <3>: Auto-set. (line 348) * Rubin, Paul: History. (line 30) * Rubin, Paul <1>: Contributors. (line 16) @@ -36980,498 +36984,497 @@ Node: Splitting By Content243260 Ref: Splitting By Content-Footnote-1246910 Node: Testing field creation247073 Node: Multiple Line248698 -Ref: Multiple Line-Footnote-1254582 -Node: Getline254761 -Node: Plain Getline257230 -Node: Getline/Variable259871 -Node: Getline/File261022 -Node: Getline/Variable/File262410 -Ref: Getline/Variable/File-Footnote-1264015 -Node: Getline/Pipe264103 -Node: Getline/Variable/Pipe266810 -Node: Getline/Coprocess267945 -Node: Getline/Variable/Coprocess269212 -Node: Getline Notes269954 -Node: Getline Summary272751 -Ref: table-getline-variants273175 -Node: Read Timeout273923 -Ref: Read Timeout-Footnote-1277829 -Node: Retrying Input277887 -Node: Command-line directories279086 -Node: Input Summary279992 -Node: Input Exercises283164 -Node: Printing283892 -Node: Print285726 -Node: Print Examples287183 -Node: Output Separators289963 -Node: OFMT291980 -Node: Printf293336 -Node: Basic Printf294121 -Node: Control Letters295695 -Node: Format Modifiers300859 -Node: Printf Examples306874 -Node: Redirection309360 -Node: Special FD316201 -Ref: Special FD-Footnote-1319369 -Node: Special Files319443 -Node: Other Inherited Files320060 -Node: Special Network321061 -Node: Special Caveats321921 -Node: Close Files And Pipes322870 -Ref: table-close-pipe-return-values329777 -Ref: Close Files And Pipes-Footnote-1330590 -Ref: Close Files And Pipes-Footnote-2330738 -Node: Nonfatal330890 -Node: Output Summary333228 -Node: Output Exercises334450 -Node: Expressions335129 -Node: Values336317 -Node: Constants336995 -Node: Scalar Constants337686 -Ref: Scalar Constants-Footnote-1340210 -Node: Nondecimal-numbers340460 -Node: Regexp Constants343461 -Node: Using Constant Regexps343987 -Node: Standard Regexp Constants344609 -Node: Strong Regexp Constants347797 -Node: Variables350755 -Node: Using Variables351412 -Node: Assignment Options353322 -Node: Conversion355789 -Node: Strings And Numbers356313 -Ref: Strings And Numbers-Footnote-1359376 -Node: Locale influences conversions359485 -Ref: table-locale-affects362243 -Node: All Operators362861 -Node: Arithmetic Ops363490 -Node: Concatenation365996 -Ref: Concatenation-Footnote-1368843 -Node: Assignment Ops368950 -Ref: table-assign-ops373941 -Node: Increment Ops375254 -Node: Truth Values and Conditions378714 -Node: Truth Values379788 -Node: Typing and Comparison380836 -Node: Variable Typing381656 -Ref: Variable Typing-Footnote-1388119 -Ref: Variable Typing-Footnote-2388191 -Node: Comparison Operators388268 -Ref: table-relational-ops388687 -Node: POSIX String Comparison392182 -Ref: POSIX String Comparison-Footnote-1393877 -Ref: POSIX String Comparison-Footnote-2394016 -Node: Boolean Ops394100 -Ref: Boolean Ops-Footnote-1398582 -Node: Conditional Exp398674 -Node: Function Calls400410 -Node: Precedence404287 -Node: Locales407946 -Node: Expressions Summary409578 -Node: Patterns and Actions412151 -Node: Pattern Overview413271 -Node: Regexp Patterns414948 -Node: Expression Patterns415490 -Node: Ranges419271 -Node: BEGIN/END422379 -Node: Using BEGIN/END423140 -Ref: Using BEGIN/END-Footnote-1425876 -Node: I/O And BEGIN/END425982 -Node: BEGINFILE/ENDFILE428296 -Node: Empty431209 -Node: Using Shell Variables431526 -Node: Action Overview433800 -Node: Statements436125 -Node: If Statement437973 -Node: While Statement439468 -Node: Do Statement441496 -Node: For Statement442644 -Node: Switch Statement445815 -Node: Break Statement448201 -Node: Continue Statement450293 -Node: Next Statement452120 -Node: Nextfile Statement454503 -Node: Exit Statement457155 -Node: Built-in Variables459558 -Node: User-modified460691 -Node: Auto-set468458 -Ref: Auto-set-Footnote-1485265 -Ref: Auto-set-Footnote-2485471 -Node: ARGC and ARGV485527 -Node: Pattern Action Summary489740 -Node: Arrays492170 -Node: Array Basics493499 -Node: Array Intro494343 -Ref: figure-array-elements496318 -Ref: Array Intro-Footnote-1499022 -Node: Reference to Elements499150 -Node: Assigning Elements501614 -Node: Array Example502105 -Node: Scanning an Array503864 -Node: Controlling Scanning506886 -Ref: Controlling Scanning-Footnote-1512285 -Node: Numeric Array Subscripts512601 -Node: Uninitialized Subscripts514785 -Node: Delete516404 -Ref: Delete-Footnote-1519156 -Node: Multidimensional519213 -Node: Multiscanning522308 -Node: Arrays of Arrays523899 -Node: Arrays Summary528667 -Node: Functions530760 -Node: Built-in531798 -Node: Calling Built-in532879 -Node: Numeric Functions534875 -Ref: Numeric Functions-Footnote-1538903 -Ref: Numeric Functions-Footnote-2539548 -Ref: Numeric Functions-Footnote-3539596 -Node: String Functions539868 -Ref: String Functions-Footnote-1563726 -Ref: String Functions-Footnote-2563854 -Ref: String Functions-Footnote-3564102 -Node: Gory Details564189 -Ref: table-sub-escapes565980 -Ref: table-sub-proposed567499 -Ref: table-posix-sub568862 -Ref: table-gensub-escapes570403 -Ref: Gory Details-Footnote-1571226 -Node: I/O Functions571380 -Ref: table-system-return-values577848 -Ref: I/O Functions-Footnote-1579928 -Ref: I/O Functions-Footnote-2580076 -Node: Time Functions580196 -Ref: Time Functions-Footnote-1590867 -Ref: Time Functions-Footnote-2590935 -Ref: Time Functions-Footnote-3591093 -Ref: Time Functions-Footnote-4591204 -Ref: Time Functions-Footnote-5591316 -Ref: Time Functions-Footnote-6591543 -Node: Bitwise Functions591809 -Ref: table-bitwise-ops592403 -Ref: Bitwise Functions-Footnote-1598466 -Ref: Bitwise Functions-Footnote-2598639 -Node: Type Functions598830 -Node: I18N Functions601581 -Node: User-defined603232 -Node: Definition Syntax604044 -Ref: Definition Syntax-Footnote-1609731 -Node: Function Example609802 -Ref: Function Example-Footnote-1612724 -Node: Function Calling612746 -Node: Calling A Function613334 -Node: Variable Scope614292 -Node: Pass By Value/Reference617286 -Node: Function Caveats619930 -Ref: Function Caveats-Footnote-1621977 -Node: Return Statement622097 -Node: Dynamic Typing625076 -Node: Indirect Calls626006 -Ref: Indirect Calls-Footnote-1636258 -Node: Functions Summary636386 -Node: Library Functions639091 -Ref: Library Functions-Footnote-1642698 -Ref: Library Functions-Footnote-2642841 -Node: Library Names643012 -Ref: Library Names-Footnote-1646679 -Ref: Library Names-Footnote-2646902 -Node: General Functions646988 -Node: Strtonum Function648091 -Node: Assert Function651113 -Node: Round Function654439 -Node: Cliff Random Function655979 -Node: Ordinal Functions656995 -Ref: Ordinal Functions-Footnote-1660058 -Ref: Ordinal Functions-Footnote-2660310 -Node: Join Function660520 -Ref: Join Function-Footnote-1662290 -Node: Getlocaltime Function662490 -Node: Readfile Function666232 -Node: Shell Quoting668209 -Node: Data File Management669610 -Node: Filetrans Function670242 -Node: Rewind Function674338 -Node: File Checking676247 -Ref: File Checking-Footnote-1677581 -Node: Empty Files677782 -Node: Ignoring Assigns679761 -Node: Getopt Function681311 -Ref: Getopt Function-Footnote-1692780 -Node: Passwd Functions692980 -Ref: Passwd Functions-Footnote-1701819 -Node: Group Functions701907 -Ref: Group Functions-Footnote-1709805 -Node: Walking Arrays710012 -Node: Library Functions Summary713020 -Node: Library Exercises714426 -Node: Sample Programs714891 -Node: Running Examples715661 -Node: Clones716389 -Node: Cut Program717613 -Node: Egrep Program727542 -Ref: Egrep Program-Footnote-1735054 -Node: Id Program735164 -Node: Split Program738844 -Ref: Split Program-Footnote-1742302 -Node: Tee Program742431 -Node: Uniq Program745221 -Node: Wc Program752842 -Ref: Wc Program-Footnote-1757097 -Node: Miscellaneous Programs757191 -Node: Dupword Program758404 -Node: Alarm Program760434 -Node: Translate Program765289 -Ref: Translate Program-Footnote-1769854 -Node: Labels Program770124 -Ref: Labels Program-Footnote-1773475 -Node: Word Sorting773559 -Node: History Sorting777631 -Node: Extract Program779466 -Node: Simple Sed787520 -Node: Igawk Program790594 -Ref: Igawk Program-Footnote-1804925 -Ref: Igawk Program-Footnote-2805127 -Ref: Igawk Program-Footnote-3805249 -Node: Anagram Program805364 -Node: Signature Program808426 -Node: Programs Summary809673 -Node: Programs Exercises810887 -Ref: Programs Exercises-Footnote-1815016 -Node: Advanced Features815107 -Node: Nondecimal Data817097 -Node: Array Sorting818688 -Node: Controlling Array Traversal819388 -Ref: Controlling Array Traversal-Footnote-1827756 -Node: Array Sorting Functions827874 -Ref: Array Sorting Functions-Footnote-1832965 -Node: Two-way I/O833161 -Ref: Two-way I/O-Footnote-1840882 -Ref: Two-way I/O-Footnote-2841069 -Node: TCP/IP Networking841151 -Node: Profiling844269 -Node: Advanced Features Summary853287 -Node: Internationalization855131 -Node: I18N and L10N856611 -Node: Explaining gettext857298 -Ref: Explaining gettext-Footnote-1863190 -Ref: Explaining gettext-Footnote-2863375 -Node: Programmer i18n863540 -Ref: Programmer i18n-Footnote-1868489 -Node: Translator i18n868538 -Node: String Extraction869332 -Ref: String Extraction-Footnote-1870464 -Node: Printf Ordering870550 -Ref: Printf Ordering-Footnote-1873336 -Node: I18N Portability873400 -Ref: I18N Portability-Footnote-1875856 -Node: I18N Example875919 -Ref: I18N Example-Footnote-1879194 -Ref: I18N Example-Footnote-2879267 -Node: Gawk I18N879376 -Node: I18N Summary880025 -Node: Debugger881366 -Node: Debugging882366 -Node: Debugging Concepts882807 -Node: Debugging Terms884616 -Node: Awk Debugging887191 -Ref: Awk Debugging-Footnote-1888136 -Node: Sample Debugging Session888268 -Node: Debugger Invocation888802 -Node: Finding The Bug890188 -Node: List of Debugger Commands896662 -Node: Breakpoint Control897995 -Node: Debugger Execution Control901689 -Node: Viewing And Changing Data905051 -Node: Execution Stack908592 -Node: Debugger Info910229 -Node: Miscellaneous Debugger Commands914300 -Node: Readline Support919362 -Node: Limitations920258 -Node: Debugging Summary922812 -Node: Namespaces924091 -Node: Global Namespace925170 -Node: Qualified Names926568 -Node: Default Namespace927567 -Node: Changing The Namespace928308 -Node: Naming Rules929922 -Node: Internal Name Management931770 -Node: Namespace Example932812 -Node: Namespace And Features935374 -Node: Namespace Summary936809 -Node: Arbitrary Precision Arithmetic938286 -Node: Computer Arithmetic939773 -Ref: table-numeric-ranges943539 -Ref: table-floating-point-ranges944032 -Ref: Computer Arithmetic-Footnote-1944690 -Node: Math Definitions944747 -Ref: table-ieee-formats948063 -Ref: Math Definitions-Footnote-1948666 -Node: MPFR features948771 -Node: FP Math Caution950489 -Ref: FP Math Caution-Footnote-1951561 -Node: Inexactness of computations951930 -Node: Inexact representation952890 -Node: Comparing FP Values954250 -Node: Errors accumulate955491 -Node: Getting Accuracy956924 -Node: Try To Round959634 -Node: Setting precision960533 -Ref: table-predefined-precision-strings961230 -Node: Setting the rounding mode963060 -Ref: table-gawk-rounding-modes963434 -Ref: Setting the rounding mode-Footnote-1967365 -Node: Arbitrary Precision Integers967544 -Ref: Arbitrary Precision Integers-Footnote-1970719 -Node: Checking for MPFR970868 -Node: POSIX Floating Point Problems972342 -Ref: POSIX Floating Point Problems-Footnote-1976627 -Node: Floating point summary976665 -Node: Dynamic Extensions978855 -Node: Extension Intro980408 -Node: Plugin License981674 -Node: Extension Mechanism Outline982471 -Ref: figure-load-extension982910 -Ref: figure-register-new-function984475 -Ref: figure-call-new-function985567 -Node: Extension API Description987629 -Node: Extension API Functions Introduction989271 -Ref: table-api-std-headers991107 -Node: General Data Types994972 -Ref: General Data Types-Footnote-11003333 -Node: Memory Allocation Functions1003632 -Ref: Memory Allocation Functions-Footnote-11007842 -Node: Constructor Functions1007941 -Node: Registration Functions1011527 -Node: Extension Functions1012212 -Node: Exit Callback Functions1017534 -Node: Extension Version String1018784 -Node: Input Parsers1019447 -Node: Output Wrappers1032168 -Node: Two-way processors1036680 -Node: Printing Messages1038945 -Ref: Printing Messages-Footnote-11040116 -Node: Updating ERRNO1040269 -Node: Requesting Values1041008 -Ref: table-value-types-returned1041745 -Node: Accessing Parameters1042681 -Node: Symbol Table Access1043916 -Node: Symbol table by name1044428 -Ref: Symbol table by name-Footnote-11047452 -Node: Symbol table by cookie1047580 -Ref: Symbol table by cookie-Footnote-11051765 -Node: Cached values1051829 -Ref: Cached values-Footnote-11055365 -Node: Array Manipulation1055518 -Ref: Array Manipulation-Footnote-11056609 -Node: Array Data Types1056646 -Ref: Array Data Types-Footnote-11059304 -Node: Array Functions1059396 -Node: Flattening Arrays1063894 -Node: Creating Arrays1070870 -Node: Redirection API1075637 -Node: Extension API Variables1078470 -Node: Extension Versioning1079181 -Ref: gawk-api-version1079610 -Node: Extension GMP/MPFR Versioning1081341 -Node: Extension API Informational Variables1082969 -Node: Extension API Boilerplate1084042 -Node: Changes from API V11088016 -Node: Finding Extensions1089588 -Node: Extension Example1090147 -Node: Internal File Description1090945 -Node: Internal File Ops1095025 -Ref: Internal File Ops-Footnote-11106375 -Node: Using Internal File Ops1106515 -Ref: Using Internal File Ops-Footnote-11108898 -Node: Extension Samples1109172 -Node: Extension Sample File Functions1110701 -Node: Extension Sample Fnmatch1118350 -Node: Extension Sample Fork1119837 -Node: Extension Sample Inplace1121055 -Node: Extension Sample Ord1124359 -Node: Extension Sample Readdir1125195 -Ref: table-readdir-file-types1126084 -Node: Extension Sample Revout1126889 -Node: Extension Sample Rev2way1127478 -Node: Extension Sample Read write array1128218 -Node: Extension Sample Readfile1130160 -Node: Extension Sample Time1131255 -Node: Extension Sample API Tests1132603 -Node: gawkextlib1133095 -Node: Extension summary1136013 -Node: Extension Exercises1139715 -Node: Language History1140957 -Node: V7/SVR3.11142613 -Node: SVR41144765 -Node: POSIX1146199 -Node: BTL1147579 -Node: POSIX/GNU1148308 -Node: Feature History1154086 -Node: Common Extensions1170132 -Node: Ranges and Locales1171415 -Ref: Ranges and Locales-Footnote-11176031 -Ref: Ranges and Locales-Footnote-21176058 -Ref: Ranges and Locales-Footnote-31176293 -Node: Contributors1176514 -Node: History summary1182459 -Node: Installation1183839 -Node: Gawk Distribution1184783 -Node: Getting1185267 -Node: Extracting1186230 -Node: Distribution contents1187868 -Node: Unix Installation1194348 -Node: Quick Installation1195030 -Node: Shell Startup Files1197444 -Node: Additional Configuration Options1198533 -Node: Configuration Philosophy1200698 -Node: Non-Unix Installation1203067 -Node: PC Installation1203527 -Node: PC Binary Installation1204365 -Node: PC Compiling1204800 -Node: PC Using1205917 -Node: Cygwin1209470 -Node: MSYS1210569 -Node: VMS Installation1211070 -Node: VMS Compilation1211861 -Ref: VMS Compilation-Footnote-11213090 -Node: VMS Dynamic Extensions1213148 -Node: VMS Installation Details1214833 -Node: VMS Running1217086 -Node: VMS GNV1221365 -Node: VMS Old Gawk1222100 -Node: Bugs1222571 -Node: Bug address1223234 -Node: Usenet1226216 -Node: Maintainers1227220 -Node: Other Versions1228481 -Node: Installation summary1235395 -Node: Notes1236597 -Node: Compatibility Mode1237391 -Node: Additions1238173 -Node: Accessing The Source1239098 -Node: Adding Code1240535 -Node: New Ports1246754 -Node: Derived Files1251129 -Ref: Derived Files-Footnote-11256789 -Ref: Derived Files-Footnote-21256824 -Ref: Derived Files-Footnote-31257422 -Node: Future Extensions1257536 -Node: Implementation Limitations1258194 -Node: Extension Design1259377 -Node: Old Extension Problems1260521 -Ref: Old Extension Problems-Footnote-11262039 -Node: Extension New Mechanism Goals1262096 -Ref: Extension New Mechanism Goals-Footnote-11265460 -Node: Extension Other Design Decisions1265649 -Node: Extension Future Growth1267762 -Node: Notes summary1268598 -Node: Basic Concepts1269756 -Node: Basic High Level1270437 -Ref: figure-general-flow1270719 -Ref: figure-process-flow1271404 -Ref: Basic High Level-Footnote-11274705 -Node: Basic Data Typing1274890 -Node: Glossary1278218 -Node: Copying1310056 -Node: GNU Free Documentation License1347599 -Node: Index1372719 +Node: Getline255311 +Node: Plain Getline257780 +Node: Getline/Variable260421 +Node: Getline/File261572 +Node: Getline/Variable/File262960 +Ref: Getline/Variable/File-Footnote-1264565 +Node: Getline/Pipe264653 +Node: Getline/Variable/Pipe267360 +Node: Getline/Coprocess268495 +Node: Getline/Variable/Coprocess269762 +Node: Getline Notes270504 +Node: Getline Summary273301 +Ref: table-getline-variants273725 +Node: Read Timeout274473 +Ref: Read Timeout-Footnote-1278379 +Node: Retrying Input278437 +Node: Command-line directories279636 +Node: Input Summary280542 +Node: Input Exercises283714 +Node: Printing284442 +Node: Print286276 +Node: Print Examples287733 +Node: Output Separators290513 +Node: OFMT292530 +Node: Printf293886 +Node: Basic Printf294671 +Node: Control Letters296245 +Node: Format Modifiers301409 +Node: Printf Examples307424 +Node: Redirection309910 +Node: Special FD316751 +Ref: Special FD-Footnote-1319919 +Node: Special Files319993 +Node: Other Inherited Files320610 +Node: Special Network321611 +Node: Special Caveats322471 +Node: Close Files And Pipes323420 +Ref: table-close-pipe-return-values330327 +Ref: Close Files And Pipes-Footnote-1331140 +Ref: Close Files And Pipes-Footnote-2331288 +Node: Nonfatal331440 +Node: Output Summary333778 +Node: Output Exercises335000 +Node: Expressions335679 +Node: Values336867 +Node: Constants337545 +Node: Scalar Constants338236 +Ref: Scalar Constants-Footnote-1340760 +Node: Nondecimal-numbers341010 +Node: Regexp Constants344011 +Node: Using Constant Regexps344537 +Node: Standard Regexp Constants345159 +Node: Strong Regexp Constants348347 +Node: Variables351305 +Node: Using Variables351962 +Node: Assignment Options353872 +Node: Conversion356339 +Node: Strings And Numbers356863 +Ref: Strings And Numbers-Footnote-1359926 +Node: Locale influences conversions360035 +Ref: table-locale-affects362793 +Node: All Operators363411 +Node: Arithmetic Ops364040 +Node: Concatenation366546 +Ref: Concatenation-Footnote-1369393 +Node: Assignment Ops369500 +Ref: table-assign-ops374491 +Node: Increment Ops375804 +Node: Truth Values and Conditions379264 +Node: Truth Values380338 +Node: Typing and Comparison381386 +Node: Variable Typing382206 +Ref: Variable Typing-Footnote-1388669 +Ref: Variable Typing-Footnote-2388741 +Node: Comparison Operators388818 +Ref: table-relational-ops389237 +Node: POSIX String Comparison392732 +Ref: POSIX String Comparison-Footnote-1394427 +Ref: POSIX String Comparison-Footnote-2394566 +Node: Boolean Ops394650 +Ref: Boolean Ops-Footnote-1399132 +Node: Conditional Exp399224 +Node: Function Calls400960 +Node: Precedence404837 +Node: Locales408496 +Node: Expressions Summary410128 +Node: Patterns and Actions412701 +Node: Pattern Overview413821 +Node: Regexp Patterns415498 +Node: Expression Patterns416040 +Node: Ranges419821 +Node: BEGIN/END422929 +Node: Using BEGIN/END423690 +Ref: Using BEGIN/END-Footnote-1426426 +Node: I/O And BEGIN/END426532 +Node: BEGINFILE/ENDFILE428846 +Node: Empty431759 +Node: Using Shell Variables432076 +Node: Action Overview434350 +Node: Statements436675 +Node: If Statement438523 +Node: While Statement440018 +Node: Do Statement442046 +Node: For Statement443194 +Node: Switch Statement446365 +Node: Break Statement448751 +Node: Continue Statement450843 +Node: Next Statement452670 +Node: Nextfile Statement455053 +Node: Exit Statement457705 +Node: Built-in Variables460108 +Node: User-modified461241 +Node: Auto-set469008 +Ref: Auto-set-Footnote-1485815 +Ref: Auto-set-Footnote-2486021 +Node: ARGC and ARGV486077 +Node: Pattern Action Summary490290 +Node: Arrays492720 +Node: Array Basics494049 +Node: Array Intro494893 +Ref: figure-array-elements496868 +Ref: Array Intro-Footnote-1499572 +Node: Reference to Elements499700 +Node: Assigning Elements502164 +Node: Array Example502655 +Node: Scanning an Array504414 +Node: Controlling Scanning507436 +Ref: Controlling Scanning-Footnote-1512835 +Node: Numeric Array Subscripts513151 +Node: Uninitialized Subscripts515335 +Node: Delete516954 +Ref: Delete-Footnote-1519706 +Node: Multidimensional519763 +Node: Multiscanning522858 +Node: Arrays of Arrays524449 +Node: Arrays Summary529217 +Node: Functions531310 +Node: Built-in532348 +Node: Calling Built-in533429 +Node: Numeric Functions535425 +Ref: Numeric Functions-Footnote-1539453 +Ref: Numeric Functions-Footnote-2540098 +Ref: Numeric Functions-Footnote-3540146 +Node: String Functions540418 +Ref: String Functions-Footnote-1564276 +Ref: String Functions-Footnote-2564404 +Ref: String Functions-Footnote-3564652 +Node: Gory Details564739 +Ref: table-sub-escapes566530 +Ref: table-sub-proposed568049 +Ref: table-posix-sub569412 +Ref: table-gensub-escapes570953 +Ref: Gory Details-Footnote-1571776 +Node: I/O Functions571930 +Ref: table-system-return-values578398 +Ref: I/O Functions-Footnote-1580478 +Ref: I/O Functions-Footnote-2580626 +Node: Time Functions580746 +Ref: Time Functions-Footnote-1591417 +Ref: Time Functions-Footnote-2591485 +Ref: Time Functions-Footnote-3591643 +Ref: Time Functions-Footnote-4591754 +Ref: Time Functions-Footnote-5591866 +Ref: Time Functions-Footnote-6592093 +Node: Bitwise Functions592359 +Ref: table-bitwise-ops592953 +Ref: Bitwise Functions-Footnote-1599016 +Ref: Bitwise Functions-Footnote-2599189 +Node: Type Functions599380 +Node: I18N Functions602131 +Node: User-defined603782 +Node: Definition Syntax604594 +Ref: Definition Syntax-Footnote-1610281 +Node: Function Example610352 +Ref: Function Example-Footnote-1613274 +Node: Function Calling613296 +Node: Calling A Function613884 +Node: Variable Scope614842 +Node: Pass By Value/Reference617836 +Node: Function Caveats620480 +Ref: Function Caveats-Footnote-1622527 +Node: Return Statement622647 +Node: Dynamic Typing625626 +Node: Indirect Calls626556 +Ref: Indirect Calls-Footnote-1636808 +Node: Functions Summary636936 +Node: Library Functions639641 +Ref: Library Functions-Footnote-1643248 +Ref: Library Functions-Footnote-2643391 +Node: Library Names643562 +Ref: Library Names-Footnote-1647229 +Ref: Library Names-Footnote-2647452 +Node: General Functions647538 +Node: Strtonum Function648641 +Node: Assert Function651663 +Node: Round Function654989 +Node: Cliff Random Function656529 +Node: Ordinal Functions657545 +Ref: Ordinal Functions-Footnote-1660608 +Ref: Ordinal Functions-Footnote-2660860 +Node: Join Function661070 +Ref: Join Function-Footnote-1662840 +Node: Getlocaltime Function663040 +Node: Readfile Function666782 +Node: Shell Quoting668759 +Node: Data File Management670160 +Node: Filetrans Function670792 +Node: Rewind Function674888 +Node: File Checking676797 +Ref: File Checking-Footnote-1678131 +Node: Empty Files678332 +Node: Ignoring Assigns680311 +Node: Getopt Function681861 +Ref: Getopt Function-Footnote-1693330 +Node: Passwd Functions693530 +Ref: Passwd Functions-Footnote-1702369 +Node: Group Functions702457 +Ref: Group Functions-Footnote-1710355 +Node: Walking Arrays710562 +Node: Library Functions Summary713570 +Node: Library Exercises714976 +Node: Sample Programs715441 +Node: Running Examples716211 +Node: Clones716939 +Node: Cut Program718163 +Node: Egrep Program728092 +Ref: Egrep Program-Footnote-1735604 +Node: Id Program735714 +Node: Split Program739394 +Ref: Split Program-Footnote-1742852 +Node: Tee Program742981 +Node: Uniq Program745771 +Node: Wc Program753392 +Ref: Wc Program-Footnote-1757647 +Node: Miscellaneous Programs757741 +Node: Dupword Program758954 +Node: Alarm Program760984 +Node: Translate Program765839 +Ref: Translate Program-Footnote-1770404 +Node: Labels Program770674 +Ref: Labels Program-Footnote-1774025 +Node: Word Sorting774109 +Node: History Sorting778181 +Node: Extract Program780016 +Node: Simple Sed788070 +Node: Igawk Program791144 +Ref: Igawk Program-Footnote-1805475 +Ref: Igawk Program-Footnote-2805677 +Ref: Igawk Program-Footnote-3805799 +Node: Anagram Program805914 +Node: Signature Program808976 +Node: Programs Summary810223 +Node: Programs Exercises811437 +Ref: Programs Exercises-Footnote-1815566 +Node: Advanced Features815657 +Node: Nondecimal Data817647 +Node: Array Sorting819238 +Node: Controlling Array Traversal819938 +Ref: Controlling Array Traversal-Footnote-1828306 +Node: Array Sorting Functions828424 +Ref: Array Sorting Functions-Footnote-1833515 +Node: Two-way I/O833711 +Ref: Two-way I/O-Footnote-1841432 +Ref: Two-way I/O-Footnote-2841619 +Node: TCP/IP Networking841701 +Node: Profiling844819 +Node: Advanced Features Summary853837 +Node: Internationalization855681 +Node: I18N and L10N857161 +Node: Explaining gettext857848 +Ref: Explaining gettext-Footnote-1863740 +Ref: Explaining gettext-Footnote-2863925 +Node: Programmer i18n864090 +Ref: Programmer i18n-Footnote-1869039 +Node: Translator i18n869088 +Node: String Extraction869882 +Ref: String Extraction-Footnote-1871014 +Node: Printf Ordering871100 +Ref: Printf Ordering-Footnote-1873886 +Node: I18N Portability873950 +Ref: I18N Portability-Footnote-1876406 +Node: I18N Example876469 +Ref: I18N Example-Footnote-1879744 +Ref: I18N Example-Footnote-2879817 +Node: Gawk I18N879926 +Node: I18N Summary880575 +Node: Debugger881916 +Node: Debugging882916 +Node: Debugging Concepts883357 +Node: Debugging Terms885166 +Node: Awk Debugging887741 +Ref: Awk Debugging-Footnote-1888686 +Node: Sample Debugging Session888818 +Node: Debugger Invocation889352 +Node: Finding The Bug890738 +Node: List of Debugger Commands897212 +Node: Breakpoint Control898545 +Node: Debugger Execution Control902239 +Node: Viewing And Changing Data905601 +Node: Execution Stack909142 +Node: Debugger Info910779 +Node: Miscellaneous Debugger Commands914850 +Node: Readline Support919912 +Node: Limitations920808 +Node: Debugging Summary923362 +Node: Namespaces924641 +Node: Global Namespace925720 +Node: Qualified Names927118 +Node: Default Namespace928117 +Node: Changing The Namespace928858 +Node: Naming Rules930472 +Node: Internal Name Management932320 +Node: Namespace Example933362 +Node: Namespace And Features935924 +Node: Namespace Summary937359 +Node: Arbitrary Precision Arithmetic938836 +Node: Computer Arithmetic940323 +Ref: table-numeric-ranges944089 +Ref: table-floating-point-ranges944582 +Ref: Computer Arithmetic-Footnote-1945240 +Node: Math Definitions945297 +Ref: table-ieee-formats948613 +Ref: Math Definitions-Footnote-1949216 +Node: MPFR features949321 +Node: FP Math Caution951039 +Ref: FP Math Caution-Footnote-1952111 +Node: Inexactness of computations952480 +Node: Inexact representation953440 +Node: Comparing FP Values954800 +Node: Errors accumulate956041 +Node: Getting Accuracy957474 +Node: Try To Round960184 +Node: Setting precision961083 +Ref: table-predefined-precision-strings961780 +Node: Setting the rounding mode963610 +Ref: table-gawk-rounding-modes963984 +Ref: Setting the rounding mode-Footnote-1967915 +Node: Arbitrary Precision Integers968094 +Ref: Arbitrary Precision Integers-Footnote-1971269 +Node: Checking for MPFR971418 +Node: POSIX Floating Point Problems972892 +Ref: POSIX Floating Point Problems-Footnote-1977177 +Node: Floating point summary977215 +Node: Dynamic Extensions979405 +Node: Extension Intro980958 +Node: Plugin License982224 +Node: Extension Mechanism Outline983021 +Ref: figure-load-extension983460 +Ref: figure-register-new-function985025 +Ref: figure-call-new-function986117 +Node: Extension API Description988179 +Node: Extension API Functions Introduction989821 +Ref: table-api-std-headers991657 +Node: General Data Types995522 +Ref: General Data Types-Footnote-11003883 +Node: Memory Allocation Functions1004182 +Ref: Memory Allocation Functions-Footnote-11008392 +Node: Constructor Functions1008491 +Node: Registration Functions1012077 +Node: Extension Functions1012762 +Node: Exit Callback Functions1018084 +Node: Extension Version String1019334 +Node: Input Parsers1019997 +Node: Output Wrappers1032718 +Node: Two-way processors1037230 +Node: Printing Messages1039495 +Ref: Printing Messages-Footnote-11040666 +Node: Updating ERRNO1040819 +Node: Requesting Values1041558 +Ref: table-value-types-returned1042295 +Node: Accessing Parameters1043231 +Node: Symbol Table Access1044466 +Node: Symbol table by name1044978 +Ref: Symbol table by name-Footnote-11048002 +Node: Symbol table by cookie1048130 +Ref: Symbol table by cookie-Footnote-11052315 +Node: Cached values1052379 +Ref: Cached values-Footnote-11055915 +Node: Array Manipulation1056068 +Ref: Array Manipulation-Footnote-11057159 +Node: Array Data Types1057196 +Ref: Array Data Types-Footnote-11059854 +Node: Array Functions1059946 +Node: Flattening Arrays1064444 +Node: Creating Arrays1071420 +Node: Redirection API1076187 +Node: Extension API Variables1079020 +Node: Extension Versioning1079731 +Ref: gawk-api-version1080160 +Node: Extension GMP/MPFR Versioning1081891 +Node: Extension API Informational Variables1083519 +Node: Extension API Boilerplate1084592 +Node: Changes from API V11088566 +Node: Finding Extensions1090138 +Node: Extension Example1090697 +Node: Internal File Description1091495 +Node: Internal File Ops1095575 +Ref: Internal File Ops-Footnote-11106925 +Node: Using Internal File Ops1107065 +Ref: Using Internal File Ops-Footnote-11109448 +Node: Extension Samples1109722 +Node: Extension Sample File Functions1111251 +Node: Extension Sample Fnmatch1118900 +Node: Extension Sample Fork1120387 +Node: Extension Sample Inplace1121605 +Node: Extension Sample Ord1124909 +Node: Extension Sample Readdir1125745 +Ref: table-readdir-file-types1126634 +Node: Extension Sample Revout1127439 +Node: Extension Sample Rev2way1128028 +Node: Extension Sample Read write array1128768 +Node: Extension Sample Readfile1130710 +Node: Extension Sample Time1131805 +Node: Extension Sample API Tests1133153 +Node: gawkextlib1133645 +Node: Extension summary1136563 +Node: Extension Exercises1140265 +Node: Language History1141507 +Node: V7/SVR3.11143163 +Node: SVR41145315 +Node: POSIX1146749 +Node: BTL1148129 +Node: POSIX/GNU1148858 +Node: Feature History1154636 +Node: Common Extensions1170682 +Node: Ranges and Locales1171965 +Ref: Ranges and Locales-Footnote-11176581 +Ref: Ranges and Locales-Footnote-21176608 +Ref: Ranges and Locales-Footnote-31176843 +Node: Contributors1177064 +Node: History summary1183009 +Node: Installation1184389 +Node: Gawk Distribution1185333 +Node: Getting1185817 +Node: Extracting1186780 +Node: Distribution contents1188418 +Node: Unix Installation1194898 +Node: Quick Installation1195580 +Node: Shell Startup Files1197994 +Node: Additional Configuration Options1199083 +Node: Configuration Philosophy1201248 +Node: Non-Unix Installation1203617 +Node: PC Installation1204077 +Node: PC Binary Installation1204915 +Node: PC Compiling1205350 +Node: PC Using1206467 +Node: Cygwin1210020 +Node: MSYS1211119 +Node: VMS Installation1211620 +Node: VMS Compilation1212411 +Ref: VMS Compilation-Footnote-11213640 +Node: VMS Dynamic Extensions1213698 +Node: VMS Installation Details1215383 +Node: VMS Running1217636 +Node: VMS GNV1221915 +Node: VMS Old Gawk1222650 +Node: Bugs1223121 +Node: Bug address1223784 +Node: Usenet1226766 +Node: Maintainers1227770 +Node: Other Versions1229031 +Node: Installation summary1235945 +Node: Notes1237147 +Node: Compatibility Mode1237941 +Node: Additions1238723 +Node: Accessing The Source1239648 +Node: Adding Code1241085 +Node: New Ports1247304 +Node: Derived Files1251679 +Ref: Derived Files-Footnote-11257339 +Ref: Derived Files-Footnote-21257374 +Ref: Derived Files-Footnote-31257972 +Node: Future Extensions1258086 +Node: Implementation Limitations1258744 +Node: Extension Design1259927 +Node: Old Extension Problems1261071 +Ref: Old Extension Problems-Footnote-11262589 +Node: Extension New Mechanism Goals1262646 +Ref: Extension New Mechanism Goals-Footnote-11266010 +Node: Extension Other Design Decisions1266199 +Node: Extension Future Growth1268312 +Node: Notes summary1269148 +Node: Basic Concepts1270306 +Node: Basic High Level1270987 +Ref: figure-general-flow1271269 +Ref: figure-process-flow1271954 +Ref: Basic High Level-Footnote-11275255 +Node: Basic Data Typing1275440 +Node: Glossary1278768 +Node: Copying1310606 +Node: GNU Free Documentation License1348149 +Node: Index1373269  End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index dd7389b8..21670d57 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -8302,10 +8302,20 @@ as the result of a special feature. When @code{RS} is set to the empty string @emph{and} @code{FS} is set to a single character, the newline character @emph{always} acts as a field separator. This is in addition to whatever field separations result from -@code{FS}.@footnote{When @code{FS} is the null string (@code{""}) +@code{FS}. + +@quotation NOTE +When @code{FS} is the null string (@code{""}) or a regexp, this special feature of @code{RS} does not apply. It does apply to the default field separator of a single space: -@samp{FS = @w{" "}}.} +@samp{FS = @w{" "}}. + +Note that language in the POSIX specification implies that +this special feature should apply when @code{FS} is a regexp. +However, Unix @command{awk} has never behaved that way, nor has +@command{gawk}. This is essentially a bug in POSIX. +@c Noted as of 4/2019; working to get the standard fixed. +@end NOTE The original motivation for this special exception was probably to provide useful behavior in the default case (i.e., @code{FS} is equal diff --git a/doc/gawktexi.in b/doc/gawktexi.in index 6b17f5ea..e986d033 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -7900,10 +7900,20 @@ as the result of a special feature. When @code{RS} is set to the empty string @emph{and} @code{FS} is set to a single character, the newline character @emph{always} acts as a field separator. This is in addition to whatever field separations result from -@code{FS}.@footnote{When @code{FS} is the null string (@code{""}) +@code{FS}. + +@quotation NOTE +When @code{FS} is the null string (@code{""}) or a regexp, this special feature of @code{RS} does not apply. It does apply to the default field separator of a single space: -@samp{FS = @w{" "}}.} +@samp{FS = @w{" "}}. + +Note that language in the POSIX specification implies that +this special feature should apply when @code{FS} is a regexp. +However, Unix @command{awk} has never behaved that way, nor has +@command{gawk}. This is essentially a bug in POSIX. +@c Noted as of 4/2019; working to get the standard fixed. +@end NOTE The original motivation for this special exception was probably to provide useful behavior in the default case (i.e., @code{FS} is equal -- cgit v1.2.3 From 847657fa4ec580658371d6fcaea547f7769fb569 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Sun, 21 Apr 2019 15:01:03 +0300 Subject: Fix bug with ^ in FS. --- ChangeLog | 3 +++ field.c | 1 + test/ChangeLog | 5 +++++ test/Makefile.am | 7 +++++-- test/Makefile.in | 12 ++++++++++-- test/Maketests | 5 +++++ test/fscaret.awk | 8 ++++++++ test/fscaret.in | 1 + test/fscaret.ok | 1 + 9 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 test/fscaret.awk create mode 100644 test/fscaret.in create mode 100644 test/fscaret.ok diff --git a/ChangeLog b/ChangeLog index e8b37e3e..8ca1e095 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ 2019-04-21 Arnold D. Robbins * POSIX.STD: Updated. + * field.c (get_field): If NF == -1, check parse high water to + set in_middle correctly. Thanks to + for the report. 2019-04-18 Arnold D. Robbins diff --git a/field.c b/field.c index d8bb52b7..6502b2fa 100644 --- a/field.c +++ b/field.c @@ -855,6 +855,7 @@ get_field(long requested, Func_ptr *assign) if (! field0_valid) { /* first, parse remainder of input record */ if (NF == -1) { + in_middle = (parse_high_water != 0); NF = (*parse_field)(UNLIMITED - 1, &parse_extent, fields_arr[0]->stlen - (parse_extent - fields_arr[0]->stptr), diff --git a/test/ChangeLog b/test/ChangeLog index a6398975..726ac262 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2019-04-21 Arnold D. Robbins + + * Makefile.am (EXTRA_DIST): New test: fscaret. + * fscaret.awk, fscaret.in, fscaret.ok: New files. + 2019-04-18 Arnold D. Robbins * Makefile.am (EXTRA_DIST): Add ChangeLog.1 to the list. Ooops. diff --git a/test/Makefile.am b/test/Makefile.am index 8c794d62..1ca9ba0c 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -367,6 +367,9 @@ EXTRA_DIST = \ fsbs.awk \ fsbs.in \ fsbs.ok \ + fscaret.awk \ + fscaret.in \ + fscaret.ok \ fsfwfs.awk \ fsfwfs.in \ fsfwfs.ok \ @@ -1289,8 +1292,8 @@ BASIC_TESTS = \ datanonl defref delargv delarpm2 delarprm delfunc dfamb1 dfastress dynlj \ eofsplit eofsrc1 exit2 exitval1 exitval2 exitval3 \ fcall_exit fcall_exit2 fldchg fldchgnf fldterm fnamedat fnarray fnarray2 \ - fnaryscl fnasgnm fnmisc fordel forref forsimp fsbs fsnul1 fsrs fsspcoln \ - fstabplus funsemnl funsmnam funstack \ + fnaryscl fnasgnm fnmisc fordel forref forsimp fsbs fscaret fsnul1 \ + fsrs fsspcoln fstabplus funsemnl funsmnam funstack \ getline getline2 getline3 getline4 getline5 getlnbuf getnr2tb getnr2tm \ gsubasgn gsubtest gsubtst2 gsubtst3 gsubtst4 gsubtst5 gsubtst6 gsubtst7 \ gsubtst8 \ diff --git a/test/Makefile.in b/test/Makefile.in index ee821c9a..5eb79abe 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -626,6 +626,9 @@ EXTRA_DIST = \ fsbs.awk \ fsbs.in \ fsbs.ok \ + fscaret.awk \ + fscaret.in \ + fscaret.ok \ fsfwfs.awk \ fsfwfs.in \ fsfwfs.ok \ @@ -1548,8 +1551,8 @@ BASIC_TESTS = \ datanonl defref delargv delarpm2 delarprm delfunc dfamb1 dfastress dynlj \ eofsplit eofsrc1 exit2 exitval1 exitval2 exitval3 \ fcall_exit fcall_exit2 fldchg fldchgnf fldterm fnamedat fnarray fnarray2 \ - fnaryscl fnasgnm fnmisc fordel forref forsimp fsbs fsnul1 fsrs fsspcoln \ - fstabplus funsemnl funsmnam funstack \ + fnaryscl fnasgnm fnmisc fordel forref forsimp fsbs fscaret fsnul1 \ + fsrs fsspcoln fstabplus funsemnl funsmnam funstack \ getline getline2 getline3 getline4 getline5 getlnbuf getnr2tb getnr2tm \ gsubasgn gsubtest gsubtst2 gsubtst3 gsubtst4 gsubtst5 gsubtst6 gsubtst7 \ gsubtst8 \ @@ -3101,6 +3104,11 @@ fsbs: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +fscaret: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + fsnul1: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/Maketests b/test/Maketests index dadba2ee..1de780ec 100644 --- a/test/Maketests +++ b/test/Maketests @@ -362,6 +362,11 @@ fsbs: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +fscaret: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + fsnul1: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/fscaret.awk b/test/fscaret.awk new file mode 100644 index 00000000..134820d7 --- /dev/null +++ b/test/fscaret.awk @@ -0,0 +1,8 @@ +BEGIN { + FS="^." + OFS="|" +} +{ + $1 = $1 +} +1 diff --git a/test/fscaret.in b/test/fscaret.in new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/test/fscaret.in @@ -0,0 +1 @@ +foo diff --git a/test/fscaret.ok b/test/fscaret.ok new file mode 100644 index 00000000..38287d58 --- /dev/null +++ b/test/fscaret.ok @@ -0,0 +1 @@ +|oo -- cgit v1.2.3