aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--makefile2
-rw-r--r--maketab.c8
2 files changed, 7 insertions, 3 deletions
diff --git a/makefile b/makefile
index 3f3c3c2..a4f1b8a 100644
--- a/makefile
+++ b/makefile
@@ -67,7 +67,7 @@ y%.c y%.h: awk.h proto.h awkgram.y
ytab.h: ytab.c
proctab.c: maketab
- ./maketab >proctab.c
+ ./maketab ytab.h >proctab.c
maketab: ytab.h maketab.c
$(CC) $(CFLAGS) maketab.c -o maketab
diff --git a/maketab.c b/maketab.c
index bb8e317..dbe3d24 100644
--- a/maketab.c
+++ b/maketab.c
@@ -125,8 +125,12 @@ int main(int argc, char *argv[])
for (i = SIZE; --i >= 0; )
names[i] = "";
- if ((fp = fopen("ytab.h", "r")) == NULL) {
- fprintf(stderr, "maketab can't open ytab.h!\n");
+ if (argc != 2) {
+ fprintf(stderr, "usage: maketab YTAB_H\n");
+ exit(1);
+ }
+ if ((fp = fopen(argv[1], "r")) == NULL) {
+ fprintf(stderr, "maketab can't open %s!\n", argv[1]);
exit(1);
}
printf("static char *printname[%d] = {\n", SIZE);