commit 18b0811745677e0d63e3e2fa74a6b501992ef370 from: rsc date: Tue Aug 17 15:32:40 2004 UTC fix various little bugs commit - e3e30cff40da4c3d1c6ea56ed1cd0e136fb655c9 commit + 18b0811745677e0d63e3e2fa74a6b501992ef370 blob - 0023aded84cb6a1f0062372cc82c2469aab7bc66 blob + 6d93f0830cc4cbce63c76bd52bc9af5d8be9a153 --- src/cmd/grap/grapl.lx +++ src/cmd/grap/grapl.lx @@ -18,7 +18,7 @@ void shell_init(void), shell_exec(void), shell_text(ch #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; blob - c9c6c016332c8d583b0eb2523a23264c54249ebb blob + 0c25bba1f049b5f704432d69418596cbec8ddacf --- src/cmd/grap/input.c +++ 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; blob - 4598cb81f7fcf436008af3c0e3c2baf6a297fabd blob + 1ce32116ebb611da0c2e40e0036028f4ec0fa808 --- src/cmd/grap/print.c +++ src/cmd/grap/print.c @@ -177,17 +177,15 @@ void do_first(void) /* done at first .G1: definitions { 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 {