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 s

⟦b6044e1d6⟧ TextFile

    Length: 1855 (0x73f)
    Types: TextFile
    Names: »sig.c«

Derivation

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

TextFile

#include <sys/types.h>
#include <sys/file.h>
#include <stdio.h>
#include "sysdep.h"
#include "mem.h"
#include "lists.h"
#include "sig.h"

extern	struct list SigList;
extern	int ssigcmp();
long	lseek();

static char sdesc[DESCSIZE+1], sname[SHORT_BUF], ssize[SHORT_BUF];
static char sexp[SHORT_BUF];
struct sig sg = { sname, 0, (time_t)0, sdesc };

int SG_FileDes = UNDEFINED;

setsgent()

{
	if (SG_FileDes == UNDEFINED) {
		SG_FileDes = open(SIGFILE, O_RDONLY);
		if (SG_FileDes < 0) {
			perr(SIGFILE);
			goodbye(1);
		}
	}
	lseek(SG_FileDes, (long) 0, L_SET)<0 &&
		perr("setsgent: lseek failed?!");
	return;
}

endsgent()

{
	if (SG_FileDes == UNDEFINED)
		return;
	(void) close(SG_FileDes);
	SG_FileDes = UNDEFINED;
	return;
}

struct sig *
getsgent()

{
	register int i;
	char c;

	if (SG_FileDes == UNDEFINED)
		setsgent();
#ifdef SENDMAIL
	zerolist(&sg.sg_aliases);
#endif
	i = 0;
	while (read(SG_FileDes, &c, 1) != 0) {
		c &= 0177;
		if (c == ' ')
			break;
		sname[i++] = c;
	}
	sname[i] = '\0';
	if (i == 0)
		return (struct sig *)0;
	i = 0;
	while (read(SG_FileDes, &c, 1) != 0) {
		c &= 0177;
		if (c == ' ')
			break;
		ssize[i++] = c;
	}
	ssize[i] = '\0';
	if (i == 0)
		return (struct sig *)0;
	i = 0;
	while (read(SG_FileDes, &c, 1) != 0) {
		c &= 0177;
		if (c == '\n')
			break;
		sexp[i++] = c;
	}
	sexp[i] = '\0';
	if (i == 0)
		return (struct sig *)0;
	/* result of intermediate assignment used in read() to stifle lint */
	sg.sg_dsize = i = atoi(ssize);
	sg.sg_exptime = atoi(sexp);
	if (read(SG_FileDes, sg.sg_desc, i) != sg.sg_dsize)
		fatal1("%s: bad file format", SIGFILE);
	sg.sg_desc[sg.sg_dsize] = '\0';
	return(&sg);
}

struct sig *
getsgnam(name)
char *name;

{
	int indx, found;

	indx = search_list(&SigList, name, ssigcmp, &found);
	if (found)
		return (struct sig *) SigList.l_list[indx];
	return (struct sig *) 0;
}