xref: /openbsd-src/lib/libc/locale/wcsxfrm.c (revision 3a628b46e7aaa520a6215eccabf31d313c2e7de0)
1*3a628b46Sschwarze /*	$OpenBSD: wcsxfrm.c,v 1.3 2017/09/05 03:16:13 schwarze Exp $ */
2c9b8e388Sstsp /*	$NetBSD: multibyte_sb.c,v 1.4 2003/08/07 16:43:04 agc Exp $ */
3c9b8e388Sstsp 
4c9b8e388Sstsp /*
5c9b8e388Sstsp  * Copyright (c) 1991 The Regents of the University of California.
6c9b8e388Sstsp  * All rights reserved.
7c9b8e388Sstsp  *
8c9b8e388Sstsp  * Redistribution and use in source and binary forms, with or without
9c9b8e388Sstsp  * modification, are permitted provided that the following conditions
10c9b8e388Sstsp  * are met:
11c9b8e388Sstsp  * 1. Redistributions of source code must retain the above copyright
12c9b8e388Sstsp  *    notice, this list of conditions and the following disclaimer.
13c9b8e388Sstsp  * 2. Redistributions in binary form must reproduce the above copyright
14c9b8e388Sstsp  *    notice, this list of conditions and the following disclaimer in the
15c9b8e388Sstsp  *    documentation and/or other materials provided with the distribution.
16c9b8e388Sstsp  * 3. Neither the name of the University nor the names of its contributors
17c9b8e388Sstsp  *    may be used to endorse or promote products derived from this software
18c9b8e388Sstsp  *    without specific prior written permission.
19c9b8e388Sstsp  *
20c9b8e388Sstsp  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21c9b8e388Sstsp  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22c9b8e388Sstsp  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23c9b8e388Sstsp  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24c9b8e388Sstsp  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25c9b8e388Sstsp  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26c9b8e388Sstsp  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27c9b8e388Sstsp  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28c9b8e388Sstsp  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29c9b8e388Sstsp  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30c9b8e388Sstsp  * SUCH DAMAGE.
31c9b8e388Sstsp  */
32c9b8e388Sstsp 
33c9b8e388Sstsp #include <wchar.h>
34c9b8e388Sstsp 
35c9b8e388Sstsp size_t
wcsxfrm(wchar_t * dest,const wchar_t * src,size_t n)36c9b8e388Sstsp wcsxfrm(wchar_t *dest, const wchar_t *src, size_t n)
37c9b8e388Sstsp {
38c9b8e388Sstsp 	if (n == 0)
39c9b8e388Sstsp 		return wcslen(src);
40c9b8e388Sstsp 	return wcslcpy(dest, src, n);
41c9b8e388Sstsp }
42*3a628b46Sschwarze DEF_STRONG(wcsxfrm);
43