110901Ssam /* 2*35285Sbostic * Copyright (c) 1983 Regents of the University of California. 3*35285Sbostic * All rights reserved. 4*35285Sbostic * 5*35285Sbostic * Redistribution and use in source and binary forms are permitted 6*35285Sbostic * provided that the above copyright notice and this paragraph are 7*35285Sbostic * duplicated in all such forms and that any documentation, 8*35285Sbostic * advertising materials, and other materials related to such 9*35285Sbostic * distribution and use acknowledge that the software was developed 10*35285Sbostic * by the University of California, Berkeley. The name of the 11*35285Sbostic * University may not be used to endorse or promote products derived 12*35285Sbostic * from this software without specific prior written permission. 13*35285Sbostic * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 14*35285Sbostic * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 15*35285Sbostic * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 1621353Sdist */ 1721353Sdist 1826576Sdonn #if defined(LIBC_SCCS) && !defined(lint) 19*35285Sbostic static char sccsid[] = "@(#)psignal.c 5.3 (Berkeley) 07/26/88"; 20*35285Sbostic #endif /* LIBC_SCCS and not lint */ 2121353Sdist 2221353Sdist /* 2310901Ssam * Print the name of the signal indicated 2410901Ssam * along with the supplied message. 2510901Ssam */ 2610901Ssam #include <signal.h> 2710901Ssam 2810901Ssam extern char *sys_siglist[]; 2910901Ssam 3010901Ssam psignal(sig, s) 31*35285Sbostic unsigned int sig; 3210901Ssam char *s; 3310901Ssam { 3410901Ssam register char *c; 35*35285Sbostic register int n; 3610901Ssam 3710901Ssam if (sig < NSIG) 3810901Ssam c = sys_siglist[sig]; 39*35285Sbostic else 40*35285Sbostic c = "Unknown signal"; 4110901Ssam n = strlen(s); 4210901Ssam if (n) { 43*35285Sbostic (void)write(2, s, n); 44*35285Sbostic (void)write(2, ": ", 2); 4510901Ssam } 46*35285Sbostic (void)write(2, c, strlen(c)); 47*35285Sbostic (void)write(2, "\n", 1); 4810901Ssam } 49