close_range.2: Glibc 2.34 has added a close_range() wrapper
[man-pages.git] / man3 / wcsdup.3
blob3cacd758559391be2d0ad153291fafe7d2867bad
1 .\" Copyright (c) Bruno Haible <haible@clisp.cons.org>
2 .\"
3 .\" %%%LICENSE_START(GPLv2+_DOC_ONEPARA)
4 .\" This is free documentation; you can redistribute it and/or
5 .\" modify it under the terms of the GNU General Public License as
6 .\" published by the Free Software Foundation; either version 2 of
7 .\" the License, or (at your option) any later version.
8 .\" %%%LICENSE_END
9 .\"
10 .\" References consulted:
11 .\"   GNU glibc-2 source code and manual
12 .\"   Dinkumware C library reference http://www.dinkumware.com/
13 .\"   OpenGroup's Single UNIX specification http://www.UNIX-systems.org/online.html
14 .\"
15 .TH WCSDUP 3  2021-03-22 "GNU" "Linux Programmer's Manual"
16 .SH NAME
17 wcsdup \- duplicate a wide-character string
18 .SH SYNOPSIS
19 .nf
20 .B #include <wchar.h>
21 .PP
22 .BI "wchar_t *wcsdup(const wchar_t *" s );
23 .fi
24 .PP
25 .RS -4
26 Feature Test Macro Requirements for glibc (see
27 .BR feature_test_macros (7)):
28 .RE
29 .PP
30 .BR wcsdup ():
31 .nf
32     Since glibc 2.10:
33         _POSIX_C_SOURCE >= 200809L
34     Before glibc 2.10:
35         _GNU_SOURCE
36 .fi
37 .SH DESCRIPTION
38 The
39 .BR wcsdup ()
40 function is the wide-character equivalent
41 of the
42 .BR strdup (3)
43 function.
44 It allocates and returns a new wide-character string whose initial
45 contents is a duplicate of the wide-character string pointed to by
46 .IR s .
47 .PP
48 Memory for the new wide-character string is
49 obtained with
50 .BR malloc (3),
51 and should be freed with
52 .BR free (3).
53 .SH RETURN VALUE
54 On success,
55 .BR wcsdup ()
56 returns a pointer to the new wide-character string.
57 On error, it returns NULL, with
58 .I errno
59 set to indicate the error.
60 .SH ERRORS
61 .TP
62 .B ENOMEM
63 Insufficient memory available to allocate duplicate string.
64 .SH ATTRIBUTES
65 For an explanation of the terms used in this section, see
66 .BR attributes (7).
67 .ad l
68 .nh
69 .TS
70 allbox;
71 lbx lb lb
72 l l l.
73 Interface       Attribute       Value
75 .BR wcsdup ()
76 T}      Thread safety   MT-Safe
77 .TE
78 .hy
79 .ad
80 .sp 1
81 .SH CONFORMING TO
82 POSIX.1-2008.
83 This function is not specified in POSIX.1-2001,
84 and is not widely available on other systems.
85 .\" present in libc5 and glibc 2.0 and later
86 .SH SEE ALSO
87 .BR strdup (3),
88 .BR wcscpy (3)