DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ T e

⟦f985b8c81⟧ TextFile

    Length: 803 (0x323)
    Types: TextFile
    Names: »efopen.c«

Derivation

└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki
    └─ ⟦this⟧ »EUUGD11/euug-87hel/sec1/mkprog/efopen.c« 

TextFile

#ifndef lint
static char rcsid[] = "$Header: efopen.c,v 1.2 87/03/02 17:45:15 root Exp $";
static char rcswhere[] = "$Source: /usr/src/local/local/mkprog/RCS/efopen.c,v $";
#endif

#include <stdio.h>

FILE *
efopen(file, mode)	/* fopen file, die if cannot */
char *file, *mode;	/* from K & P with addition of perror() and handling
			   of "-" as stdin */
{
    FILE *fp;
    extern char *progname;

    if (strcmp(file, "-") == 0)
	return(stdin);

    if ((fp = fopen(file, mode)) != NULL)
	return (fp);

    if (progname)
	fprintf(stderr, "%s: ", progname);
    fprintf(stderr, "can't open file %s mode %s: ", file, mode);
    perror("");
    exit(1);
	/* NOTREACHED */
}

/* This makes it more portable to a non-unix environment */

#ifndef unix
perror(s)
char *s;
{
    putc('\n', stderr);
}
#endif