ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/fropen.c
(Generate patch)

Comparing ray/src/common/fropen.c (file contents):
Revision 2.4 by greg, Tue Sep 8 09:09:23 1992 UTC vs.
Revision 2.7 by greg, Wed Mar 1 10:40:17 1995 UTC

# Line 12 | Line 12 | static char SCCSid[] = "$SunId$ LBL";
12  
13   #include "paths.h"
14  
15 char  *libpath = NULL;          /* library search path */
15  
17
16   FILE *
17 < fropen(fname)                   /* find file and open for reading */
17 > frlibopen(fname)                /* find file and open for reading */
18   register char  *fname;
19   {
20 <        extern char  *strcpy();
20 >        extern char  *strcpy(), *getlibpath();
21          FILE  *fp;
22 <        char  pname[256];
22 >        char  pname[MAXPATH];
23          register char  *sp, *cp;
24  
25          if (fname == NULL)
26                  return(NULL);
27  
28 <        if (fname[0] == DIRSEP || fname[0] == '.')      /* absolute path */
28 >        if (ISDIRSEP(fname[0]) || fname[0] == '.')      /* absolute path */
29                  return(fopen(fname, "r"));
32                
33        if (libpath == NULL) {                  /* get search path */
34                libpath = getenv(ULIBVAR);
35                if (libpath == NULL)
36                        libpath = DEFPATH;
37        }
30                                                  /* check search path */
31 <        sp = libpath;
31 >        sp = getlibpath();
32          do {
33                  cp = pname;
34                  while (*sp && (*cp = *sp++) != PATHSEP)
35                          cp++;
36 <                if (cp > pname && cp[-1] != DIRSEP)
36 >                if (cp > pname && !ISDIRSEP(cp[-1]))
37                          *cp++ = DIRSEP;
38                  strcpy(cp, fname);
39                  if ((fp = fopen(pname, "r")) != NULL)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines