summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Carbonneaux2015-03-08 18:36:05 -0400
committerQuentin Carbonneaux2015-03-08 18:36:05 -0400
commit2a5520292ac887d9cc7360467673f375fac6286a (patch)
tree06c31fef9ee55dfea71a19f73f139c60c5183a0f
parent4b9a7badce5c318a1e6d48c3805773166d4015f9 (diff)
make it standard C89
-rw-r--r--miniyacc.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/miniyacc.c b/miniyacc.c
index 966e924..22534c9 100644
--- a/miniyacc.c
+++ b/miniyacc.c
@@ -1239,14 +1239,16 @@ init(int ac, char *av[])
if (!(srca = *av))
goto usage;
fin = fopen(srca, "r");
- snprintf(buf, 100, "%s.tab.c", pref);
+ if (strlen(pref) + 10 > sizeof buf)
+ die("-b prefix too long");
+ sprintf(buf, "%s.tab.c", pref);
fout = fopen(buf, "w");
if (vf) {
- snprintf(buf, 100, "%s.output", pref);
+ sprintf(buf, "%s.output", pref);
fgrm = fopen(buf, "w");
}
if (df) {
- snprintf(buf, 100, "%s.tab.h", pref);
+ sprintf(buf, "%s.tab.h", pref);
fhdr = fopen(buf, "w");
if (fhdr) {
fprintf(fhdr, "#ifndef Y_TAB_H_\n");