home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
unix
/
volume11
/
watcher
/
part01
/
open_cf.c
< prev
next >
Wrap
C/C++ Source or Header
|
1987-09-27
|
897b
|
41 lines
/*
open_cf: open the control file. It is either specified on the
command line or DEF_CONTROL or DEF_CONTROL2.
Kenneth Ingham
Copyright (C) 1987 The University of New Mexico
*/
#include "defs.h"
open_cf()
{
extern char controlname[];
extern FILE *cf;
extern int cflag;
if (cflag) { /* specified control file */
cf = fopen(controlname, "r");
if (cf == NULL) {
fprintf(stderr, "Unable to open '%s'\n",
controlname);
exit(1);
}
}
else { /* try defaults */
if ((cf = fopen(DEF_CONTROL, "r")) == NULL) { /* #1 */
if ((cf = fopen(DEF_CONTROL2, "r")) == NULL) { /*#2*/
fprintf(stderr, "Unable to open %s or %s\n",
DEF_CONTROL, DEF_CONTROL2);
exit(1);
}
/* if we're here #2 must have worked */
(void) strcpy(controlname, DEF_CONTROL2);
}
else
/* if we're here #1 must have worked */
(void) strcpy(controlname, DEF_CONTROL);
}
}