wcscat.c revision 86170
171333Sitojun/*-
278064Sume * Copyright (c)1999 Citrus Project,
362656Skris * All rights reserved.
455505Sshin *
555505Sshin * Redistribution and use in source and binary forms, with or without
655505Sshin * modification, are permitted provided that the following conditions
762656Skris * are met:
855505Sshin * 1. Redistributions of source code must retain the above copyright
955505Sshin *    notice, this list of conditions and the following disclaimer.
1055505Sshin * 2. Redistributions in binary form must reproduce the above copyright
1155505Sshin *    notice, this list of conditions and the following disclaimer in the
1255505Sshin *    documentation and/or other materials provided with the distribution.
1355505Sshin *
1455505Sshin * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1555505Sshin * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1655505Sshin * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1755505Sshin * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1855505Sshin * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1962656Skris * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2055505Sshin * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2155505Sshin * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2255505Sshin * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2355505Sshin * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2455505Sshin * SUCH DAMAGE.
2555505Sshin *
2655505Sshin *	citrus Id: wcscat.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp
2755505Sshin */
2855505Sshin
2955505Sshin#include <sys/cdefs.h>
3055505Sshin#if defined(LIBC_SCCS) && !defined(lint)
3155505Sshin__RCSID("$NetBSD: wcscat.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
3255505Sshin#endif /* LIBC_SCCS and not lint */
3355505Sshin__FBSDID("$FreeBSD: head/lib/libc/string/wcscat.c 86170 2001-11-07 19:55:16Z obrien $");
3455505Sshin
3555505Sshin#include <assert.h>
3655505Sshin#include <wchar.h>
3778064Sume
3855505Sshinwchar_t *
3955505Sshinwcscat(s1, s2)
4062656Skris	wchar_t *s1;
4155505Sshin	const wchar_t *s2;
4262656Skris{
4355505Sshin	wchar_t *p;
4455505Sshin	wchar_t *q;
4555505Sshin	const wchar_t *r;
4655505Sshin
4755505Sshin	p = s1;
4857120Sshin	while (*p)
4955505Sshin		p++;
5057120Sshin	q = p;
5162656Skris	r = s2;
5262656Skris	while (*r)
5362656Skris		*q++ = *r++;
5455505Sshin	*q = '\0';
5555505Sshin	return s1;
5655505Sshin}
5755505Sshin