aboutsummaryrefslogtreecommitdiffstats
path: root/msg.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2019-04-18 19:58:51 +0300
committerArnold D. Robbins <arnold@skeeve.com>2019-04-18 19:58:51 +0300
commit5e739d0e99d4833092dff655bc4e9d9e05046e74 (patch)
tree44a5f1258101fc8bb15c3442d5d419960784f6d4 /msg.c
parentc67cff427d7a0628786cac067f3d55e53892e5c8 (diff)
downloadegawk-5e739d0e99d4833092dff655bc4e9d9e05046e74.tar.gz
egawk-5e739d0e99d4833092dff655bc4e9d9e05046e74.tar.bz2
egawk-5e739d0e99d4833092dff655bc4e9d9e05046e74.zip
Add an easter egg in msg.c.
Diffstat (limited to 'msg.c')
-rw-r--r--msg.c9
1 files changed, 8 insertions, 1 deletions
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