wcscat.c revision 76612
176612Stshiozak/*	$NetBSD: wcscat.c,v 1.1 2000/12/23 23:14:36 itojun Exp $	*/
276612Stshiozak/*-
376612Stshiozak * Copyright (c)1999 Citrus Project,
476612Stshiozak * All rights reserved.
576612Stshiozak *
676612Stshiozak * Redistribution and use in source and binary forms, with or without
776612Stshiozak * modification, are permitted provided that the following conditions
876612Stshiozak * are met:
976612Stshiozak * 1. Redistributions of source code must retain the above copyright
1076612Stshiozak *    notice, this list of conditions and the following disclaimer.
1176612Stshiozak * 2. Redistributions in binary form must reproduce the above copyright
1276612Stshiozak *    notice, this list of conditions and the following disclaimer in the
1376612Stshiozak *    documentation and/or other materials provided with the distribution.
1476612Stshiozak *
1576612Stshiozak * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1676612Stshiozak * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1776612Stshiozak * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1876612Stshiozak * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1976612Stshiozak * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2076612Stshiozak * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2176612Stshiozak * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2276612Stshiozak * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2376612Stshiozak * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2476612Stshiozak * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2576612Stshiozak * SUCH DAMAGE.
2676612Stshiozak *
2776612Stshiozak *	citrus Id: wcscat.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp
2876612Stshiozak *
2976612Stshiozak * $FreeBSD: head/lib/libc/string/wcscat.c 76612 2001-05-15 06:01:19Z tshiozak $
3076612Stshiozak */
3176612Stshiozak
3276612Stshiozak#include <sys/cdefs.h>
3376612Stshiozak#if defined(LIBC_SCCS) && !defined(lint)
3476612Stshiozak__RCSID("$NetBSD: wcscat.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
3576612Stshiozak#endif /* LIBC_SCCS and not lint */
3676612Stshiozak
3776612Stshiozak#include <assert.h>
3876612Stshiozak#include <wchar.h>
3976612Stshiozak
4076612Stshiozakwchar_t *
4176612Stshiozakwcscat(s1, s2)
4276612Stshiozak	wchar_t *s1;
4376612Stshiozak	const wchar_t *s2;
4476612Stshiozak{
4576612Stshiozak	wchar_t *p;
4676612Stshiozak	wchar_t *q;
4776612Stshiozak	const wchar_t *r;
4876612Stshiozak
4976612Stshiozak	_DIAGASSERT(s1 != NULL);
5076612Stshiozak	_DIAGASSERT(s2 != NULL);
5176612Stshiozak
5276612Stshiozak	p = s1;
5376612Stshiozak	while (*p)
5476612Stshiozak		p++;
5576612Stshiozak	q = p;
5676612Stshiozak	r = s2;
5776612Stshiozak	while (*r)
5876612Stshiozak		*q++ = *r++;
5976612Stshiozak	*q = '\0';
6076612Stshiozak	return s1;
6176612Stshiozak}
62