xref: /csrg-svn/lib/libc/gen/psignal.c (revision 21353)
110901Ssam /*
2*21353Sdist  * Copyright (c) 1980 Regents of the University of California.
3*21353Sdist  * All rights reserved.  The Berkeley software License Agreement
4*21353Sdist  * specifies the terms and conditions for redistribution.
5*21353Sdist  */
6*21353Sdist 
7*21353Sdist #ifndef lint
8*21353Sdist static char sccsid[] = "@(#)psignal.c	5.1 (Berkeley) 05/30/85";
9*21353Sdist #endif not lint
10*21353Sdist 
11*21353Sdist /*
1210901Ssam  * Print the name of the signal indicated
1310901Ssam  * along with the supplied message.
1410901Ssam  */
1510901Ssam #include <signal.h>
1610901Ssam 
1710901Ssam extern	char *sys_siglist[];
1810901Ssam 
1910901Ssam psignal(sig, s)
2010901Ssam 	unsigned sig;
2110901Ssam 	char *s;
2210901Ssam {
2310901Ssam 	register char *c;
2410901Ssam 	register n;
2510901Ssam 
2610901Ssam 	c = "Unknown signal";
2710901Ssam 	if (sig < NSIG)
2810901Ssam 		c = sys_siglist[sig];
2910901Ssam 	n = strlen(s);
3010901Ssam 	if (n) {
3110901Ssam 		write(2, s, n);
3210901Ssam 		write(2, ": ", 2);
3310901Ssam 	}
3410901Ssam 	write(2, c, strlen(c));
3510901Ssam 	write(2, "\n", 1);
3610901Ssam }
37