Net interface definition
[glibc/history.git] / stdio-common / psignal.c
blobfc500419fa281553059f27e8317fadfa01998863
1 /* Copyright (C) 1991, 1992, 1995, 1996 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If
16 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17 Cambridge, MA 02139, USA. */
19 #include <stdio.h>
20 #include <signal.h>
23 #ifndef HAVE_GNU_LD
24 #define _sys_siglist sys_siglist
25 #endif
27 /* Defined in sys_siglist.c. */
28 extern const char *const _sys_siglist[];
31 /* Print out on stderr a line consisting of the test in S, a colon, a space,
32 a message describing the meaning of the signal number SIG and a newline.
33 If S is NULL or "", the colon and space are omitted. */
34 void
35 psignal (int sig, const char *s)
37 const char *colon, *desc;
39 if (s == NULL || s == '\0')
40 s = colon = "";
41 else
42 colon = ": ";
44 if (sig >= 0 && sig < NSIG && (desc = _sys_siglist[sig]) != NULL)
45 (void) fprintf (stderr, "%s%s%s\n", s, colon, _(desc));
46 else
47 (void) fprintf (stderr, _("%s%sUnknown signal %d\n"), s, colon, sig);