| 1 |
#ifndef lint
|
| 2 |
static const char RCSid[] = "$Id: syscalls.c,v 1.4 2003/08/01 14:14:24 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( /* open a file, report errors */
|
| 15 |
const char *fname,
|
| 16 |
const char *mode
|
| 17 |
)
|
| 18 |
{
|
| 19 |
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( /* open a program metafile */
|
| 34 |
const char *fname,
|
| 35 |
const char *mode
|
| 36 |
)
|
| 37 |
{
|
| 38 |
char *mdir, stemp[MAXFNAME];
|
| 39 |
char *getenv();
|
| 40 |
|
| 41 |
if ((mdir = getenv("MDIR")) == NULL)
|
| 42 |
mdir = MDIR;
|
| 43 |
sprintf(stemp, "%s%s", mdir, fname);
|
| 44 |
|
| 45 |
return(efopen(stemp, mode));
|
| 46 |
}
|
| 47 |
|
| 48 |
|