xref: /original-bsd/lib/libc/gen/psignal.c (revision 92c664ec)
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 #if defined(LIBC_SCCS) && !defined(lint)
8 static char sccsid[] = "@(#)psignal.c	5.2 (Berkeley) 03/09/86";
9 #endif LIBC_SCCS and 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