|
|
@ -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 . |