aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xChangeLog7
-rw-r--r--builtin.c3
-rw-r--r--field.c15
3 files changed, 17 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 947abfba..119a42d8 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,13 @@
* NEWS: Fix typo in gettext version.
+ Unrelated:
+
+ * field.c (get_field): Move lint check for field access in an
+ END rule to top level, make wording more general.
+ * builtin.c (do_print_rec): Restore check before calling get_field()
+ and add do_lint to the condition.
+
2018-09-16 gettextize <bug-gnu-gettext@gnu.org>
* configure.ac (AM_GNU_GETTEXT_VERSION): Bump to 0.19.8.
diff --git a/builtin.c b/builtin.c
index 8247ca33..d7b2337e 100644
--- a/builtin.c
+++ b/builtin.c
@@ -2364,7 +2364,8 @@ do_print_rec(int nargs, int redirtype)
if (fp == NULL)
return;
- (void) get_field(0L, NULL); /* rebuild record if necessary */
+ if (! field0_valid || do_lint) // lint check for field access in END
+ (void) get_field(0L, NULL);
f0 = fields_arr[0];
diff --git a/field.c b/field.c
index 1c209c26..b7723aa5 100644
--- a/field.c
+++ b/field.c
@@ -832,18 +832,19 @@ NODE **
get_field(long requested, Func_ptr *assign)
{
bool in_middle = false;
+ static bool warned = false;
+ extern int currule;
+
+ if (do_lint && currule == END && ! warned) {
+ warned = true;
+ lintwarn(_("accessing fields from an END rule may not be portable"));
+ }
+
/*
* if requesting whole line but some other field has been altered,
* then the whole line must be rebuilt
*/
if (requested == 0) {
- static bool warned = false;
- extern int currule;
-
- if (do_lint && currule == END && ! warned) {
- warned = true;
- lintwarn(_("accessing $0 from an END rule may not be portable"));
- }
if (! field0_valid) {
/* first, parse remainder of input record */
if (NF == -1) {