From 339c056f856313e215baab8ddc4bc0ce064b4571 Mon Sep 17 00:00:00 2001 From: schwarze <> Date: Mon, 25 Jul 2011 00:38:53 +0000 Subject: update HISTORY and SEE ALSO for all of string(3), together with various smaller improvements; jmc@ and nicm@ both ask me to get this in because further tweaking will be easier in-tree --- src/lib/libc/string/wcsdup.3 | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'src/lib/libc/string/wcsdup.3') 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 @@ -.\" $OpenBSD: wcsdup.3,v 1.3 2011/07/08 17:46:45 nicm Exp $ +.\" $OpenBSD: wcsdup.3,v 1.4 2011/07/25 00:38:53 schwarze Exp $ .\" $NetBSD: wcsdup.3,v 1.3 2010/12/16 17:42:28 wiz Exp $ .\" .\" Copyright (c) 1990, 1991, 1993 @@ -28,14 +28,14 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)strdup.3 8.1 (Berkeley) 6/9/93 +.\" @(#)strdup.3 8.1 (Berkeley) 6/9/93 .\" -.Dd $Mdocdate: July 8 2011 $ +.Dd $Mdocdate: July 25 2011 $ .Dt WCSDUP 3 .Os .Sh NAME .Nm wcsdup -.Nd save a copy of a string +.Nd save a copy of a wide string .Sh SYNOPSIS .In wchar.h .Ft wchar_t * @@ -66,15 +66,11 @@ wchar_t *p, b[32]; size_t blen; blen = sizeof(b) / sizeof(b[0]); -if (mbstowcs(b, o, blen) == (size_t)-1) { - fprintf(stderr, "Failed to convert string.\en"); - exit(1); -} +if (mbstowcs(b, o, blen) == (size_t)-1) + err(1, NULL); b[blen - 1] = 0; -if ((p = wcsdup(b)) == NULL) { - fprintf(stderr, "Out of memory.\en"); - exit(1); -} +if ((p = wcsdup(b)) == NULL) + err(1, NULL); .Ed .Sh ERRORS The @@ -87,8 +83,15 @@ for any of the errors specified for the library function .Xr free 3 , .Xr malloc 3 , .Xr strdup 3 +.Sh STANDARDS +The +.Fn wcsdup +function conforms to +.St -p1003.1-2008 . .Sh HISTORY The .Fn wcsdup -function first appeared in +function was ported from +.Nx +and first appeared in .Ox 5.0 . -- cgit v1.2.3-55-g6feb