diff options
Diffstat (limited to 'src/lib/libc/string/wcsdup.3')
| -rw-r--r-- | src/lib/libc/string/wcsdup.3 | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/lib/libc/string/wcsdup.3 b/src/lib/libc/string/wcsdup.3 index 6588f14988..588a2571db 100644 --- a/src/lib/libc/string/wcsdup.3 +++ b/src/lib/libc/string/wcsdup.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: wcsdup.3,v 1.3 2011/07/08 17:46:45 nicm Exp $ | 1 | .\" $OpenBSD: wcsdup.3,v 1.4 2011/07/25 00:38:53 schwarze Exp $ |
| 2 | .\" $NetBSD: wcsdup.3,v 1.3 2010/12/16 17:42:28 wiz Exp $ | 2 | .\" $NetBSD: wcsdup.3,v 1.3 2010/12/16 17:42:28 wiz Exp $ |
| 3 | .\" | 3 | .\" |
| 4 | .\" Copyright (c) 1990, 1991, 1993 | 4 | .\" Copyright (c) 1990, 1991, 1993 |
| @@ -28,14 +28,14 @@ | |||
| 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 | .\" from: @(#)strdup.3 8.1 (Berkeley) 6/9/93 | 31 | .\" @(#)strdup.3 8.1 (Berkeley) 6/9/93 |
| 32 | .\" | 32 | .\" |
| 33 | .Dd $Mdocdate: July 8 2011 $ | 33 | .Dd $Mdocdate: July 25 2011 $ |
| 34 | .Dt WCSDUP 3 | 34 | .Dt WCSDUP 3 |
| 35 | .Os | 35 | .Os |
| 36 | .Sh NAME | 36 | .Sh NAME |
| 37 | .Nm wcsdup | 37 | .Nm wcsdup |
| 38 | .Nd save a copy of a string | 38 | .Nd save a copy of a wide string |
| 39 | .Sh SYNOPSIS | 39 | .Sh SYNOPSIS |
| 40 | .In wchar.h | 40 | .In wchar.h |
| 41 | .Ft wchar_t * | 41 | .Ft wchar_t * |
| @@ -66,15 +66,11 @@ wchar_t *p, b[32]; | |||
| 66 | size_t blen; | 66 | size_t blen; |
| 67 | 67 | ||
| 68 | blen = sizeof(b) / sizeof(b[0]); | 68 | blen = sizeof(b) / sizeof(b[0]); |
| 69 | if (mbstowcs(b, o, blen) == (size_t)-1) { | 69 | if (mbstowcs(b, o, blen) == (size_t)-1) |
| 70 | fprintf(stderr, "Failed to convert string.\en"); | 70 | err(1, NULL); |
| 71 | exit(1); | ||
| 72 | } | ||
| 73 | b[blen - 1] = 0; | 71 | b[blen - 1] = 0; |
| 74 | if ((p = wcsdup(b)) == NULL) { | 72 | if ((p = wcsdup(b)) == NULL) |
| 75 | fprintf(stderr, "Out of memory.\en"); | 73 | err(1, NULL); |
| 76 | exit(1); | ||
| 77 | } | ||
| 78 | .Ed | 74 | .Ed |
| 79 | .Sh ERRORS | 75 | .Sh ERRORS |
| 80 | The | 76 | The |
| @@ -87,8 +83,15 @@ for any of the errors specified for the library function | |||
| 87 | .Xr free 3 , | 83 | .Xr free 3 , |
| 88 | .Xr malloc 3 , | 84 | .Xr malloc 3 , |
| 89 | .Xr strdup 3 | 85 | .Xr strdup 3 |
| 86 | .Sh STANDARDS | ||
| 87 | The | ||
| 88 | .Fn wcsdup | ||
| 89 | function conforms to | ||
| 90 | .St -p1003.1-2008 . | ||
| 90 | .Sh HISTORY | 91 | .Sh HISTORY |
| 91 | The | 92 | The |
| 92 | .Fn wcsdup | 93 | .Fn wcsdup |
| 93 | function first appeared in | 94 | function was ported from |
| 95 | .Nx | ||
| 96 | and first appeared in | ||
| 94 | .Ox 5.0 . | 97 | .Ox 5.0 . |
