1 /* Copyright (C) 1991, 1992, 1995, 1996, 1997, 2001, 2002, 2004
2 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
28 #define _sys_siglist sys_siglist
31 /* Defined in sys_siglist.c. */
32 extern const char *const _sys_siglist
[];
33 extern const char *const _sys_siglist_internal
[] attribute_hidden
;
36 /* Print out on stderr a line consisting of the test in S, a colon, a space,
37 a message describing the meaning of the signal number SIG and a newline.
38 If S is NULL or "", the colon and space are omitted. */
40 psignal (int sig
, const char *s
)
42 const char *colon
, *desc
;
44 if (s
== NULL
|| s
== '\0')
49 if (sig
>= 0 && sig
< NSIG
&& (desc
= INTUSE(_sys_siglist
)[sig
]) != NULL
)
51 if (_IO_fwide (stderr
, 0) > 0)
52 (void) __fwprintf (stderr
, L
"%s%s%s\n", s
, colon
, _(desc
));
54 (void) fprintf (stderr
, "%s%s%s\n", s
, colon
, _(desc
));
60 if (__asprintf (&buf
, _("%s%sUnknown signal %d\n"), s
, colon
, sig
) < 0)
62 if (_IO_fwide (stderr
, 0) > 0)
63 (void) __fwprintf (stderr
, L
"%s%s%s\n", s
, colon
, _("Unknown signal"));
65 (void) fprintf (stderr
, "%s%s%s\n", s
, colon
, _("Unknown signal"));
69 if (_IO_fwide (stderr
, 0) > 0)
70 (void) __fwprintf (stderr
, L
"%s", buf
);
72 (void) fputs (buf
, stderr
);