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) |
269a7923 | 9 | static char sccsid[] = "@(#)psignal.c 5.4 (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 | */ | |
16 | #include <signal.h> | |
17 | ||
18 | extern char *sys_siglist[]; | |
19 | ||
20 | psignal(sig, s) | |
6eb42836 | 21 | unsigned int sig; |
1638bfce SL |
22 | char *s; |
23 | { | |
24 | register char *c; | |
6eb42836 | 25 | register int n; |
1638bfce | 26 | |
1638bfce SL |
27 | if (sig < NSIG) |
28 | c = sys_siglist[sig]; | |
6eb42836 KB |
29 | else |
30 | c = "Unknown signal"; | |
1638bfce SL |
31 | n = strlen(s); |
32 | if (n) { | |
6eb42836 KB |
33 | (void)write(2, s, n); |
34 | (void)write(2, ": ", 2); | |
1638bfce | 35 | } |
6eb42836 KB |
36 | (void)write(2, c, strlen(c)); |
37 | (void)write(2, "\n", 1); | |
1638bfce | 38 | } |