ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/meta/syscalls.c
Revision: 1.3
Committed: Mon Jul 14 20:02:29 2003 UTC (20 years, 9 months ago) by schorsch
Content type: text/plain
Branch: MAIN
Changes since 1.2: +3 -8 lines
Log Message:
Moved some more platform dependencies to common header files.
Included a few necessary system headers.

File Contents

# User Rev Content
1 greg 1.1 #ifndef lint
2 schorsch 1.3 static const char RCSid[] = "$Id: syscalls.c,v 1.2 2003/06/30 14:59:12 schorsch Exp $";
3 greg 1.1 #endif
4     /*
5     * System calls for meta-file routines
6     */
7    
8 schorsch 1.3 #include "rtprocess.h" /* getpid() */
9     #include "rterror.h"
10 greg 1.1 #include "meta.h"
11    
12    
13     FILE *
14     efopen(fname, mode) /* open a file, report errors */
15    
16     char *fname, *mode;
17    
18     {
19     register FILE *fp;
20     FILE *fopen();
21    
22     if ((fp = fopen(fname, mode)) == NULL) {
23     sprintf(errmsg, "cannot open file \"%s\", mode \"%s\"", fname, mode);
24     error(USER, errmsg);
25     }
26    
27     return(fp);
28     }
29    
30    
31    
32     FILE *
33     mfopen(fname, mode) /* open a program metafile */
34    
35     char *fname;
36     char *mode;
37    
38     {
39     char *mdir, stemp[MAXFNAME];
40 schorsch 1.2 #if UNIX || MAC || _WIN32
41 greg 1.1 char *getenv();
42    
43     if ((mdir = getenv("MDIR")) == NULL)
44     #endif
45     mdir = MDIR;
46     sprintf(stemp, "%s%s", mdir, fname);
47    
48     return(efopen(stemp, mode));
49     }
50    
51    
52    
53     #ifdef CPM
54     getpid() /* for CP/M, get user number */
55    
56     {
57    
58     return(getusr());
59     }
60     #endif
61    
62    
63    
64     #ifdef MAC
65     getpid() /* dummy value for MacIntosh */
66    
67     {
68    
69     return(0);
70     }
71     #endif