Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site watdcsu.UUCP Path: utzoo!watmath!watnot!watdcsu!broehl From: broehl@watdcsu.UUCP (Bernie Roehl) Newsgroups: net.sources Subject: efopen.c Message-ID: <1741@watdcsu.UUCP> Date: Thu, 10-Oct-85 10:19:42 EDT Article-I.D.: watdcsu.1741 Posted: Thu Oct 10 10:19:42 1985 Date-Received: Sat, 12-Oct-85 15:25:56 EDT Distribution: net Organization: U of Waterloo, Ontario Lines: 32 Here's efopen() and error(). They're short, and their use should be obvious from the source. --------- CUT HERE ------------ /* Open a file, aborting on failure */ /* Written by Bernie Roehl, June 1985 */ #include #include efopen(fn, mode) char *fn, *mode; { FILE *unit; if ((unit = fopen(fn, mode)) == NULL) error("Cannot open file %s", fn); else return unit; } extern char *progname; error(s1, s2) char *s1, *s2; { fprintf(stderr, "%s: ", progname); fprintf(stderr, s1, s2); exit(1); }