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

Comparing ray/src/common/paths.h (file contents):
Revision 2.15 by greg, Fri Jun 27 06:53:21 2003 UTC vs.
Revision 2.16 by schorsch, Mon Jun 30 14:59:11 2003 UTC

# Line 8 | Line 8
8   extern "C" {
9   #endif
10  
11 + #include <stdio.h>
12   #include <stdlib.h>
13   #include <string.h>
14 +
15   #ifdef _WIN32
16    #include <io.h>
15 #else /* _WIN32 */
16  #include <unistd.h>
17  #include <sys/param.h>
18 #endif /* _WIN32 */
17  
20 #ifdef _WIN32
21
18    #define access _access
19    #define PATH_MAX _MAX_PATH
20    #define DIRSEP                '/'
# Line 32 | Line 28 | extern "C" {
28    #define CASEDIRSEP    case '/': case '\\'
29    #define PATHSEP               ';'
30    #define CURDIR                '.'
31 <  #define MAXPATH               512 /* XXX obsoleted by posix PATH_MAX */
31 >  /*#define MAXPATH             512*/ /* obsoleted by posix PATH_MAX */
32    #define DEFAULT_TEMPDIRS {"C:/TMP", "C:/TEMP", ".", NULL}
33    #define TEMPLATE      "rtXXXXXX"
34    #define TEMPLEN               8
# Line 49 | Line 45 | extern "C" {
45    #endif
46   extern char  *fixargv0();
47  
48 < #else
49 <  #ifndef PATH_MAX /* doesn't implement posix? */
50 <    #define PATH_MAX 512 /* quite conservative (I think...) */
48 > #else /* everything but Windows */
49 >  #include <unistd.h>
50 >  #include <sys/param.h>
51 >
52 >  #define RMAX_PATH_MAX 4096 /* our own maximum */
53 >  #ifndef PATH_MAX
54 >    #define PATH_MAX 512
55 >  #elif PATH_MAX > RMAX_PATH_MAX /* the OS is exaggerating */
56 >    #undef PATH_MAX
57 >    #define PATH_MAX RMAX_PATH_MAX
58    #endif
59  
60    #ifdef AMIGA
# Line 60 | Line 63 | extern char  *fixargv0();
63      #define ISABS(s) ((s)!=NULL && (ISDIRSEP(s[0])))
64      #define PATHSEP             ';'
65          #define CURDIR          '.'
66 <    #define MAXPATH             128
66 >    /*#define MAXPATH           128*/ /* obsoleted by posix PATH_MAX */
67      #define DEFAULT_TEMPDIRS {"/var/tmp", "/usr/tmp", "/tmp", ".", NULL}
68      #define TEMPLATE    "/tmp/rtXXXXXX"
69      #define TEMPLEN             13
# Line 72 | Line 75 | extern char  *fixargv0();
75  
76    #else
77  
78 +    /* posix */
79 +
80 +        /* this is defined as _PATH_DEVNULL in /usr/include/paths.h on Linux */
81 +        #define NULL_DEVICE     "/dev/null"
82      #define DIRSEP              '/'
83      #define ISABS(s) ((s)!=NULL && (ISDIRSEP(s[0])))
84      #define PATHSEP             ':'
85          #define CURDIR          '.'
86 <    #define MAXPATH             256
86 >    /*#define MAXPATH           256*/ /* obsoleted by posix PATH_MAX */
87      #define DEFAULT_TEMPDIRS {"/var/tmp", "/usr/tmp", "/tmp", ".", NULL}
88      #define TEMPLATE    "/usr/tmp/rtXXXXXX"
89      #define TEMPLEN             17
# Line 96 | Line 103 | extern char  *fixargv0();
103    #define CASEDIRSEP    case DIRSEP
104   #endif
105  
99 extern char  *mktemp(), *getenv();
106  
101 #ifdef BSD
102 extern char  *getwd();
103 #else
104 extern char  *getcwd();
105 #define  getwd(p)       getcwd(p, sizeof(p))
106 #endif
107
108
107   /* Find a writeable directory for temporary files */
108   /* If s is NULL, we return a static string */
109   extern char *temp_directory(char *s, size_t len);
# Line 120 | Line 118 | extern char *temp_filename(char *s, size_t len, char *
118   /* Same as above, but also open the file and return the descriptor */
119   /* This one is supposed to protect against race conditions on unix */
120   /* WARNING: On Windows, there's no protection against race conditions */
121 < extern int temp_file(char *s, size_t len, char *templ);
121 > extern int temp_fd(char *s, size_t len, char *templ);
122 >
123 > /* Same as above, but return a file pointer instead of a descriptor */
124 > extern FILE *temp_fp(char *s, size_t len, char *templ);
125  
126   /* Concatenate two strings, leaving exactly one DIRSEP in between */
127   extern char *append_filepath(char *s1, char *s2, size_t len);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines