Commit | Line | Data |
---|---|---|
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) |
90793b84 | 9 | static char sccsid[] = "@(#)psignal.c 5.5 (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 KB |
16 | #include <sys/signal.h> |
17 | #include <unistd.h> | |
1638bfce SL |
18 | |
19 | extern char *sys_siglist[]; | |
20 | ||
21 | psignal(sig, s) | |
6eb42836 | 22 | unsigned int sig; |
1638bfce SL |
23 | char *s; |
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 | } |