handle grap.defines properly

This commit is contained in:
rsc 2004-08-16 17:20:41 +00:00
parent bdf49b7ee0
commit d16cfe2431
2 changed files with 5 additions and 3 deletions

View file

@ -10,7 +10,7 @@
int dbg = 0; int dbg = 0;
#ifndef GRAPDEFINES #ifndef GRAPDEFINES
#define GRAPDEFINES "#9/sys/lib/grap.defines" #define GRAPDEFINES "#9/lib/grap.defines"
#endif #endif
char *lib_defines; char *lib_defines;

View file

@ -177,6 +177,7 @@ void do_first(void) /* done at first .G1: definitions, etc. */
{ {
extern int lib; extern int lib;
extern char *lib_defines; extern char *lib_defines;
char *file;
static char buf[50], buf1[50]; /* static because pbstr uses them */ static char buf[50], buf1[50]; /* static because pbstr uses them */
FILE *fp; FILE *fp;
extern int getpid(void); extern int getpid(void);
@ -184,8 +185,9 @@ void do_first(void) /* done at first .G1: definitions, etc. */
sprintf(buf, "define pid /%d/\n", getpid()); sprintf(buf, "define pid /%d/\n", getpid());
pbstr(buf); pbstr(buf);
if (lib != 0) { if (lib != 0) {
if ((fp = fopen(unsharp(lib_defines), "r")) != NULL) { file = unsharp(lib_defines);
sprintf(buf1, "copy \"%s\"\n", lib_defines); if ((fp = fopen(file, "r")) != NULL) {
sprintf(buf1, "copy \"%s\"\n", file);
pbstr(buf1); pbstr(buf1);
fclose(fp); fclose(fp);
} else { } else {