tfix various little bugs - plan9port - [fork] Plan 9 from user space
(HTM) git clone git://src.adamsgaard.dk/plan9port
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 18b0811745677e0d63e3e2fa74a6b501992ef370
(DIR) parent e3e30cff40da4c3d1c6ea56ed1cd0e136fb655c9
(HTM) Author: rsc <devnull@localhost>
Date: Tue, 17 Aug 2004 15:32:40 +0000
fix various little bugs
Diffstat:
M src/cmd/grap/grapl.lx | 2 +-
M src/cmd/grap/input.c | 2 +-
M src/cmd/grap/print.c | 10 ++++------
3 files changed, 6 insertions(+), 8 deletions(-)
---
(DIR) diff --git a/src/cmd/grap/grapl.lx b/src/cmd/grap/grapl.lx
t@@ -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;
(DIR) diff --git a/src/cmd/grap/input.c b/src/cmd/grap/input.c
t@@ -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;
(DIR) diff --git a/src/cmd/grap/print.c b/src/cmd/grap/print.c
t@@ -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 {