xref: /original-bsd/usr.bin/mail/Signal.c (revision 6b7db209)
1 #
2 
3 #include <signal.h>
4 
5 /*
6  * The following is for systems with botched signal() system entries
7  * which don't return the proper value for the previous signal.
8  */
9 
10 int	oldsigs[17];
11 
12 static char *SccsId = "@(#)Signal.c	2.1 07/01/81";
13 
14 int
15 (*Signal())(sig, spot)
16 	int spot;
17 {
18 	int ret;
19 
20 	/* printf("Signal(%d, %.1o)\n", sig, spot); */
21 	if (sig < 1 || sig > 16)
22 		return(-1);
23 	ret = oldsigs[sig];
24 	oldsigs[sig] = (int) spot;
25 	signal(sig, spot);
26 	return(ret);
27 }
28 
29 Siginit()
30 {
31 	register int i;
32 
33 	for (i = 1; i < 17; i++) {
34 		oldsigs[i] = (int) signal(i, SIG_IGN);
35 		signal(i, (int (*)()) oldsigs[i]);
36 	}
37 }
38