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 "Jul 27, 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
  29 The
  30 .Fn wcsdup
  31 function duplicates a wide-character
  32 .Fa string ,
  33 allocating sufficient memory to store the copy, and then
  34 copying from
  35 .Fa string .
  36 The resulting copy is returned.  It may be deallocated with
  37 .Xr free 3C
  38 when it is no longer needed.  The
  39 .Fn wcsdup
  40 is the wide-character equivalent of
  41 .Xr strdup 3C .
  42 .Sh RETURN VALUES
  43 On success, the functions
  44 .Fn wcsdup
  45 returns the newly allocated copy of the string; on failure it
  46 returns
  47 .Dv NULL
  48 and sets
  49 .Va errno .
  50 .Sh ERRORS
  51 The
  52 .Fn wcsdup
  53 function will fail if:
  54 .Bl -tag -width Er
  55 .It Er ENOMEM
  56 Insufficient 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
  70 The
  71 .Fn wcsdup
  72 function was introduced in
  73 .St -p1003.1-2008 .