|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T s
Length: 1709 (0x6ad)
Types: TextFile
Names: »signal.c«
└─⟦87ddcff64⟧ Bits:30001253 CPHDIST85 Tape, 1985 Autumn Conference Copenhagen
└─⟦this⟧ »cph85dist/search/signal.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
└─⟦this⟧ »EUUGD18/General/Search/signal.c«
#ifndef lint
static char rcsid[] = "$Header: signal.c,v 2.1 85/04/10 17:32:00 matt Stab $";
#endif
/*
*
* search
*
* multi-player and multi-system search and destroy.
*
* Original code by Dave Pare 1984
* Ported & improved
* by Matt Crawford 1985
*
* signal handlers for the daemon
*
* Copyright (c) 1984
*
* $Log: signal.c,v $
* Revision 2.1 85/04/10 17:32:00 matt
* Major de-linting and minor restructuring.
*
*/
#include "defines.h"
#include "structs.h"
#include <stdio.h>
#include <sys/time.h>
#include <sys/file.h>
#include <signal.h>
#include <nlist.h>
trap(sig)
int sig;
{
extern void done();
extern t_player player[NPLAYER];
extern int loc_sock;
extern int pfd;
extern int errfile;
#ifdef INET
extern int in_sock;
#endif
t_player *p;
char buf[80];
#ifdef INET
close(in_sock);
#endif
close(loc_sock);
for (p = player; p < &player[NPLAYER]; p++)
if (p->status.alive == TRUE)
done(p);
close(pfd);
unlink(SLOCK);
sprintf(buf, "trapped interrupt %d\n", sig);
errlog(buf);
close(errfile);
exit(sig);
/*NOTREACHED*/
}
core_dump()
{
extern void done();
extern t_player player[NPLAYER];
t_player *p;
errlog("dumping core...\n");
signal(SIGQUIT, SIG_IGN);
for (p = player; p < &player[NPLAYER]; p++)
if (p->status.alive == TRUE)
done(p);
signal(SIGQUIT, SIG_DFL);
kill(getpid(), SIGQUIT);
/*NOTREACHED*/
}
/*
* put the delay in the game. tune to taste.
*/
void
set_delay() {
extern int nplayer;
struct timeval timer;
long usecs;
usecs = 100000L - (nplayer * 15000L);
if (usecs < 10000L)
return;
timer.tv_sec = 0L;
timer.tv_usec = usecs;
(void)select(0, NULLINT, NULLINT, NULLINT, &timer);
/* if it fails, who cares? */
}