aboutsummaryrefslogtreecommitdiffstats
path: root/field.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2018-09-16 20:29:55 +0300
committerArnold D. Robbins <arnold@skeeve.com>2018-09-16 20:29:55 +0300
commit05a4e7931d2d75fe87a18f15484553b9aa62b545 (patch)
tree36031c19082b589628e2a6852979f665ce502394 /field.c
parent87848093635e0d4e647601fe788e024ee90e1be6 (diff)
downloadegawk-05a4e7931d2d75fe87a18f15484553b9aa62b545.tar.gz
egawk-05a4e7931d2d75fe87a18f15484553b9aa62b545.tar.bz2
egawk-05a4e7931d2d75fe87a18f15484553b9aa62b545.zip
Add lint warning for accessing $0 in an END rule.
Diffstat (limited to 'field.c')
-rw-r--r--field.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/field.c b/field.c
index 52963249..3bcfb421 100644
--- a/field.c
+++ b/field.c
@@ -837,6 +837,13 @@ get_field(long requested, Func_ptr *assign)
* then the whole line must be rebuilt
*/
if (requested == 0) {
+ static bool warned = false;
+ extern int currule;
+
+ if (do_lint && currule == END) {
+ 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) {