=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/Kan/scanner.c,v retrieving revision 1.1.1.1 retrieving revision 1.3 diff -u -p -r1.1.1.1 -r1.3 --- OpenXM/src/kan96xx/Kan/scanner.c 1999/10/08 02:12:01 1.1.1.1 +++ OpenXM/src/kan96xx/Kan/scanner.c 2000/03/20 01:53:46 1.3 @@ -1,3 +1,4 @@ +/*$OpenXM: OpenXM/src/kan96xx/Kan/scanner.c,v 1.2 1999/11/18 08:08:24 takayama Exp $*/ /* scanner.c (SM StackMachine) */ /* export: struct tokens getokenSM(actionType kind,char *str); scanner.c is used to get tokens from streams. @@ -38,7 +39,8 @@ struct tokens{ -FILE *BaseFp = stdin; /* file pointer of the first file. */ +FILE *BaseFp = NULL; /* Initialized to stdin in stackmachine_init(). + file pointer of the first file. */ int EchoInScanner = 0; /* echo in scanner */ @@ -393,7 +395,20 @@ char *getLOAD_SM1_PATH() { char *getenv(char *s); p = getenv("LOAD_SM1_PATH"); if (p == NULL) { - return("/usr/local/lib/sm1/"); + p = getenv("OpenXM_HOME"); + if (p == NULL) { + return("/usr/local/lib/sm1/"); + }else{ + if (strlen(p) == 0) return(p); + p2 = (char *) sGC_malloc(sizeof(char)*(strlen(p)+strlen("/lib/sm1/")+3)); + if (p2 == NULL) { fprintf(stderr,"No more memory.\n"); exit(10); } + if (p[strlen(p)-1] != '/') { + strcpy(p2,p); strcat(p2,"/lib/sm1/"); + }else{ + strcpy(p2,p); strcat(p2,"lib/sm1/"); + } + return(p2); + } }else{ if (strlen(p) == 0) return(p); if (p[strlen(p)-1] == '/') return(p);