xref: /titanic_51/usr/src/man/man3c/wcsdup.3c (revision f770199a45a8893d2f1615ff4e2d13e041992dc3)
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.
23.Ft wchar_t
24.Fo wcsdup
25.Fa "const wchar_t *string"
26.Fc
27.
28.Sh DESCRIPTION
29The
30.Fn wcsdup
31function duplicates a wide-character
32.Fa string ,
33allocating sufficient memory to store the copy, and then
34copying from
35.Fa string .
36The resulting copy is returned.  It may be deallocated with
37.Xr free 3C
38when it is no longer needed.  The
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 5 ,
68.Xr standards 5
69.Sh STANDARDS
70The
71.Fn wcsdup
72function was introduced in
73.St -p1003.1-2008 .
74