1 /*
2 Copyright (c) 2016 Corinna Vinschen <corinna@vinschen.de>
3  */
4 /*
5 FUNCTION
6 	<<wcsxfrm_l>>---locale-specific wide-character string transformation
7 
8 INDEX
9 	wcsxfrm_l
10 
11 SYNOPSIS
12 	#include <wchar.h>
13 	int wcsxfrm_l(wchar_t *__restrict <[stra]>,
14 		      const wchar_t *__restrict <[strb]>, size_t <[n]>,
15 		      locale_t <[locale]>);
16 
17 DESCRIPTION
18 	<<wcsxfrm_l>> transforms the wide-character string pointed to by
19 	<[strb]> to the wide-character string pointed to by <[stra]>,
20 	Comparing two transformed wide strings with <<wcscmp>> should return
21 	the same result as comparing the original strings with <<wcscoll>>.
22 	No more than <[n]> wide characters are transformed, including the
23 	trailing null character.
24 
25 	If <[n]> is 0, <[stra]> may be a NULL pointer.
26 
27 	If <[locale]> is LC_GLOBAL_LOCALE or not a valid locale object, the
28 	behaviour is undefined.
29 
30 	(NOT Cygwin:) The current implementation of <<wcsxfrm_l>> simply uses
31 	<<wcslcpy>> and does not support any language-specific transformations.
32 
33 RETURNS
34 	<<wcsxfrm_l>> returns the length of the transformed wide character
35 	string.  if the return value is greater or equal to <[n]>, the
36 	content of <[stra]> is undefined.
37 
38 PORTABILITY
39 <<wcsxfrm_l>> is POSIX-1.2008.
40 */
41 
42 #define _DEFAULT_SOURCE
43 #include <_ansi.h>
44 #include <wchar.h>
45 
46 size_t
wcsxfrm_l(wchar_t * __restrict a,const wchar_t * __restrict b,size_t n,struct __locale_t * locale)47 wcsxfrm_l (wchar_t *__restrict a, const wchar_t *__restrict b, size_t n,
48 	   struct __locale_t *locale)
49 {
50   (void) locale;
51   return wcslcpy (a, b, n);
52 }
53