aboutsummaryrefslogtreecommitdiffstats
path: root/msg.c
diff options
context:
space:
mode:
Diffstat (limited to 'msg.c')
-rw-r--r--msg.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/msg.c b/msg.c
index 16fef73a..12fc18f5 100644
--- a/msg.c
+++ b/msg.c
@@ -2,23 +2,23 @@
* msg.c - routines for error messages.
*/
-/*
+/*
* Copyright (C) 1986, 1988, 1989, 1991-2001, 2003, 2010-2013
* the Free Software Foundation, Inc.
- *
+ *
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
- *
+ *
* GAWK is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* GAWK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
@@ -76,19 +76,21 @@ err(bool isfatal, const char *s, const char *emsg, va_list argp)
val = mpg_update_var(FNR_node);
assert((val->flags & MPZN) != 0);
if (mpz_sgn(val->mpg_i) > 0) {
+ int len = FILENAME_node->var_value->stlen;
file = FILENAME_node->var_value->stptr;
(void) putc('(', stderr);
if (file)
- (void) fprintf(stderr, "FILENAME=%s ", file);
+ (void) fprintf(stderr, "FILENAME=%.*s ", len, file);
(void) mpfr_fprintf(stderr, "FNR=%Zd) ", val->mpg_i);
}
} else
#endif
if (FNR > 0) {
+ int len = FILENAME_node->var_value->stlen;
file = FILENAME_node->var_value->stptr;
(void) putc('(', stderr);
if (file)
- (void) fprintf(stderr, "FILENAME=%s ", file);
+ (void) fprintf(stderr, "FILENAME=%.*s ", len, file);
(void) fprintf(stderr, "FNR=%ld) ", FNR);
}