1 |
#ifndef lint |
2 |
static const char RCSid[] = "$Id: syscalls.c,v 1.3 2003/07/14 20:02:29 schorsch Exp $"; |
3 |
#endif |
4 |
/* |
5 |
* System calls for meta-file routines |
6 |
*/ |
7 |
|
8 |
#include "rtprocess.h" /* getpid() */ |
9 |
#include "rterror.h" |
10 |
#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 |
char *getenv(); |
41 |
|
42 |
if ((mdir = getenv("MDIR")) == NULL) |
43 |
mdir = MDIR; |
44 |
sprintf(stemp, "%s%s", mdir, fname); |
45 |
|
46 |
return(efopen(stemp, mode)); |
47 |
} |
48 |
|
49 |
|