ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/meta/syscalls.c
Revision: 1.2
Committed: Mon Jun 30 14:59:12 2003 UTC (21 years, 4 months ago) by schorsch
Content type: text/plain
Branch: MAIN
Changes since 1.1: +5 -2 lines
Log Message:
Replaced most outdated BSD function calls with their posix equivalents, and cleaned up a few other platform dependencies.

File Contents

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