This commit is contained in:
tg 2007-01-09 17:34:21 +00:00
parent b725114422
commit 56e8571167
1 changed files with 23 additions and 20 deletions

View File

@ -1,32 +1,34 @@
/* $MirOS: src/bin/mksh/strlfun.c,v 1.7 2006/11/09 15:02:31 tg Exp $ */ /* $MirOS: src/bin/mksh/strlfun.c,v 1.8 2007/01/09 17:34:21 tg Exp $ */
/* _MirOS: src/lib/libc/string/strlfun.c,v 1.10 2006/11/08 23:18:04 tg Exp $ */ /* $miros: src/lib/libc/string/strlfun.c,v 1.14 2007/01/07 02:11:40 tg Exp $ */
/*- /*-
* Copyright (c) 2006 * Copyright (c) 2006
* Thorsten Glaser <tg@mirbsd.de> * Thorsten Glaser <tg@mirbsd.de>
* *
* Licensee is hereby permitted to deal in this work without restric- * This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to
* tion, including unlimited rights to use, publicly perform, modify, * the utmost extent permitted by applicable law, neither express nor
* merge, distribute, sell, give away or sublicence, provided all co- * implied; without malicious intent or gross negligence. In no event
* pyright notices above, these terms and the disclaimer are retained * may a licensor, author or contributor be held liable for indirect,
* in all redistributions or reproduced in accompanying documentation * direct, other damage, loss, or other issues arising in any way out
* or other materials provided with binary redistributions. * of dealing in the work, even if advised of the possibility of such
* * damage or existence of a defect, except proven that it results out
* Licensor offers the work "AS IS" and WITHOUT WARRANTY of any kind, * of said person's immediate fault when using the work as intended.
* express, or implied, to the maximum extent permitted by applicable
* law, without malicious intent or gross negligence; in no event may
* licensor, an author or contributor be held liable for any indirect
* or other damage, or direct damage except proven a consequence of a
* direct error of said person and intended use of this work, loss or
* other issues arising in any way out of its use, even if advised of
* the possibility of such damage or existence of a defect.
*- *-
* The strlcat() code below has been written by Thorsten Glaser. Bodo * The strlcat() code below has been written by Thorsten Glaser. Bodo
* Eggert suggested optimising the strlcpy() code, originally written * Eggert suggested optimising the strlcpy() code, originally written
* by Todd C. Miller (see below), which was carried out by Th. Glaser * by Todd C. Miller (see below), which was carried out by Th. Glaser
* as well as writing wcslcat() and wcslcpy() equivalents. * as well as merging this code with strxfrm() for ISO-10646-only sy-
* stems and writing wcslcat(), wcslcpy() and wcsxfrm() equivalents.
*/ */
#ifdef STRXFRM
#undef HAVE_STRLCPY
#undef HAVE_STRLCAT
#define HAVE_STRLCPY 0
#define HAVE_STRLCAT 1
#define strlcpy strxfrm
#endif
#include <sys/types.h> #include <sys/types.h>
#if defined(_KERNEL) || defined(_STANDALONE) #if defined(_KERNEL) || defined(_STANDALONE)
#include <lib/libkern/libkern.h> #include <lib/libkern/libkern.h>
@ -41,7 +43,6 @@
#include "config.h" #include "config.h"
#endif #endif
#endif #endif
extern size_t strlen(const char *);
#endif #endif
#ifndef __RCSID #ifndef __RCSID
@ -71,7 +72,9 @@ extern size_t strlen(const char *);
#define __predict_false(exp) ((exp) != 0) #define __predict_false(exp) ((exp) != 0)
#endif #endif
__RCSID("$MirOS: src/bin/mksh/strlfun.c,v 1.7 2006/11/09 15:02:31 tg Exp $"); #if !defined(_KERNEL) && !defined(_STANDALONE)
__RCSID("$MirOS: src/bin/mksh/strlfun.c,v 1.8 2007/01/09 17:34:21 tg Exp $");
#endif
size_t strlcpy(char *, const char *, size_t); size_t strlcpy(char *, const char *, size_t);