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

⟦16f4dbb7d⟧ TextFile

    Length: 512 (0x200)
    Types: TextFile
    Names: »openread.c«

Derivation

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

TextFile

/*
 * openread - open a file for exclusive read; bomb if unsuccesful
 */

#include <stdio.h>
#include <sys/file.h>

FILE *
openread (file)
char   *file;
{
    extern char *myname;
    FILE	*fp;

    fp = fopen (file, "r");
    if (fp == NULL) {
	fprintf (stderr, "%s: can't open %s for reading\n", myname, file);
	exit (1);
    }
    if (flock (fileno (fp), LOCK_EX | LOCK_NB)) {
	fprintf (stderr, "%s: statfile %s is in use and locked\n",
	    myname, file);
	exit (1);
    }
    rewind(fp);
    return (fp);
}