macro and text revision (-mdoc version 3)
[unix-history] / usr / src / lib / libc / gen / psignal.c
CommitLineData
bb0cfa24 1/*
6eb42836
KB
2 * Copyright (c) 1983 Regents of the University of California.
3 * All rights reserved.
4 *
269a7923 5 * %sccs.include.redist.c%
bb0cfa24
DF
6 */
7
2ce81398 8#if defined(LIBC_SCCS) && !defined(lint)
c5980113 9static char sccsid[] = "@(#)psignal.c 5.6 (Berkeley) %G%";
6eb42836 10#endif /* LIBC_SCCS and not lint */
bb0cfa24 11
1638bfce
SL
12/*
13 * Print the name of the signal indicated
14 * along with the supplied message.
15 */
90793b84 16#include <sys/signal.h>
c5980113 17#include <string.h>
90793b84 18#include <unistd.h>
1638bfce 19
c5980113 20void
1638bfce 21psignal(sig, s)
6eb42836 22 unsigned int sig;
c5980113 23 const char *s;
1638bfce
SL
24{
25 register char *c;
6eb42836 26 register int n;
1638bfce 27
1638bfce
SL
28 if (sig < NSIG)
29 c = sys_siglist[sig];
6eb42836
KB
30 else
31 c = "Unknown signal";
1638bfce
SL
32 n = strlen(s);
33 if (n) {
90793b84
KB
34 (void)write(STDERR_FILENO, s, n);
35 (void)write(STDERR_FILENO, ": ", 2);
1638bfce 36 }
90793b84
KB
37 (void)write(STDERR_FILENO, c, strlen(c));
38 (void)write(STDERR_FILENO, "\n", 1);
1638bfce 39}