xref: /openbsd/lib/libc/gen/psignal.3 (revision 78b63d65)
1.\"	$OpenBSD: psignal.3,v 1.8 2000/04/18 03:01:27 aaron Exp $
2.\"
3.\" Copyright (c) 1983, 1991, 1993
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. All advertising materials mentioning features or use of this software
15.\"    must display the following acknowledgement:
16.\"	This product includes software developed by the University of
17.\"	California, Berkeley and its contributors.
18.\" 4. Neither the name of the University nor the names of its contributors
19.\"    may be used to endorse or promote products derived from this software
20.\"    without specific prior written permission.
21.\"
22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32.\" SUCH DAMAGE.
33.\"
34.Dd June 4, 1993
35.Dt PSIGNAL 3
36.Os
37.Sh NAME
38.Nm psignal ,
39.Nm sys_siglist ,
40.Nm sys_signame
41.Nd system signal messages
42.Sh SYNOPSIS
43.Fd #include <signal.h>
44.Ft void
45.Fn psignal "unsigned sig" "const char *s"
46.Vt extern char *sys_siglist[];
47.Vt extern char *sys_signame[];
48.Sh DESCRIPTION
49The
50.Fn psignal
51function locates the descriptive message
52string for the given signal number
53.Fa sig
54and writes it to the standard error.
55.Pp
56If the argument
57.Fa s
58is not
59.Dv NULL
60it is written to the standard error file descriptor
61prior to the message string,
62immediately followed by a colon and a space.
63If the signal number is not recognized
64.Pq Xr sigaction 2 ,
65the string
66.Dq Unknown signal
67is produced.
68.Pp
69The message strings can be accessed directly using the external array
70.Va sys_siglist ,
71indexed by recognized signal numbers.
72The external array
73.Va sys_signame
74is used similarly and contains short, upper-case abbreviations for signals
75which are useful for recognizing signal names in user input.
76The defined variable
77.Dv NSIG
78contains a count of the strings in
79.Va sys_siglist
80and
81.Va sys_signame .
82.Sh SEE ALSO
83.Xr sigaction 2 ,
84.Xr perror 3 ,
85.Xr setlocale 3 ,
86.Xr strsignal 3
87.Sh HISTORY
88The
89.Fn psignal
90function appeared in
91.Bx 4.2 .
92