diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2013-10-24 22:03:09 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2013-10-24 22:03:09 +0300 |
commit | 25520aab6144927a20d501c0396e9597f36fc871 (patch) | |
tree | 1a8b237e152873b5a789f10865c11a5ed1e0c3cc /msg.c | |
parent | eb152bbe507aef92ece4a301863263818fb50a04 (diff) | |
download | egawk-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.c | 17 |
1 files changed, 12 insertions, 5 deletions
@@ -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); |