thandle grap.defines properly - 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 d16cfe2431bc5e31128adf0d577a3483a89f8f82
 (DIR) parent bdf49b7ee0229aa7c871402aed264789c901ff69
 (HTM) Author: rsc <devnull@localhost>
       Date:   Mon, 16 Aug 2004 17:20:41 +0000
       
       handle grap.defines properly
       
       Diffstat:
         M src/cmd/grap/main.c                 |       2 +-
         M src/cmd/grap/print.c                |       6 ++++--
       
       2 files changed, 5 insertions(+), 3 deletions(-)
       ---
 (DIR) diff --git a/src/cmd/grap/main.c b/src/cmd/grap/main.c
       t@@ -10,7 +10,7 @@
        int        dbg        = 0;
        
        #ifndef GRAPDEFINES
       -#define GRAPDEFINES "#9/sys/lib/grap.defines"
       +#define GRAPDEFINES "#9/lib/grap.defines"
        #endif
        char        *lib_defines;
        
 (DIR) diff --git a/src/cmd/grap/print.c b/src/cmd/grap/print.c
       t@@ -177,6 +177,7 @@ 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 */
                FILE *fp;
                extern int getpid(void);
       t@@ -184,8 +185,9 @@ void do_first(void)        /* done at first .G1:  definitions, etc. */
                sprintf(buf, "define pid /%d/\n", getpid());
                pbstr(buf);        
                if (lib != 0) {
       -                if ((fp = fopen(unsharp(lib_defines), "r")) != NULL) {
       -                        sprintf(buf1, "copy \"%s\"\n", lib_defines);
       +                file = unsharp(lib_defines);
       +                if ((fp = fopen(file, "r")) != NULL) {
       +                        sprintf(buf1, "copy \"%s\"\n", file);
                                pbstr(buf1);
                                fclose(fp);
                        } else {