Declare strsignal(3) in <string.h>, per POSIX-2008, and adjust documentation accordingly. Fixes PR standards/41325 from Perry E. Metzger.diff -r1.38 -r1.39 src/include/string.h
(kleink)
--- src/include/string.h 2009/05/01 20:01:23 1.38
+++ src/include/string.h 2009/07/22 19:48:27 1.39
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: string.h,v 1.38 2009/05/01 20:01:23 perry Exp $ */ | 1 | /* $NetBSD: string.h,v 1.39 2009/07/22 19:48:27 kleink Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1990, 1993 | 4 | * Copyright (c) 1990, 1993 | |
5 | * The Regents of the University of California. All rights reserved. | 5 | * The Regents of the University of California. All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -74,33 +74,36 @@ int strerror_r(int, char *, size_t); | @@ -74,33 +74,36 @@ int strerror_r(int, char *, size_t); | |||
74 | #endif /* _POSIX_C_SOURCE >= 199506 || XOPEN_SOURCE >= 500 || ... */ | 74 | #endif /* _POSIX_C_SOURCE >= 199506 || XOPEN_SOURCE >= 500 || ... */ | |
75 | size_t strxfrm(char * __restrict, const char * __restrict, size_t); | 75 | size_t strxfrm(char * __restrict, const char * __restrict, size_t); | |
76 | 76 | |||
77 | #if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) | 77 | #if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) | |
78 | void *memccpy(void *, const void *, int, size_t); | 78 | void *memccpy(void *, const void *, int, size_t); | |
79 | char *strdup(const char *); | 79 | char *strdup(const char *); | |
80 | #endif | 80 | #endif | |
81 | 81 | |||
82 | #if (_POSIX_C_SOURCE - 0 >= 200809L) || (_XOPEN_SOURCE - 0 >= 700) || \ | 82 | #if (_POSIX_C_SOURCE - 0 >= 200809L) || (_XOPEN_SOURCE - 0 >= 700) || \ | |
83 | defined(_NETBSD_SOURCE) | 83 | defined(_NETBSD_SOURCE) | |
84 | char *stpcpy(char * __restrict, const char * __restrict); | 84 | char *stpcpy(char * __restrict, const char * __restrict); | |
85 | char *stpncpy(char * __restrict, const char * __restrict, size_t); | 85 | char *stpncpy(char * __restrict, const char * __restrict, size_t); | |
86 | size_t strnlen(const char *, size_t); | 86 | size_t strnlen(const char *, size_t); | |
87 | #ifndef __STRSIGNAL_DECLARED | |||
88 | #define __STRSIGNAL_DECLARED | |||
89 | /* also in unistd.h */ | |||
90 | __aconst char *strsignal(int); | |||
91 | #endif /* __STRSIGNAL_DECLARED */ | |||
87 | /* | 92 | /* | |
88 | * For POSIX compliance, we still need: | 93 | * For POSIX compliance, we still need: | |
89 | * strcoll_l | 94 | * strcoll_l | |
90 | * strerror_l | 95 | * strerror_l | |
91 | * strxfrm_l | 96 | * strxfrm_l | |
92 | * | |||
93 | * and strsignal needs to be moved from unistd.h to here. | |||
94 | */ | 97 | */ | |
95 | #endif | 98 | #endif | |
96 | 99 | |||
97 | #if defined(_NETBSD_SOURCE) | 100 | #if defined(_NETBSD_SOURCE) | |
98 | #include <strings.h> /* for backwards-compatibilty */ | 101 | #include <strings.h> /* for backwards-compatibilty */ | |
99 | void *memmem(const void *, size_t, const void *, size_t); | 102 | void *memmem(const void *, size_t, const void *, size_t); | |
100 | char *strcasestr(const char *, const char *); | 103 | char *strcasestr(const char *, const char *); | |
101 | size_t strlcat(char *, const char *, size_t); | 104 | size_t strlcat(char *, const char *, size_t); | |
102 | size_t strlcpy(char *, const char *, size_t); | 105 | size_t strlcpy(char *, const char *, size_t); | |
103 | char *strsep(char **, const char *); | 106 | char *strsep(char **, const char *); | |
104 | char *stresep(char **, const char *, int); | 107 | char *stresep(char **, const char *, int); | |
105 | char *strndup(const char *, size_t); | 108 | char *strndup(const char *, size_t); | |
106 | void *memrchr(const void *, int, size_t); | 109 | void *memrchr(const void *, int, size_t); |
--- src/include/unistd.h 2009/01/11 03:04:12 1.120
+++ src/include/unistd.h 2009/07/22 19:48:27 1.121
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: unistd.h,v 1.120 2009/01/11 03:04:12 christos Exp $ */ | 1 | /* $NetBSD: unistd.h,v 1.121 2009/07/22 19:48:27 kleink Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1998, 1999, 2008 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1998, 1999, 2008 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Klaus Klein. | 8 | * by Klaus Klein. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -317,27 +317,31 @@ int reboot(int, char *); | @@ -317,27 +317,31 @@ int reboot(int, char *); | |||
317 | int revoke(const char *); | 317 | int revoke(const char *); | |
318 | int rresvport(int *); | 318 | int rresvport(int *); | |
319 | int ruserok(const char *, int, const char *, const char *); | 319 | int ruserok(const char *, int, const char *, const char *); | |
320 | int setdomainname(const char *, size_t); | 320 | int setdomainname(const char *, size_t); | |
321 | int setgroups(int, const gid_t *); | 321 | int setgroups(int, const gid_t *); | |
322 | int sethostid(long); | 322 | int sethostid(long); | |
323 | int sethostname(const char *, size_t); | 323 | int sethostname(const char *, size_t); | |
324 | int setlogin(const char *); | 324 | int setlogin(const char *); | |
325 | void *setmode(const char *); | 325 | void *setmode(const char *); | |
326 | int setrgid(gid_t); | 326 | int setrgid(gid_t); | |
327 | int setruid(uid_t); | 327 | int setruid(uid_t); | |
328 | void setusershell(void); | 328 | void setusershell(void); | |
329 | void strmode(mode_t, char *); | 329 | void strmode(mode_t, char *); | |
330 | #ifndef __STRSIGNAL_DECLARED | |||
331 | #define __STRSIGNAL_DECLARED | |||
332 | /* backwards-compatibility; also in string.h */ | |||
330 | __aconst char *strsignal(int); | 333 | __aconst char *strsignal(int); | |
334 | #endif /* __STRSIGNAL_DECLARED */ | |||
331 | int swapctl(int, void *, int); | 335 | int swapctl(int, void *, int); | |
332 | int swapon(const char *); /* obsoleted by swapctl() */ | 336 | int swapon(const char *); /* obsoleted by swapctl() */ | |
333 | int syscall(int, ...); | 337 | int syscall(int, ...); | |
334 | quad_t __syscall(quad_t, ...); | 338 | quad_t __syscall(quad_t, ...); | |
335 | int undelete(const char *); | 339 | int undelete(const char *); | |
336 | 340 | |||
337 | #if 1 /*INET6*/ | 341 | #if 1 /*INET6*/ | |
338 | int rcmd_af(char **, int, const char *, | 342 | int rcmd_af(char **, int, const char *, | |
339 | const char *, const char *, int *, int); | 343 | const char *, const char *, int *, int); | |
340 | int rresvport_af(int *, int); | 344 | int rresvport_af(int *, int); | |
341 | int iruserok_sa(const void *, int, int, const char *, const char *); | 345 | int iruserok_sa(const void *, int, int, const char *, const char *); | |
342 | #endif | 346 | #endif | |
343 | 347 |
--- src/lib/libc/string/strsignal.3 2003/08/07 16:43:52 1.9
+++ src/lib/libc/string/strsignal.3 2009/07/22 19:48:27 1.10
@@ -20,40 +20,45 @@ | @@ -20,40 +20,45 @@ | |||
20 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | 20 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
21 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 21 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
22 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 22 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
23 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 23 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
24 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 24 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
25 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 25 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
26 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 26 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
27 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 27 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
28 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 28 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
29 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 29 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
30 | .\" SUCH DAMAGE. | 30 | .\" SUCH DAMAGE. | |
31 | .\" | 31 | .\" | |
32 | .\" from: @(#)strerror.3 6.9 (Berkeley) 6/29/91 | 32 | .\" from: @(#)strerror.3 6.9 (Berkeley) 6/29/91 | |
33 | .\" $NetBSD: strsignal.3,v 1.9 2003/08/07 16:43:52 agc Exp $ | 33 | .\" $NetBSD: strsignal.3,v 1.10 2009/07/22 19:48:27 kleink Exp $ | |
34 | .\" | 34 | .\" | |
35 | .Dd June 29, 1991 | 35 | .Dd July 22, 2009 | |
36 | .Dt STRSIGNAL 3 | 36 | .Dt STRSIGNAL 3 | |
37 | .Os | 37 | .Os | |
38 | .Sh NAME | 38 | .Sh NAME | |
39 | .Nm strsignal | 39 | .Nm strsignal | |
40 | .Nd get signal description string | 40 | .Nd get signal description string | |
41 | .Sh LIBRARY | 41 | .Sh LIBRARY | |
42 | .Lb libc | 42 | .Lb libc | |
43 | .Sh SYNOPSIS | 43 | .Sh SYNOPSIS | |
44 | .In unistd.h | 44 | .In string.h | |
45 | .Ft char * | 45 | .Ft char * | |
46 | .Fn strsignal "int sig" | 46 | .Fn strsignal "int sig" | |
47 | .Sh DESCRIPTION | 47 | .Sh DESCRIPTION | |
48 | The | 48 | The | |
49 | .Fn strsignal | 49 | .Fn strsignal | |
50 | function returns a pointer to the language-dependent string describing | 50 | function returns a pointer to the language-dependent string describing | |
51 | a signal. | 51 | a signal. | |
52 | .Pp | 52 | .Pp | |
53 | The array pointed to is not to be modified by the program, but may be | 53 | The array pointed to is not to be modified by the program, but may be | |
54 | overwritten by subsequent calls to | 54 | overwritten by subsequent calls to | |
55 | .Fn strsignal . | 55 | .Fn strsignal . | |
56 | .Sh SEE ALSO | 56 | .Sh SEE ALSO | |
57 | .Xr intro 2 , | 57 | .Xr intro 2 , | |
58 | .Xr psignal 3 , | 58 | .Xr psignal 3 , | |
59 | .Xr setlocale 3 | 59 | .Xr setlocale 3 | |
60 | .\" .Sh STANDARDS | |||
61 | .\" The | |||
62 | .\" .Fn strsignal | |||
63 | .\" function conforms to | |||
64 | .\" .St -p1003.1-2008 . |
--- src/lib/libc/string/strsignal.c 2005/11/29 03:12:00 1.13
+++ src/lib/libc/string/strsignal.c 2009/07/22 19:48:27 1.14
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: strsignal.c,v 1.13 2005/11/29 03:12:00 christos Exp $ */ | 1 | /* $NetBSD: strsignal.c,v 1.14 2009/07/22 19:48:27 kleink Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1988 Regents of the University of California. | 4 | * Copyright (c) 1988 Regents of the University of California. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -24,32 +24,32 @@ | @@ -24,32 +24,32 @@ | |||
24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
29 | * SUCH DAMAGE. | 29 | * SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | #if defined(LIBC_SCCS) && !defined(lint) | 33 | #if defined(LIBC_SCCS) && !defined(lint) | |
34 | #if 0 | 34 | #if 0 | |
35 | static char *sccsid = "@(#)strerror.c 5.6 (Berkeley) 5/4/91"; | 35 | static char *sccsid = "@(#)strerror.c 5.6 (Berkeley) 5/4/91"; | |
36 | #else | 36 | #else | |
37 | __RCSID("$NetBSD: strsignal.c,v 1.13 2005/11/29 03:12:00 christos Exp $"); | 37 | __RCSID("$NetBSD: strsignal.c,v 1.14 2009/07/22 19:48:27 kleink Exp $"); | |
38 | #endif | 38 | #endif | |
39 | #endif /* LIBC_SCCS and not lint */ | 39 | #endif /* LIBC_SCCS and not lint */ | |
40 | 40 | |||
41 | #include "namespace.h" | 41 | #include "namespace.h" | |
42 | #include <unistd.h> | 42 | #include <string.h> | |
43 | #include <limits.h> | 43 | #include <limits.h> | |
44 | #include "extern.h" | 44 | #include "extern.h" | |
45 | 45 | |||
46 | #ifdef __weak_alias | 46 | #ifdef __weak_alias | |
47 | __weak_alias(strsignal,_strsignal) | 47 | __weak_alias(strsignal,_strsignal) | |
48 | #endif | 48 | #endif | |
49 | 49 | |||
50 | __aconst char * | 50 | __aconst char * | |
51 | strsignal(sig) | 51 | strsignal(sig) | |
52 | int sig; | 52 | int sig; | |
53 | { | 53 | { | |
54 | static char buf[NL_TEXTMAX]; | 54 | static char buf[NL_TEXTMAX]; | |
55 | 55 |