summaryrefslogtreecommitdiff
path: root/usr.bin/awk/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/awk/main.c')
-rw-r--r--usr.bin/awk/main.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/usr.bin/awk/main.c b/usr.bin/awk/main.c
index 7fb6b080da5..3cc45ba8ceb 100644
--- a/usr.bin/awk/main.c
+++ b/usr.bin/awk/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.6 1999/04/18 17:06:30 millert Exp $ */
+/* $OpenBSD: main.c,v 1.7 1999/04/20 17:31:30 millert Exp $ */
/****************************************************************
Copyright (C) Lucent Technologies 1997
All Rights Reserved
@@ -23,7 +23,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
****************************************************************/
-char *version = "version 990305";
+char *version = "version 19990416";
#define DEBUG
#include <stdio.h>
@@ -182,6 +182,7 @@ int pgetc(void) /* get 1 character from awk program */
yyin = stdin;
else if ((yyin = fopen(pfile[curpfile], "r")) == NULL)
ERROR "can't open file %s", pfile[curpfile] FATAL;
+ lineno = 1;
}
if ((c = getc(yyin)) != EOF)
return c;
@@ -191,3 +192,11 @@ int pgetc(void) /* get 1 character from awk program */
curpfile++;
}
}
+
+char *cursource(void) /* current source file name */
+{
+ if (npfile > 0)
+ return pfile[curpfile];
+ else
+ return NULL;
+}