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.6 (Berkeley) 02/23/91"; 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 <sys/signal.h> 17 #include <string.h> 18 #include <unistd.h> 19 20 void 21 psignal(sig, s) 22 unsigned int sig; 23 const char *s; 24 { 25 register char *c; 26 register int n; 27 28 if (sig < NSIG) 29 c = sys_siglist[sig]; 30 else 31 c = "Unknown signal"; 32 n = strlen(s); 33 if (n) { 34 (void)write(STDERR_FILENO, s, n); 35 (void)write(STDERR_FILENO, ": ", 2); 36 } 37 (void)write(STDERR_FILENO, c, strlen(c)); 38 (void)write(STDERR_FILENO, "\n", 1); 39 } 40