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