1 /* 2 * Copyright (c) 1983 Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 */ 7 8 #if defined(LIBC_SCCS) && !defined(lint) 9 static char sccsid[] = "@(#)psignal.c 5.4 (Berkeley) 06/01/90"; 10 #endif /* LIBC_SCCS and not lint */ 11 12 /* 13 * Print the name of the signal indicated 14 * along with the supplied message. 15 */ 16 #include <signal.h> 17 18 extern char *sys_siglist[]; 19 20 psignal(sig, s) 21 unsigned int sig; 22 char *s; 23 { 24 register char *c; 25 register int n; 26 27 if (sig < NSIG) 28 c = sys_siglist[sig]; 29 else 30 c = "Unknown signal"; 31 n = strlen(s); 32 if (n) { 33 (void)write(2, s, n); 34 (void)write(2, ": ", 2); 35 } 36 (void)write(2, c, strlen(c)); 37 (void)write(2, "\n", 1); 38 } 39