xref: /illumos-gate/usr/src/man/man3c/wcsdup.3c (revision fb2612809ed5f2cb9109db768e63d61f6659f71b)
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.
37It may be deallocated with
38.Xr free 3C
39when it is no longer needed.
40The
41.Fn wcsdup
42function is the wide-character equivalent of
43.Xr strdup 3C .
44.Sh RETURN VALUES
45On success, the function
46.Fn wcsdup
47returns the newly allocated copy of the string; on failure it
48returns
49.Dv NULL
50and sets
51.Va errno .
52.Sh ERRORS
53The
54.Fn wcsdup
55function will fail if:
56.Bl -tag -width Er
57.It Er ENOMEM
58Insufficient memory was available to create the copy.
59.El
60.Sh INTERFACE STABILITY
61.Sy Standard .
62.Sh MT-LEVEL
63.Sy MT-Safe .
64.Sh SEE ALSO
65.Xr free 3C ,
66.Xr strdup 3C ,
67.Xr wcslen 3C ,
68.Xr wchar.h 3HEAD ,
69.Xr locale 5 ,
70.Xr standards 5
71.Sh STANDARDS
72The
73.Fn wcsdup
74function was introduced in
75.St -p1003.1-2008 .
76