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

Comparing ray/src/common/getpath.c (file contents):
Revision 2.7 by greg, Mon Sep 21 11:59:42 1992 UTC vs.
Revision 2.10 by greg, Tue Feb 25 02:47:21 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1992 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   *  getpath.c - function to search for file in a list of directories
6 + *
7 + *  External symbols declared in standard.h
8   */
9  
10 + #include "copyright.h"
11 +
12   #include  "standard.h"
13  
14   #include  "paths.h"
# Line 33 | Line 34 | int  mode;
34          if (fname == NULL)
35                  return(NULL);
36  
37 +        pname[0] = '\0';                /* check for full specification */
38          switch (*fname) {
39          CASEDIRSEP:                             /* relative to root */
40          case '.':                               /* relative to cwd */
41                  strcpy(pname, fname);
42 <                return(pname);
42 >                break;
43   #ifndef NIX
44          case '~':                               /* relative to home directory */
45                  fname++;
# Line 46 | Line 48 | int  mode;
48                                  return(NULL);
49                          strcpy(pname, cp);
50                          strcat(pname, fname);
51 <                        return(pname);
51 >                        break;
52                  }
53                  cp = pname;                                     /* user */
54                  do
# Line 57 | Line 59 | int  mode;
59                          return(NULL);
60                  strcpy(pname, pwent->pw_dir);
61                  strcat(pname, fname);
62 <                return(pname);
62 >                break;
63   #endif
64          }
65 +        if (pname[0])           /* got it, check access if search requested */
66 +                return(searchpath==NULL||access(pname,mode)==0 ? pname : NULL);
67  
68          if (searchpath == NULL) {                       /* don't search */
69                  strcpy(pname, fname);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines