1 /* Copyright (c) 2007 Corinna Vinschen <corinna@vinschen.de> */
2 /*
3 FUNCTION
4 	<<wcpcpy>>---copy a wide-character string returning a pointer to its end
5 
6 SYNOPSIS
7 	#include <wchar.h>
8 	wchar_t *wcpcpy(wchar_t *<[s1]>, const wchar_t *<[s2]>);
9 
10 DESCRIPTION
11 	The <<wcpcpy>> function copies the wide-character string pointed to by
12 	<[s2]> (including the terminating null wide-character code) into the
13 	array pointed to by <[s1]>. If copying takes place between objects that
14 	overlap, the behaviour is undefined.
15 
16 RETURNS
17 	This function returns a pointer to the end of the destination string,
18 	thus pointing to the trailing '\0'.
19 
20 PORTABILITY
21 <<wcpcpy>> is a GNU extension.
22 
23 No supporting OS subroutines are required.
24 */
25 
26 #include <_ansi.h>
27 #include <wchar.h>
28 
29 wchar_t *
wcpcpy(wchar_t * __restrict s1,const wchar_t * __restrict s2)30 wcpcpy (wchar_t *__restrict s1,
31 	const wchar_t *__restrict s2)
32 {
33   while ((*s1++ = *s2++))
34     ;
35   return --s1;
36 }
37