wcsncat.c revision 76683
138032Speter/*	$NetBSD: wcsncat.c,v 1.1 2000/12/23 23:14:36 itojun Exp $	*/
2111823Sgshapiro
364562Sgshapiro/*-
438032Speter * Copyright (c)1999 Citrus Project,
538032Speter * All rights reserved.
638032Speter *
738032Speter * Redistribution and use in source and binary forms, with or without
838032Speter * modification, are permitted provided that the following conditions
938032Speter * are met:
1038032Speter * 1. Redistributions of source code must retain the above copyright
1138032Speter *    notice, this list of conditions and the following disclaimer.
1238032Speter * 2. Redistributions in binary form must reproduce the above copyright
1338032Speter *    notice, this list of conditions and the following disclaimer in the
1464562Sgshapiro *    documentation and/or other materials provided with the distribution.
1564562Sgshapiro *
16125820Sgshapiro * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1738032Speter * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1890792Sgshapiro * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1938032Speter * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2090792Sgshapiro * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2190792Sgshapiro * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2290792Sgshapiro * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23120256Sgshapiro * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2490792Sgshapiro * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25125820Sgshapiro * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26125820Sgshapiro * SUCH DAMAGE.
27125820Sgshapiro *
28125820Sgshapiro *	citrus Id: wcsncat.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp
29125820Sgshapiro *
30125820Sgshapiro * $FreeBSD: head/lib/libc/string/wcsncat.c 76683 2001-05-16 14:34:47Z ru $
31120256Sgshapiro */
32125820Sgshapiro
33125820Sgshapiro#include <sys/cdefs.h>
34125820Sgshapiro#if defined(LIBC_SCCS) && !defined(lint)
35125820Sgshapiro__RCSID("$NetBSD: wcsncat.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
3690792Sgshapiro#endif /* LIBC_SCCS and not lint */
3790792Sgshapiro
38120256Sgshapiro#include <assert.h>
39120256Sgshapiro#include <wchar.h>
40120256Sgshapiro
41120256Sgshapirowchar_t *
4290792Sgshapirowcsncat(s1, s2, n)
4390792Sgshapiro	wchar_t *s1;
4490792Sgshapiro	const wchar_t *s2;
4590792Sgshapiro	size_t n;
4664562Sgshapiro{
47112810Sgshapiro	wchar_t *p;
4890792Sgshapiro	wchar_t *q;
4990792Sgshapiro	const wchar_t *r;
5090792Sgshapiro
51112810Sgshapiro	p = s1;
5290792Sgshapiro	while (*p)
5390792Sgshapiro		p++;
5490792Sgshapiro	q = p;
5590792Sgshapiro	r = s2;
5690792Sgshapiro	while (*r && n) {
5764562Sgshapiro		*q++ = *r++;
5890792Sgshapiro		n--;
5990792Sgshapiro	}
6038032Speter	*q = '\0';
6138032Speter	return s1;
6238032Speter}
6338032Speter