summaryrefslogtreecommitdiff
path: root/sys/src/cmd/awk/lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/src/cmd/awk/lib.c')
-rw-r--r--sys/src/cmd/awk/lib.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/sys/src/cmd/awk/lib.c b/sys/src/cmd/awk/lib.c
index d32bbf350..076fb79d1 100644
--- a/sys/src/cmd/awk/lib.c
+++ b/sys/src/cmd/awk/lib.c
@@ -155,10 +155,7 @@ int getrec(char **pbuf, int *pbufsize, int isrecord) /* get next input record */
return 1;
}
/* Beof arrived on this file; set up next */
- if (infile != &stdin)
- Bterm(infile);
- infile = nil;
- argno++;
+ nextfile();
}
*pbuf = buf;
*pbufsize = bufsize;
@@ -167,7 +164,7 @@ int getrec(char **pbuf, int *pbufsize, int isrecord) /* get next input record */
void nextfile(void)
{
- if (infile != &stdin)
+ if (infile != nil && infile != &stdin)
Bterm(infile);
infile = nil;
argno++;