aboutsummaryrefslogtreecommitdiffstats
path: root/msg.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2013-10-24 22:03:09 +0300
committerArnold D. Robbins <arnold@skeeve.com>2013-10-24 22:03:09 +0300
commit25520aab6144927a20d501c0396e9597f36fc871 (patch)
tree1a8b237e152873b5a789f10865c11a5ed1e0c3cc /msg.c
parenteb152bbe507aef92ece4a301863263818fb50a04 (diff)
downloadegawk-25520aab6144927a20d501c0396e9597f36fc871.tar.gz
egawk-25520aab6144927a20d501c0396e9597f36fc871.tar.bz2
egawk-25520aab6144927a20d501c0396e9597f36fc871.zip
Improve handling of writes to dead pipes.
Diffstat (limited to 'msg.c')
-rw-r--r--msg.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/msg.c b/msg.c
index edacdd1c..16fef73a 100644
--- a/msg.c
+++ b/msg.c
@@ -44,15 +44,22 @@ err(bool isfatal, const char *s, const char *emsg, va_list argp)
char *file;
const char *me;
+ static bool first = true;
+ static bool add_src_info = false;
+
+ if (first) {
+ first = false;
+ add_src_info = (getenv("GAWK_MSG_SRC") != NULL);
+ }
+
(void) fflush(output_fp);
me = myname;
(void) fprintf(stderr, "%s: ", me);
-#ifdef GAWKDEBUG
- if (srcfile != NULL) {
+
+ if (srcfile != NULL && add_src_info) {
fprintf(stderr, "%s:%d:", srcfile, srcline);
srcfile = NULL;
}
-#endif /* GAWKDEBUG */
if (sourceline > 0) {
if (source != NULL)
@@ -109,10 +116,10 @@ msg(const char *mesg, ...)
va_end(args);
}
-/* warning --- print a warning message */
+/* r_warning --- print a warning message */
void
-warning(const char *mesg, ...)
+r_warning(const char *mesg, ...)
{
va_list args;
va_start(args, mesg);