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 1.2 by greg, Sun Dec 9 09:21:05 1990 UTC vs.
Revision 2.4 by greg, Tue Sep 8 09:09:23 1992 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1990 Regents of the University of California */
1 > /* Copyright (c) 1992 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 10 | Line 10 | static char SCCSid[] = "$SunId$ LBL";
10  
11   #include <stdio.h>
12  
13 < #ifndef DEFPATH
14 < #define DEFPATH         ":/usr/local/lib/ray"
15 < #endif
16 < #ifndef ULIBVAR
17 < #define ULIBVAR         "RAYPATH"
18 < #endif
13 > #include "paths.h"
14  
15   char  *libpath = NULL;          /* library search path */
16  
# Line 24 | Line 19 | FILE *
19   fropen(fname)                   /* find file and open for reading */
20   register char  *fname;
21   {
22 <        extern char  *strcpy(), *getenv();
22 >        extern char  *strcpy();
23          FILE  *fp;
24          char  pname[256];
25          register char  *sp, *cp;
# Line 32 | Line 27 | register char  *fname;
27          if (fname == NULL)
28                  return(NULL);
29  
30 <        if (fname[0] == '/' || fname[0] == '.') /* absolute path */
30 >        if (fname[0] == DIRSEP || fname[0] == '.')      /* absolute path */
31                  return(fopen(fname, "r"));
32                  
33          if (libpath == NULL) {                  /* get search path */
# Line 44 | Line 39 | register char  *fname;
39          sp = libpath;
40          do {
41                  cp = pname;
42 <                while (*sp && (*cp = *sp++) != ':')
42 >                while (*sp && (*cp = *sp++) != PATHSEP)
43                          cp++;
44 <                if (cp > pname && cp[-1] != '/')
45 <                        *cp++ = '/';
44 >                if (cp > pname && cp[-1] != DIRSEP)
45 >                        *cp++ = DIRSEP;
46                  strcpy(cp, fname);
47                  if ((fp = fopen(pname, "r")) != NULL)
48                          return(fp);                     /* got it! */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines