]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright (c) Bruno Haible <haible@clisp.cons.org> |
2 | .\" | |
e4a74ca8 | 3 | .\" SPDX-License-Identifier: GPL-2.0-or-later |
fea681da MK |
4 | .\" |
5 | .\" References consulted: | |
6 | .\" GNU glibc-2 source code and manual | |
7 | .\" Dinkumware C library reference http://www.dinkumware.com/ | |
008f1ecc | 8 | .\" OpenGroup's Single UNIX specification http://www.UNIX-systems.org/online.html |
fea681da | 9 | .\" |
45186a5d | 10 | .TH WCSDUP 3 2021-03-22 "Linux man-pages (unreleased)" |
fea681da MK |
11 | .SH NAME |
12 | wcsdup \- duplicate a wide-character string | |
2d42354f AC |
13 | .SH LIBRARY |
14 | Standard C library | |
8fc3b2cf | 15 | .RI ( libc ", " \-lc ) |
fea681da MK |
16 | .SH SYNOPSIS |
17 | .nf | |
fea681da | 18 | .B #include <wchar.h> |
68e4db0a | 19 | .PP |
fea681da MK |
20 | .BI "wchar_t *wcsdup(const wchar_t *" s ); |
21 | .fi | |
68e4db0a | 22 | .PP |
d39ad78f | 23 | .RS -4 |
d6a4140d MK |
24 | Feature Test Macro Requirements for glibc (see |
25 | .BR feature_test_macros (7)): | |
d39ad78f | 26 | .RE |
68e4db0a | 27 | .PP |
d6a4140d | 28 | .BR wcsdup (): |
9d2adbae MK |
29 | .nf |
30 | Since glibc 2.10: | |
5c10d2c5 | 31 | _POSIX_C_SOURCE >= 200809L |
9d2adbae MK |
32 | Before glibc 2.10: |
33 | _GNU_SOURCE | |
34 | .fi | |
fea681da | 35 | .SH DESCRIPTION |
60a90ecd MK |
36 | The |
37 | .BR wcsdup () | |
38 | function is the wide-character equivalent | |
39 | of the | |
40 | .BR strdup (3) | |
41 | function. | |
c13182ef | 42 | It allocates and returns a new wide-character string whose initial |
40aa0db0 MK |
43 | contents is a duplicate of the wide-character string pointed to by |
44 | .IR s . | |
fea681da | 45 | .PP |
c13182ef | 46 | Memory for the new wide-character string is |
60a90ecd MK |
47 | obtained with |
48 | .BR malloc (3), | |
60d38add | 49 | and should be freed with |
60a90ecd | 50 | .BR free (3). |
47297adb | 51 | .SH RETURN VALUE |
572acb41 | 52 | On success, |
60a90ecd | 53 | .BR wcsdup () |
572acb41 | 54 | returns a pointer to the new wide-character string. |
a150608c | 55 | On error, it returns NULL, with |
572acb41 | 56 | .I errno |
855d489a | 57 | set to indicate the error. |
fea681da MK |
58 | .SH ERRORS |
59 | .TP | |
60 | .B ENOMEM | |
61 | Insufficient memory available to allocate duplicate string. | |
76548b21 MS |
62 | .SH ATTRIBUTES |
63 | For an explanation of the terms used in this section, see | |
64 | .BR attributes (7). | |
c466875e MK |
65 | .ad l |
66 | .nh | |
76548b21 MS |
67 | .TS |
68 | allbox; | |
c466875e | 69 | lbx lb lb |
76548b21 MS |
70 | l l l. |
71 | Interface Attribute Value | |
72 | T{ | |
73 | .BR wcsdup () | |
74 | T} Thread safety MT-Safe | |
75 | .TE | |
c466875e MK |
76 | .hy |
77 | .ad | |
847e0d88 | 78 | .sp 1 |
3113c7f3 | 79 | .SH STANDARDS |
59414d48 MK |
80 | POSIX.1-2008. |
81 | This function is not specified in POSIX.1-2001, | |
82 | and is not widely available on other systems. | |
fea681da | 83 | .\" present in libc5 and glibc 2.0 and later |
47297adb | 84 | .SH SEE ALSO |
fea681da | 85 | .BR strdup (3), |
0a4f8b7b | 86 | .BR wcscpy (3) |