12345678910111213141516171819202122232425262728293031323334353637383940 |
- /* (C) C.D.F. Miller, Heriot-Watt University, March 1984
- *
- * Permission is hereby given to reproduce or modify this
- * software freely, provided that this notice be retained,
- * and that no use be made of the software for commercial
- * purposes without the express written permission of the
- * author.
- */
- #include <lbl.h>
- #include <signal.h>
- #include <unistd.h>
- #include "signals.h"
- typedef void (*sig_t) (int);
- extern char tempname[];
- static void onsignal(int unused) __attribute__((noreturn));
- static void
- onsignal(int unused)
- {
- (void)unused;
- unlink(tempname);
- _exit(2);
- }
- void
- setsignals()
- {
- if (signal(SIGINT, onsignal) == SIG_IGN)
- signal(SIGINT, SIG_IGN);
- if (signal(SIGQUIT, onsignal) == SIG_IGN)
- signal(SIGQUIT, SIG_IGN);
- if (signal(SIGHUP, onsignal) == SIG_IGN)
- signal(SIGHUP, SIG_IGN);
- if (signal(SIGTERM, onsignal) == SIG_IGN)
- signal(SIGTERM, SIG_IGN);
- }
|