From 18b0811745677e0d63e3e2fa74a6b501992ef370 Mon Sep 17 00:00:00 2001 From: rsc Date: Tue, 17 Aug 2004 15:32:40 +0000 Subject: fix various little bugs --- src/cmd/grap/grapl.lx | 2 +- src/cmd/grap/input.c | 2 +- src/cmd/grap/print.c | 10 ++++------ 3 files changed, 6 insertions(+), 8 deletions(-) (limited to 'src/cmd/grap') diff --git a/src/cmd/grap/grapl.lx b/src/cmd/grap/grapl.lx index 0023aded..6d93f083 100644 --- a/src/cmd/grap/grapl.lx +++ b/src/cmd/grap/grapl.lx @@ -18,7 +18,7 @@ void shell_init(void), shell_exec(void), shell_text(char *); #define CADD cbuf[clen++] = yytext[0]; \ if (clen >= CBUFLEN-1) { \ - ERROR "string too long", cbuf WARNING; BEGIN A; } + ERROR "string too long" WARNING; BEGIN A; } #define CBUFLEN 1500 char cbuf[CBUFLEN]; int clen, cflag; diff --git a/src/cmd/grap/input.c b/src/cmd/grap/input.c index c9c6c016..0c25bba1 100644 --- a/src/cmd/grap/input.c +++ b/src/cmd/grap/input.c @@ -540,7 +540,7 @@ void copy(void) /* begin input from file, etc. */ FILE *fin; if (newfile) { - if ((fin = fopen(unsharp(newfile), "r")) == NULL) + if ((fin = fopen(newfile, "r")) == NULL) ERROR "can't open file %s", newfile FATAL; curfile++; curfile->fin = fin; diff --git a/src/cmd/grap/print.c b/src/cmd/grap/print.c index 4598cb81..1ce32116 100644 --- a/src/cmd/grap/print.c +++ b/src/cmd/grap/print.c @@ -177,17 +177,15 @@ void do_first(void) /* done at first .G1: definitions, etc. */ { extern int lib; extern char *lib_defines; - char *file; - static char buf[50], buf1[50]; /* static because pbstr uses them */ + static char buf[100], buf1[100]; /* static because pbstr uses them */ FILE *fp; extern int getpid(void); - sprintf(buf, "define pid /%d/\n", getpid()); + snprintf(buf, sizeof buf, "define pid /%d/\n", getpid()); pbstr(buf); if (lib != 0) { - file = unsharp(lib_defines); - if ((fp = fopen(file, "r")) != NULL) { - sprintf(buf1, "copy \"%s\"\n", file); + if ((fp = fopen(lib_defines, "r")) != NULL) { + snprintf(buf1, sizeof buf, "copy \"%s\"\n", lib_defines); pbstr(buf1); fclose(fp); } else { -- cgit v1.2.3