110901Ssam /* 235285Sbostic * Copyright (c) 1983 Regents of the University of California. 335285Sbostic * All rights reserved. 435285Sbostic * 542625Sbostic * %sccs.include.redist.c% 621353Sdist */ 721353Sdist 826576Sdonn #if defined(LIBC_SCCS) && !defined(lint) 9*45646Sbostic static char sccsid[] = "@(#)psignal.c 5.5 (Berkeley) 11/28/90"; 1035285Sbostic #endif /* LIBC_SCCS and not lint */ 1121353Sdist 1221353Sdist /* 1310901Ssam * Print the name of the signal indicated 1410901Ssam * along with the supplied message. 1510901Ssam */ 16*45646Sbostic #include <sys/signal.h> 17*45646Sbostic #include <unistd.h> 1810901Ssam 1910901Ssam extern char *sys_siglist[]; 2010901Ssam 2110901Ssam psignal(sig, s) 2235285Sbostic unsigned int sig; 2310901Ssam char *s; 2410901Ssam { 2510901Ssam register char *c; 2635285Sbostic register int n; 2710901Ssam 2810901Ssam if (sig < NSIG) 2910901Ssam c = sys_siglist[sig]; 3035285Sbostic else 3135285Sbostic c = "Unknown signal"; 3210901Ssam n = strlen(s); 3310901Ssam if (n) { 34*45646Sbostic (void)write(STDERR_FILENO, s, n); 35*45646Sbostic (void)write(STDERR_FILENO, ": ", 2); 3610901Ssam } 37*45646Sbostic (void)write(STDERR_FILENO, c, strlen(c)); 38*45646Sbostic (void)write(STDERR_FILENO, "\n", 1); 3910901Ssam } 40