summaryrefslogtreecommitdiff
path: root/msg.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2010-07-16 12:49:45 +0300
committerArnold D. Robbins <arnold@skeeve.com>2010-07-16 12:49:45 +0300
commit6607eb3d5e40b98d2acc8f6b0d6a0b5a4b0f56bd (patch)
treec1eb39be8cc5c19101385e171ec0c58f95d521cc /msg.c
parent6719bb6e1c5576e857ab6fc121ec31a75161a3e7 (diff)
downloadgawk-6607eb3d5e40b98d2acc8f6b0d6a0b5a4b0f56bd.tar.gz
Move to gawk-3.0.3.gawk-3.0.3
Diffstat (limited to 'msg.c')
-rw-r--r--msg.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/msg.c b/msg.c
index 5bf3c2bc..82fa422e 100644
--- a/msg.c
+++ b/msg.c
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991-1996 the Free Software Foundation, Inc.
+ * Copyright (C) 1986, 1988, 1989, 1991-1997 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -28,6 +28,9 @@
int sourceline = 0;
char *source = NULL;
+static char *srcfile = NULL;
+static int srcline;
+
/* prototype needed for ansi / gcc */
void err P((const char *s, const char *emsg, va_list argp));
@@ -44,6 +47,12 @@ va_list argp;
(void) fflush(stdout);
(void) fprintf(stderr, "%s: ", myname);
+#ifdef DEBUG
+ if (srcfile != NULL) {
+ fprintf(stderr, "%s:%d:", srcfile, srcline);
+ srcfile = NULL;
+ }
+#endif /* DEBUG */
if (sourceline != 0) {
if (source != NULL)
(void) fprintf(stderr, "%s:", source);
@@ -138,15 +147,26 @@ va_dcl
va_end(args);
}
+/* set_loc --- set location where a fatal error happened */
+
+void
+set_loc(file, line)
+char *file;
+int line;
+{
+ srcfile = file;
+ srcline = line;
+}
+
/* fatal --- print an error message and die */
#if defined(HAVE_STDARG_H) && defined(__STDC__) && __STDC__
void
-fatal(char *mesg, ...)
+r_fatal(char *mesg, ...)
#else
/*VARARGS0*/
void
-fatal(va_alist)
+r_fatal(va_alist)
va_dcl
#endif
{