--- ray/src/common/fropen.c 1991/11/12 16:54:47 2.1 +++ ray/src/common/fropen.c 1992/09/08 10:04:29 2.5 @@ -1,4 +1,4 @@ -/* Copyright (c) 1990 Regents of the University of California */ +/* Copyright (c) 1992 Regents of the University of California */ #ifndef lint static char SCCSid[] = "$SunId$ LBL"; @@ -10,12 +10,7 @@ static char SCCSid[] = "$SunId$ LBL"; #include -#ifndef DEFPATH -#define DEFPATH ":/usr/local/lib/ray" -#endif -#ifndef ULIBVAR -#define ULIBVAR "RAYPATH" -#endif +#include "paths.h" char *libpath = NULL; /* library search path */ @@ -26,13 +21,13 @@ register char *fname; { extern char *strcpy(), *getenv(); FILE *fp; - char pname[256]; + char pname[MAXPATH]; register char *sp, *cp; if (fname == NULL) return(NULL); - if (fname[0] == '/' || fname[0] == '.') /* absolute path */ + if (ISDIRSEP(fname[0]) || fname[0] == '.') /* absolute path */ return(fopen(fname, "r")); if (libpath == NULL) { /* get search path */ @@ -44,10 +39,10 @@ register char *fname; sp = libpath; do { cp = pname; - while (*sp && (*cp = *sp++) != ':') + while (*sp && (*cp = *sp++) != PATHSEP) cp++; - if (cp > pname && cp[-1] != '/') - *cp++ = '/'; + if (cp > pname && !ISDIRSEP(cp[-1])) + *cp++ = DIRSEP; strcpy(cp, fname); if ((fp = fopen(pname, "r")) != NULL) return(fp); /* got it! */