Need internal names for strlcat() and strlcpy().

This commit is contained in:
kleink 2002-04-17 16:23:08 +00:00
parent a6d922db91
commit 937479fc3b
6 changed files with 129 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: namespace.h,v 1.70 2002/01/24 02:46:34 lukem Exp $ */
/* $NetBSD: namespace.h,v 1.71 2002/04/17 16:23:08 kleink Exp $ */
/*-
* Copyright (c) 1997-2002 The NetBSD Foundation, Inc.
@ -52,6 +52,8 @@
#define inet_pton _inet_pton
#define pipe _pipe
#define sbrk _sbrk
#define strlcat _strlcat
#define strlcpy _strlcpy
#define strtoimax _strtoimax
#define strtoll _strtoll
#define strtoull _strtoull

View File

@ -1,5 +1,5 @@
# from: @(#)Makefile.inc 8.1 (Berkeley) 6/4/93
# $NetBSD: Makefile.inc,v 1.51 2000/12/24 03:45:04 itojun Exp $
# $NetBSD: Makefile.inc,v 1.52 2002/04/17 16:23:09 kleink Exp $
# string sources
.PATH: ${ARCHDIR}/string ${.CURDIR}/string
@ -14,6 +14,9 @@ SRCS+= wcscat.c wcschr.c wcscmp.c wcscpy.c wcscspn.c wcslcat.c wcslcpy.c \
wcsncmp.c wcsncpy.c wcspbrk.c wcsrchr.c wcsspn.c wcsstr.c wcswidth.c \
wmemchr.c wmemcmp.c wmemcpy.c wmemmove.c wmemset.c
# namespace protection wrappers
SRCS+= _strlcat.c _strlcpy.c
# machine-dependent net sources
# m-d Makefile.inc must include sources for:
# bcmp() bcopy() bzero() ffs() index() memchr() memcmp() memset()

View File

@ -0,0 +1,49 @@
/* $NetBSD: _strlcat.c,v 1.1 2002/04/17 16:23:09 kleink Exp $ */
/*
* Copyright (c) 1996 Christos Zoulas. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christos Zoulas.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifdef __indr_reference
__indr_reference(_strlcat, strlcat)
#else
#include <string.h>
size_t _strlcat __P((char *, const char *, size_t)); /* XXX */
size_t
strlcat(dst, src, siz)
char *dst;
const char *src;
size_t siz;
{
return _strlcat(dst, src, siz);
}
#endif

View File

@ -0,0 +1,49 @@
/* $NetBSD: _strlcpy.c,v 1.1 2002/04/17 16:23:09 kleink Exp $ */
/*
* Copyright (c) 1996 Christos Zoulas. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christos Zoulas.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifdef __indr_reference
__indr_reference(_strlcpy, strlcpy)
#else
#include <string.h>
size_t _strlcpy __P((char *, const char *, size_t)); /* XXX */
size_t
strlcpy(dst, src, siz)
char *dst;
const char *src;
size_t siz;
{
return _strlcpy(dst, src, siz);
}
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: strlcat.c,v 1.11 2002/01/31 22:43:40 tv Exp $ */
/* $NetBSD: strlcat.c,v 1.12 2002/04/17 16:23:09 kleink Exp $ */
/* $OpenBSD: strlcat.c,v 1.4 2001/01/12 22:55:23 millert Exp $ */
/*
@ -30,7 +30,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: strlcat.c,v 1.11 2002/01/31 22:43:40 tv Exp $");
__RCSID("$NetBSD: strlcat.c,v 1.12 2002/04/17 16:23:09 kleink Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -38,6 +38,12 @@ __RCSID("$NetBSD: strlcat.c,v 1.11 2002/01/31 22:43:40 tv Exp $");
#include <assert.h>
#include <string.h>
#ifdef _LIBC
# ifdef __weak_alias
__weak_alias(strlcat, _strlcat)
# endif
#endif
#if !HAVE_STRLCAT
/*
* Appends src to string dst of size siz (unlike strncat, siz is the
@ -47,7 +53,11 @@ __RCSID("$NetBSD: strlcat.c,v 1.11 2002/01/31 22:43:40 tv Exp $");
* If retval >= siz, truncation occurred.
*/
size_t
#ifdef _LIBC
_strlcat(dst, src, siz)
#else
strlcat(dst, src, siz)
#endif
char *dst;
const char *src;
size_t siz;

View File

@ -1,4 +1,4 @@
/* $NetBSD: strlcpy.c,v 1.9 2002/01/31 22:43:41 tv Exp $ */
/* $NetBSD: strlcpy.c,v 1.10 2002/04/17 16:23:09 kleink Exp $ */
/* $OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp $ */
/*
@ -30,7 +30,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: strlcpy.c,v 1.9 2002/01/31 22:43:41 tv Exp $");
__RCSID("$NetBSD: strlcpy.c,v 1.10 2002/04/17 16:23:09 kleink Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -38,6 +38,12 @@ __RCSID("$NetBSD: strlcpy.c,v 1.9 2002/01/31 22:43:41 tv Exp $");
#include <assert.h>
#include <string.h>
#ifdef _LIBC
# ifdef __weak_alias
__weak_alias(strlcpy, _strlcpy)
# endif
#endif
#if !HAVE_STRLCPY
/*
* Copy src to string dst of size siz. At most siz-1 characters
@ -45,7 +51,11 @@ __RCSID("$NetBSD: strlcpy.c,v 1.9 2002/01/31 22:43:41 tv Exp $");
* Returns strlen(src); if retval >= siz, truncation occurred.
*/
size_t
#ifdef _LIBC
_strlcpy(dst, src, siz)
#else
strlcpy(dst, src, siz)
#endif
char *dst;
const char *src;
size_t siz;