xref: /illumos-gate/usr/src/man/man3c/wcsdup.3c (revision 845df4971ed7567cacb11bd2435db38259826fed)
1.\"
2.\" This file and its contents are supplied under the terms of the
3.\" Common Development and Distribution License ("CDDL"), version 1.0.
4.\" You may only use this file in accordance with the terms of version
5.\" 1.0 of the CDDL.
6.\"
7.\" A full copy of the text of the CDDL should have accompanied this
8.\" source.  A copy of the CDDL is also available via the Internet at
9.\" http://www.illumos.org/license/CDDL.
10.\"
11.\"
12.\" Copyright 2014 Garrett D'Amore <garrett@damore.org>
13.\"
14.Dd "Nov 4, 2014"
15.Dt WCSDUP 3C
16.Os
17.Sh NAME
18.Nm wcsdup
19.Nd duplicate wide-character string
20.Sh SYNOPSIS
21.In wchar.h
22.Ft "wchar_t *"
23.Fo wcsdup
24.Fa "const wchar_t *string"
25.Fc
26.Sh DESCRIPTION
27The
28.Fn wcsdup
29function duplicates a wide-character
30.Fa string ,
31allocating sufficient memory to store the copy, and then
32copying from
33.Fa string .
34The resulting copy is returned.
35It may be deallocated with
36.Xr free 3C
37when it is no longer needed.
38The
39.Fn wcsdup
40function is the wide-character equivalent of
41.Xr strdup 3C .
42.Sh RETURN VALUES
43On success, the function
44.Fn wcsdup
45returns the newly allocated copy of the string; on failure it
46returns
47.Dv NULL
48and sets
49.Va errno .
50.Sh ERRORS
51The
52.Fn wcsdup
53function will fail if:
54.Bl -tag -width Er
55.It Er ENOMEM
56Insufficient memory was available to create the copy.
57.El
58.Sh INTERFACE STABILITY
59.Sy Standard .
60.Sh MT-LEVEL
61.Sy MT-Safe .
62.Sh SEE ALSO
63.Xr free 3C ,
64.Xr strdup 3C ,
65.Xr wcslen 3C ,
66.Xr wchar.h 3HEAD ,
67.Xr locale 7 ,
68.Xr standards 7
69.Sh STANDARDS
70The
71.Fn wcsdup
72function was introduced in
73.St -p1003.1-2008 .
74