| 8 |
|
extern "C" { |
| 9 |
|
#endif |
| 10 |
|
|
| 11 |
– |
#include "copyright.h" |
| 12 |
– |
|
| 11 |
|
#include <stdlib.h> |
| 12 |
|
#include <string.h> |
| 13 |
|
#ifdef _WIN32 |
| 14 |
< |
#include <io.h> |
| 17 |
< |
#define access _access |
| 18 |
< |
#define PATH_MAX _MAX_PATH |
| 14 |
> |
#include <io.h> |
| 15 |
|
#else /* _WIN32 */ |
| 16 |
< |
#include <unistd.h> |
| 17 |
< |
#include <sys/param.h> |
| 16 |
> |
#include <unistd.h> |
| 17 |
> |
#include <sys/param.h> |
| 18 |
|
#endif /* _WIN32 */ |
| 19 |
|
|
| 20 |
|
#ifdef _WIN32 |
| 21 |
|
|
| 22 |
< |
#define DIRSEP '/' |
| 23 |
< |
#define ISDIRSEP(c) ((c)=='/' || (c)=='\\') |
| 24 |
< |
#define ISABS(s) ((s)!=NULL \ |
| 25 |
< |
&& (s[0])!='\0' \ |
| 26 |
< |
&& ( ISDIRSEP(s[0]) \ |
| 27 |
< |
|| ( (s[1])!='\0' \ |
| 28 |
< |
&& (isupper(s[0])||islower(s[0])) \ |
| 29 |
< |
&& (s[1])==':'))) |
| 30 |
< |
#define CASEDIRSEP case '/': case '\\' |
| 31 |
< |
#define PATHSEP ';' |
| 32 |
< |
#define MAXPATH 128 |
| 33 |
< |
#define DEFAULT_TEMPDIRS {"C:/TMP", "C:/TEMP", ".", NULL} |
| 34 |
< |
#define TEMPLATE "rtXXXXXX" |
| 35 |
< |
#define TEMPLEN 8 |
| 36 |
< |
#define ULIBVAR "RAYPATH" |
| 37 |
< |
#ifndef DEFPATH |
| 38 |
< |
#define DEFPATH ";c:/ray/lib" |
| 39 |
< |
#endif |
| 40 |
< |
/* <io.h> only does half the work for access() */ |
| 41 |
< |
#ifndef F_OK |
| 42 |
< |
#define F_OK 00 |
| 43 |
< |
#define W_OK 02 |
| 44 |
< |
#define R_OK 04 |
| 45 |
< |
#endif |
| 22 |
> |
#define access _access |
| 23 |
> |
#define PATH_MAX _MAX_PATH |
| 24 |
> |
#define DIRSEP '/' |
| 25 |
> |
#define ISDIRSEP(c) ((c)=='/' || (c)=='\\') |
| 26 |
> |
#define ISABS(s) ((s)!=NULL \ |
| 27 |
> |
&& (s[0])!='\0' \ |
| 28 |
> |
&& ( ISDIRSEP(s[0]) \ |
| 29 |
> |
|| ( (s[1])!='\0' \ |
| 30 |
> |
&& (isupper(s[0])||islower(s[0])) \ |
| 31 |
> |
&& (s[1])==':'))) |
| 32 |
> |
#define CASEDIRSEP case '/': case '\\' |
| 33 |
> |
#define PATHSEP ';' |
| 34 |
> |
#define CURDIR '.' |
| 35 |
> |
#define MAXPATH 512 /* XXX obsoleted by posix PATH_MAX */ |
| 36 |
> |
#define DEFAULT_TEMPDIRS {"C:/TMP", "C:/TEMP", ".", NULL} |
| 37 |
> |
#define TEMPLATE "rtXXXXXX" |
| 38 |
> |
#define TEMPLEN 8 |
| 39 |
> |
#define ULIBVAR "RAYPATH" |
| 40 |
> |
#ifndef DEFPATH |
| 41 |
> |
#define DEFPATH ";c:/ray/lib" |
| 42 |
> |
#endif |
| 43 |
> |
/* <io.h> only does half the work for access() */ |
| 44 |
> |
#ifndef F_OK |
| 45 |
> |
#define F_OK 00 |
| 46 |
> |
#define X_OK 01 |
| 47 |
> |
#define W_OK 02 |
| 48 |
> |
#define R_OK 04 |
| 49 |
> |
#endif |
| 50 |
|
extern char *fixargv0(); |
| 51 |
|
|
| 52 |
|
#else |
| 53 |
< |
#ifdef AMIGA |
| 53 |
> |
#ifndef PATH_MAX /* doesn't implement posix? */ |
| 54 |
> |
#define PATH_MAX 512 /* quite conservative (I think...) */ |
| 55 |
> |
#endif |
| 56 |
|
|
| 57 |
< |
#define DIRSEP '/' |
| 56 |
< |
#define ISABS(s) ((s)!=NULL && (ISDIRSEP(s[0]))) |
| 57 |
< |
#define PATHSEP ';' |
| 58 |
< |
#define MAXPATH 128 |
| 59 |
< |
#define DEFAULT_TEMPDIRS {"/var/tmp", "/usr/tmp", "/tmp", ".", NULL} |
| 60 |
< |
#define TEMPLATE "/tmp/rtXXXXXX" |
| 61 |
< |
#define TEMPLEN 13 |
| 62 |
< |
#define ULIBVAR "RAYPATH" |
| 63 |
< |
#ifndef DEFPATH |
| 64 |
< |
#define DEFPATH ";/ray/lib" |
| 65 |
< |
#endif |
| 66 |
< |
#define fixargv0(a0) (a0) |
| 57 |
> |
#ifdef AMIGA |
| 58 |
|
|
| 59 |
< |
#else |
| 59 |
> |
#define DIRSEP '/' |
| 60 |
> |
#define ISABS(s) ((s)!=NULL && (ISDIRSEP(s[0]))) |
| 61 |
> |
#define PATHSEP ';' |
| 62 |
> |
#define CURDIR '.' |
| 63 |
> |
#define MAXPATH 128 |
| 64 |
> |
#define DEFAULT_TEMPDIRS {"/var/tmp", "/usr/tmp", "/tmp", ".", NULL} |
| 65 |
> |
#define TEMPLATE "/tmp/rtXXXXXX" |
| 66 |
> |
#define TEMPLEN 13 |
| 67 |
> |
#define ULIBVAR "RAYPATH" |
| 68 |
> |
#ifndef DEFPATH |
| 69 |
> |
#define DEFPATH ";/ray/lib" |
| 70 |
> |
#endif |
| 71 |
> |
#define fixargv0(a0) (a0) |
| 72 |
|
|
| 73 |
< |
#define DIRSEP '/' |
| 71 |
< |
#define ISABS(s) ((s)!=NULL && (ISDIRSEP(s[0]))) |
| 72 |
< |
#define PATHSEP ':' |
| 73 |
< |
#define MAXPATH 256 |
| 74 |
< |
#define DEFAULT_TEMPDIRS {"/var/tmp", "/usr/tmp", "/tmp", ".", NULL} |
| 75 |
< |
#define TEMPLATE "/usr/tmp/rtXXXXXX" |
| 76 |
< |
#define TEMPLEN 17 |
| 77 |
< |
#define ULIBVAR "RAYPATH" |
| 78 |
< |
#ifndef DEFPATH |
| 79 |
< |
#define DEFPATH ":/usr/local/lib/ray" |
| 80 |
< |
#endif |
| 81 |
< |
#define fixargv0(a0) (a0) |
| 73 |
> |
#else |
| 74 |
|
|
| 75 |
+ |
#define DIRSEP '/' |
| 76 |
+ |
#define ISABS(s) ((s)!=NULL && (ISDIRSEP(s[0]))) |
| 77 |
+ |
#define PATHSEP ':' |
| 78 |
+ |
#define CURDIR '.' |
| 79 |
+ |
#define MAXPATH 256 |
| 80 |
+ |
#define DEFAULT_TEMPDIRS {"/var/tmp", "/usr/tmp", "/tmp", ".", NULL} |
| 81 |
+ |
#define TEMPLATE "/usr/tmp/rtXXXXXX" |
| 82 |
+ |
#define TEMPLEN 17 |
| 83 |
+ |
#define ULIBVAR "RAYPATH" |
| 84 |
+ |
#ifndef DEFPATH |
| 85 |
+ |
#define DEFPATH ":/usr/local/lib/ray" |
| 86 |
+ |
#endif |
| 87 |
+ |
#define fixargv0(a0) (a0) |
| 88 |
+ |
|
| 89 |
+ |
#endif |
| 90 |
|
#endif |
| 84 |
– |
#endif |
| 91 |
|
|
| 92 |
|
#ifndef ISDIRSEP |
| 93 |
< |
#define ISDIRSEP(c) ((c)==DIRSEP) |
| 93 |
> |
#define ISDIRSEP(c) ((c)==DIRSEP) |
| 94 |
|
#endif |
| 95 |
|
#ifndef CASEDIRSEP |
| 96 |
< |
#define CASEDIRSEP case DIRSEP |
| 96 |
> |
#define CASEDIRSEP case DIRSEP |
| 97 |
|
#endif |
| 98 |
|
|
| 99 |
|
extern char *mktemp(), *getenv(); |