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 r

⟦9e8a32833⟧ TextFile

    Length: 1138 (0x472)
    Types: TextFile
    Names: »range.c«

Derivation

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

TextFile

#include <stdio.h>
#include "sysdep.h"
#include "mem.h"
#include "lists.h"
#include "range.h"

extern	struct list RangeList;
extern	int srangecmp();

static FILE *rgf = NULL;
static char line[BUFSIZ];
static char namebuf[SHORT_BUF+1], modebuf[SHORT_BUF+1];
static struct range rg;

setrgent()

{
	rg.rg_name = namebuf;
	if( rgf == NULL ) {
		rgf = fopen( RANGEFILE, "r" );
		if (rgf == NULL) {
			perr(RANGEFILE);
			goodbye(1);
		}
		rewind(rgf);
	}
	else
		rewind( rgf );
}

endrgent()

{
	if( rgf != NULL ){
		(void) fclose( rgf );
		rgf = NULL;
	}
}

struct range *
getrgent()

{
	register char *p;
	int n;

	if (rgf == NULL)
		setrgent();
	p = fgets(line, BUFSIZ, rgf);
	if (p==NULL)
		return(0);
	n = sscanf(line, "%s%d%d%s",rg.rg_name,
				&rg.rg_from,
				&rg.rg_to,
				modebuf);
	if (n != 4) fatal("badly formatted range file line!");
	rg.rg_mode = (modebuf[0] == 'e' ? RG_EXCLUSIVE : RG_SHARED);
	return(&rg);
}

struct range *
getrgnam(name)
char *name;

{
	int indx, found;

	indx = search_list(&RangeList, name, srangecmp, &found);
	if (found)
		return (struct range *) RangeList.l_list[indx];
	return (struct range *) 0;
}