xref: /csrg-svn/lib/libc/gen/psignal.c (revision 21353)
1 /*
2  * Copyright (c) 1980 Regents of the University of California.
3  * All rights reserved.  The Berkeley software License Agreement
4  * specifies the terms and conditions for redistribution.
5  */
6 
7 #ifndef lint
8 static char sccsid[] = "@(#)psignal.c	5.1 (Berkeley) 05/30/85";
9 #endif not lint
10 
11 /*
12  * Print the name of the signal indicated
13  * along with the supplied message.
14  */
15 #include <signal.h>
16 
17 extern	char *sys_siglist[];
18 
19 psignal(sig, s)
20 	unsigned sig;
21 	char *s;
22 {
23 	register char *c;
24 	register n;
25 
26 	c = "Unknown signal";
27 	if (sig < NSIG)
28 		c = sys_siglist[sig];
29 	n = strlen(s);
30 	if (n) {
31 		write(2, s, n);
32 		write(2, ": ", 2);
33 	}
34 	write(2, c, strlen(c));
35 	write(2, "\n", 1);
36 }
37