diff options
author | cvs2svn <cvs2svn@FreeBSD.org> | 2000-04-02 07:41:18 +0000 |
---|---|---|
committer | cvs2svn <cvs2svn@FreeBSD.org> | 2000-04-02 07:41:18 +0000 |
commit | b42951578188c5aab5c9f8cbcde4a743f8092cdc (patch) | |
tree | 87e472177973ff9d0a59ecabd43cb630c6936af9 /lib/libc/string | |
parent | d45e1e2b8b3d88e925564212283fb9072a911a32 (diff) | |
download | FreeBSD-src-b42951578188c5aab5c9f8cbcde4a743f8092cdc.zip FreeBSD-src-b42951578188c5aab5c9f8cbcde4a743f8092cdc.tar.gz |
This commit was manufactured by cvs2svn to create branch 'ALSA'.
Diffstat (limited to 'lib/libc/string')
72 files changed, 0 insertions, 5595 deletions
diff --git a/lib/libc/string/Makefile.inc b/lib/libc/string/Makefile.inc deleted file mode 100644 index 6e05691..0000000 --- a/lib/libc/string/Makefile.inc +++ /dev/null @@ -1,33 +0,0 @@ -# @(#)Makefile.inc 8.1 (Berkeley) 6/4/93 -# $FreeBSD$ - -.PATH: ${.CURDIR}/../libc/${MACHINE_ARCH}/string ${.CURDIR}/../libc/string - -CFLAGS += -I${.CURDIR}/../libc/locale - -# machine-independent string sources -MISRCS+=bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \ - memcpy.c memmove.c memset.c rindex.c strcasecmp.c strcat.c strchr.c \ - strcmp.c strcoll.c strcpy.c strcspn.c strdup.c strerror.c \ - strlcat.c strlcpy.c strlen.c strmode.c strncat.c strncmp.c strncpy.c \ - strpbrk.c strrchr.c strsep.c strsignal.c strspn.c strstr.c strtok.c \ - strxfrm.c swab.c - -# machine-dependent string sources -.include "${.CURDIR}/../libc/${MACHINE_ARCH}/string/Makefile.inc" - -.if ${LIB} == "c" -MAN3+= bcmp.3 bcopy.3 bstring.3 bzero.3 ffs.3 index.3 memccpy.3 memchr.3 \ - memcmp.3 memcpy.3 memmove.3 memset.3 rindex.3 strcasecmp.3 strcat.3 \ - strchr.3 strcmp.3 strcoll.3 strcpy.3 strcspn.3 strdup.3 strerror.3 \ - string.3 strlcpy.3 strlen.3 strmode.3 strpbrk.3 strrchr.3 strsep.3 \ - strspn.3 strstr.3 strtok.3 strxfrm.3 swab.3 - -MLINKS+=strcasecmp.3 strncasecmp.3 -MLINKS+=strcat.3 strncat.3 -MLINKS+=strcmp.3 strncmp.3 -MLINKS+=strcpy.3 strncpy.3 -MLINKS+=strerror.3 perror.3 strerror.3 sys_errlist.3 strerror.3 sys_nerr.3 -MLINKS+=strlcpy.3 strlcat.3 -MLINKS+=strtok.3 strtok_r.3 -.endif diff --git a/lib/libc/string/bcmp.3 b/lib/libc/string/bcmp.3 deleted file mode 100644 index 808cf0d..0000000 --- a/lib/libc/string/bcmp.3 +++ /dev/null @@ -1,72 +0,0 @@ -.\" Copyright (c) 1990, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" Chris Torek. -.\" 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 the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. -.\" -.\" @(#)bcmp.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD$ -.\" -.Dd June 4, 1993 -.Dt BCMP 3 -.Os BSD 4.2 -.Sh NAME -.Nm bcmp -.Nd compare byte string -.Sh SYNOPSIS -.Fd #include <string.h> -.Ft int -.Fn bcmp "const void *b1" "const void *b2" "size_t len" -.Sh DESCRIPTION -The -.Fn bcmp -function -compares byte string -.Fa b1 -against byte string -.Fa b2 , -returning zero if they are identical, non-zero otherwise. -Both strings are assumed to be -.Fa len -bytes long. -Zero-length strings are always identical. -.Pp -The strings may overlap. -.Sh SEE ALSO -.Xr memcmp 3 , -.Xr strcasecmp 3 , -.Xr strcmp 3 , -.Xr strcoll 3 , -.Xr strxfrm 3 -.Sh HISTORY -A -.Fn bcmp -function first appeared in -.Bx 4.2 . diff --git a/lib/libc/string/bcmp.c b/lib/libc/string/bcmp.c deleted file mode 100644 index 5a3ae61..0000000 --- a/lib/libc/string/bcmp.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 1987, 1993 - * The Regents of the University of California. 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 the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)bcmp.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include <string.h> - -/* - * bcmp -- vax cmpc3 instruction - */ -int -bcmp(b1, b2, length) - const void *b1, *b2; - register size_t length; -{ - register char *p1, *p2; - - if (length == 0) - return(0); - p1 = (char *)b1; - p2 = (char *)b2; - do - if (*p1++ != *p2++) - break; - while (--length); - return(length); -} diff --git a/lib/libc/string/bcopy.3 b/lib/libc/string/bcopy.3 deleted file mode 100644 index 7d44916..0000000 --- a/lib/libc/string/bcopy.3 +++ /dev/null @@ -1,72 +0,0 @@ -.\" Copyright (c) 1990, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" Chris Torek. -.\" -.\" 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 the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. -.\" -.\" @(#)bcopy.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD$ -.\" -.Dd June 4, 1993 -.Dt BCOPY 3 -.Os BSD 4.2 -.Sh NAME -.Nm bcopy -.Nd copy byte string -.Sh SYNOPSIS -.Fd #include <string.h> -.Ft void -.Fn bcopy "const void *src" "void *dst" "size_t len" -.Sh DESCRIPTION -The -.Fn bcopy -function -copies -.Fa len -bytes from string -.Fa src -to string -.Fa dst . -The two strings may overlap. -If -.Fa len -is zero, no bytes are copied. -.Sh SEE ALSO -.Xr memccpy 3 , -.Xr memcpy 3 , -.Xr memmove 3 , -.Xr strcpy 3 , -.Xr strncpy 3 -.Sh HISTORY -A -.Fn bcopy -function appeared in -.Bx 4.2 . diff --git a/lib/libc/string/bcopy.c b/lib/libc/string/bcopy.c deleted file mode 100644 index f90b09c..0000000 --- a/lib/libc/string/bcopy.c +++ /dev/null @@ -1,139 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Chris Torek. - * - * 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 the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)bcopy.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include <sys/cdefs.h> -#include <string.h> - -/* - * sizeof(word) MUST BE A POWER OF TWO - * SO THAT wmask BELOW IS ALL ONES - */ -typedef int word; /* "word" used for optimal copy speed */ - -#define wsize sizeof(word) -#define wmask (wsize - 1) - -/* - * Copy a block of memory, handling overlap. - * This is the routine that actually implements - * (the portable versions of) bcopy, memcpy, and memmove. - */ -#ifdef MEMCOPY -void * -memcpy(dst0, src0, length) -#else -#ifdef MEMMOVE -void * -memmove(dst0, src0, length) -#else -void -bcopy(src0, dst0, length) -#endif -#endif - void *dst0; - const void *src0; - register size_t length; -{ - register char *dst = dst0; - register const char *src = src0; - register size_t t; - - if (length == 0 || dst == src) /* nothing to do */ - goto done; - - /* - * Macros: loop-t-times; and loop-t-times, t>0 - */ -#define TLOOP(s) if (t) TLOOP1(s) -#define TLOOP1(s) do { s; } while (--t) - - if ((unsigned long)dst < (unsigned long)src) { - /* - * Copy forward. - */ - t = (int)src; /* only need low bits */ - if ((t | (int)dst) & wmask) { - /* - * Try to align operands. This cannot be done - * unless the low bits match. - */ - if ((t ^ (int)dst) & wmask || length < wsize) - t = length; - else - t = wsize - (t & wmask); - length -= t; - TLOOP1(*dst++ = *src++); - } - /* - * Copy whole words, then mop up any trailing bytes. - */ - t = length / wsize; - TLOOP(*(word *)dst = *(word *)src; src += wsize; dst += wsize); - t = length & wmask; - TLOOP(*dst++ = *src++); - } else { - /* - * Copy backwards. Otherwise essentially the same. - * Alignment works as before, except that it takes - * (t&wmask) bytes to align, not wsize-(t&wmask). - */ - src += length; - dst += length; - t = (int)src; - if ((t | (int)dst) & wmask) { - if ((t ^ (int)dst) & wmask || length <= wsize) - t = length; - else - t &= wmask; - length -= t; - TLOOP1(*--dst = *--src); - } - t = length / wsize; - TLOOP(src -= wsize; dst -= wsize; *(word *)dst = *(word *)src); - t = length & wmask; - TLOOP(*--dst = *--src); - } -done: -#if defined(MEMCOPY) || defined(MEMMOVE) - return (dst0); -#else - return; -#endif -} diff --git a/lib/libc/string/bstring.3 b/lib/libc/string/bstring.3 deleted file mode 100644 index a1c091f..0000000 --- a/lib/libc/string/bstring.3 +++ /dev/null @@ -1,110 +0,0 @@ -.\" Copyright (c) 1990, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" Chris Torek. -.\" 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 the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. -.\" -.\" @(#)bstring.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD$ -.\" -.Dd June 4, 1993 -.Dt BSTRING 3 -.Os -.Sh NAME -.Nm bcmp , -.Nm bcopy , -.Nm bzero , -.Nm memccpy , -.Nm memchr , -.Nm memcmp , -.Nm memcpy , -.Nm memmove, -.Nm memset -.Nd byte string operations -.Sh SYNOPSIS -.Fd #include <string.h> -.Ft int -.Fn bcmp "const void *b1" "const void *b2" "size_t len" -.Ft void -.Fn bcopy "const void *src" "void *dst" "size_t len" -.Ft void -.Fn bzero "void *b" "size_t len" -.Ft void * -.Fn memchr "const void *b" "int c" "size_t len" -.Ft int -.Fn memcmp "const void *b1" "const void *b2" "size_t len" -.Ft void * -.Fn memccpy "void *dst" "const void *src" "int c" "size_t len" -.Ft void * -.Fn memcpy "void *dst" "const void *src" "size_t len" -.Ft void * -.Fn memmove "void *dst" "const void *src" "size_t len" -.Ft void * -.Fn memset "void *b" "int c" "size_t len" -.Sh DESCRIPTION -These functions operate on variable length strings of bytes. -They do not check for terminating null bytes as the routines -listed in -.Xr string 3 -do. -.Pp -See the specific manual pages for more information. -.Sh SEE ALSO -.Xr bcmp 3 , -.Xr bcopy 3 , -.Xr bzero 3 , -.Xr memccpy 3 , -.Xr memchr 3 , -.Xr memcmp 3 , -.Xr memcpy 3 , -.Xr memmove 3 , -.Xr memset 3 -.Sh STANDARDS -The functions -.Fn memchr , -.Fn memcmp , -.Fn memcpy , -.Fn memmove , -and -.Fn memset -conform to -.St -ansiC . -.Sh HISTORY -The functions -.Fn bzero -and -.Fn memccpy -appeared in -.Bx 4.3 ; -the functions -.Fn bcmp , -.Fn bcopy , -appeared in -.Bx 4.2 . diff --git a/lib/libc/string/bzero.3 b/lib/libc/string/bzero.3 deleted file mode 100644 index 78dd8c0..0000000 --- a/lib/libc/string/bzero.3 +++ /dev/null @@ -1,69 +0,0 @@ -.\" Copyright (c) 1990, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" Chris Torek. -.\" -.\" 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 the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. -.\" -.\" @(#)bzero.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD$ -.\" -.Dd June 4, 1993 -.Dt BZERO 3 -.Os BSD 4.3 -.Sh NAME -.Nm bzero -.Nd write zeroes to a byte string -.Sh SYNOPSIS -.Fd #include <string.h> -.Ft void -.Fn bzero "void *b" "size_t len" -.Sh DESCRIPTION -The -.Fn bzero -function -writes -.Fa len -zero bytes to the string -.Fa b . -If -.Fa len -is zero, -.Fn bzero -does nothing. -.Sh SEE ALSO -.Xr memset 3 , -.Xr swab 3 -.Sh HISTORY -A -.Fn bzero -function -appeared in -.Bx 4.3 . diff --git a/lib/libc/string/bzero.c b/lib/libc/string/bzero.c deleted file mode 100644 index 7bc2b3a..0000000 --- a/lib/libc/string/bzero.c +++ /dev/null @@ -1,2 +0,0 @@ -#define BZERO -#include "memset.c" diff --git a/lib/libc/string/ffs.3 b/lib/libc/string/ffs.3 deleted file mode 100644 index 2794a44..0000000 --- a/lib/libc/string/ffs.3 +++ /dev/null @@ -1,62 +0,0 @@ -.\" Copyright (c) 1990, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" Chris Torek. -.\" 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 the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. -.\" -.\" @(#)ffs.3 8.2 (Berkeley) 4/19/94 -.\" $FreeBSD$ -.\" -.Dd April 19, 1994 -.Dt FFS 3 -.Os -.Sh NAME -.Nm ffs -.Nd find first bit set in a bit string -.Sh SYNOPSIS -.Fd #include <string.h> -.Ft int -.Fn ffs "int value" -.Sh DESCRIPTION -The -.Fn ffs -function finds the first bit set in -.Fa value -and returns the index of that bit. -Bits are numbered starting from 1, starting at the right-most -bit. -A return value of 0 means that the argument was zero. -.Sh SEE ALSO -.Xr bitstring 3 -.Sh HISTORY -The -.Fn ffs -function appeared in -.Bx 4.3 . diff --git a/lib/libc/string/ffs.c b/lib/libc/string/ffs.c deleted file mode 100644 index 099ff8e..0000000 --- a/lib/libc/string/ffs.c +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. 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 the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)ffs.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include <string.h> - -/* - * ffs -- vax ffs instruction - */ -int -ffs(mask) - register int mask; -{ - register int bit; - - if (mask == 0) - return(0); - for (bit = 1; !(mask & 1); bit++) - mask >>= 1; - return(bit); -} diff --git a/lib/libc/string/index.3 b/lib/libc/string/index.3 deleted file mode 100644 index 298101d..0000000 --- a/lib/libc/string/index.3 +++ /dev/null @@ -1,81 +0,0 @@ -.\" Copyright (c) 1990, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" Chris Torek. -.\" 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 the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. -.\" -.\" @(#)index.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD$ -.\" -.Dd June 4, 1993 -.Dt INDEX 3 -.Os -.Sh NAME -.Nm index -.Nd locate character in string -.Sh SYNOPSIS -.Fd #include <string.h> -.Ft char * -.Fn index "const char *s" "int c" -.Sh DESCRIPTION -The -.Fn index -function -locates the first character matching -.Fa c -(converted to a -.Em char ) -in the null-terminated string -.Fa s . -.Sh RETURN VALUES -A pointer to the character is returned if it is found; otherwise -.Dv NULL -is returned. -If -.Fa c -is '\e0', -.Fn index -locates the terminating '\e0'. -.Sh SEE ALSO -.Xr memchr 3 , -.Xr rindex 3 , -.Xr strchr 3 , -.Xr strcspn 3 , -.Xr strpbrk 3 , -.Xr strrchr 3 , -.Xr strsep 3 , -.Xr strspn 3 , -.Xr strstr 3 , -.Xr strtok 3 -.Sh HISTORY -A -.Fn index -function appeared in -.At v6 . diff --git a/lib/libc/string/index.c b/lib/libc/string/index.c deleted file mode 100644 index 37e505f..0000000 --- a/lib/libc/string/index.c +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. 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 the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)index.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include <sys/cdefs.h> -#include <string.h> -#include <stddef.h> - -char * -#ifdef STRCHR -strchr(p, ch) -#else -index(p, ch) -#endif - register const char *p, ch; -{ - for (;; ++p) { - if (*p == ch) - return((char *)p); - if (!*p) - return((char *)NULL); - } - /* NOTREACHED */ -} diff --git a/lib/libc/string/memccpy.3 b/lib/libc/string/memccpy.3 deleted file mode 100644 index 794486f..0000000 --- a/lib/libc/string/memccpy.3 +++ /dev/null @@ -1,74 +0,0 @@ -.\" Copyright (c) 1990, 1991, 1993 -.\" The Regents of the University of California. 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 the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. -.\" -.\" @(#)memccpy.3 8.1 (Berkeley) 6/9/93 -.\" $FreeBSD$ -.\" -.Dd June 9, 1993 -.Dt MEMCCPY 3 -.Os -.Sh NAME -.Nm memccpy -.Nd copy string until character found -.Sh SYNOPSIS -.Fd #include <string.h> -.Ft void * -.Fn memccpy "void *dst" "const void *src" "int c" "size_t len" -.Sh DESCRIPTION -The -.Fn memccpy -function -copies bytes from string -.Fa src -to string -.Fa dst . -If the character -.Fa c -(as converted to an unsigned char) occurs in the string -.Fa src , -the copy stops and a pointer to the byte after the copy of -.Fa c -in the string -.Fa dst -is returned. -Otherwise, -.Fa len -bytes are copied, and a NULL pointer is returned. -.Sh SEE ALSO -.Xr bcopy 3 , -.Xr memcpy 3 , -.Xr memmove 3 , -.Xr strcpy 3 -.Sh HISTORY -The -.Fn memccpy -function first appeared in -.Bx 4.4 . diff --git a/lib/libc/string/memccpy.c b/lib/libc/string/memccpy.c deleted file mode 100644 index c457110..0000000 --- a/lib/libc/string/memccpy.c +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. 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 the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)memccpy.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include <sys/cdefs.h> -#include <string.h> - -void * -memccpy(t, f, c, n) - void *t; - const void *f; - int c; - register size_t n; -{ - - if (n) { - register unsigned char *tp = t; - register const unsigned char *fp = f; - register unsigned char uc = c; - do { - if ((*tp++ = *fp++) == uc) - return (tp); - } while (--n != 0); - } - return (0); -} diff --git a/lib/libc/string/memchr.3 b/lib/libc/string/memchr.3 deleted file mode 100644 index 2469d60..0000000 --- a/lib/libc/string/memchr.3 +++ /dev/null @@ -1,82 +0,0 @@ -.\" Copyright (c) 1990, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" Chris Torek and the American National Standards Committee X3, -.\" on Information Processing Systems. -.\" -.\" 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 the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. -.\" -.\" @(#)memchr.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD$ -.\" -.Dd June 4, 1993 -.Dt MEMCHR 3 -.Os -.Sh NAME -.Nm memchr -.Nd locate byte in byte string -.Sh SYNOPSIS -.Fd #include <string.h> -.Ft void * -.Fn memchr "const void *b" "int c" "size_t len" -.Sh DESCRIPTION -The -.Fn memchr -function -locates the first occurrence of -.Fa c -(converted to an unsigned char) -in string -.Fa b . -.Sh RETURN VALUES -The -.Fn memchr -function -returns a pointer to the byte located, -or NULL if no such byte exists within -.Fa len -bytes. -.Sh SEE ALSO -.Xr index 3 , -.Xr rindex 3 , -.Xr strchr 3 , -.Xr strcspn 3 , -.Xr strpbrk 3 , -.Xr strrchr 3 , -.Xr strsep 3 , -.Xr strspn 3 , -.Xr strstr 3 , -.Xr strtok 3 -.Sh STANDARDS -The -.Fn memchr -function -conforms to -.St -ansiC . diff --git a/lib/libc/string/memchr.c b/lib/libc/string/memchr.c deleted file mode 100644 index 7200894..0000000 --- a/lib/libc/string/memchr.c +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Chris Torek. - * - * 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 the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)memchr.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include <sys/cdefs.h> -#include <string.h> - -void * -memchr(s, c, n) - const void *s; - register unsigned char c; - register size_t n; -{ - if (n != 0) { - register const unsigned char *p = s; - - do { - if (*p++ == c) - return ((void *)(p - 1)); - } while (--n != 0); - } - return (NULL); -} diff --git a/lib/libc/string/memcmp.3 b/lib/libc/string/memcmp.3 deleted file mode 100644 index 3939425..0000000 --- a/lib/libc/string/memcmp.3 +++ /dev/null @@ -1,83 +0,0 @@ -.\" Copyright (c) 1990, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" Chris Torek and the American National Standards Committee X3, -.\" on Information Processing Systems. -.\" -.\" 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 the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. -.\" -.\" @(#)memcmp.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD$ -.\" -.Dd June 4, 1993 -.Dt MEMCMP 3 -.Os -.Sh NAME -.Nm memcmp -.Nd compare byte string -.Sh SYNOPSIS -.Fd #include <string.h> -.Ft int -.Fn memcmp "const void *b1" "const void *b2" "size_t len" -.Sh DESCRIPTION -The -.Fn memcmp -function -compares byte string -.Fa b1 -against byte string -.Fa b2 . -Both strings are assumed to be -.Fa len -bytes long. -.Sh RETURN VALUES -The -.Fn memcmp -function -returns zero if the two strings are identical, -otherwise returns the difference between the first two differing bytes -(treated as unsigned char values, so that -.Sq Li \e200 -is greater than -.Sq Li \&\e0 , -for example). -Zero-length strings are always identical. -.Sh SEE ALSO -.Xr bcmp 3 , -.Xr strcasecmp 3 , -.Xr strcmp 3 , -.Xr strcoll 3 , -.Xr strxfrm 3 -.Sh STANDARDS -The -.Fn memcmp -function -conforms to -.St -ansiC . diff --git a/lib/libc/string/memcmp.c b/lib/libc/string/memcmp.c deleted file mode 100644 index d025d89..0000000 --- a/lib/libc/string/memcmp.c +++ /dev/null @@ -1,61 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Chris Torek. - * - * 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 the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)memcmp.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include <sys/cdefs.h> -#include <string.h> - -/* - * Compare memory regions. - */ -int -memcmp(s1, s2, n) - const void *s1, *s2; - size_t n; -{ - if (n != 0) { - register const unsigned char *p1 = s1, *p2 = s2; - - do { - if (*p1++ != *p2++) - return (*--p1 - *--p2); - } while (--n != 0); - } - return (0); -} diff --git a/lib/libc/string/memcpy.3 b/lib/libc/string/memcpy.3 deleted file mode 100644 index 942c521..0000000 --- a/lib/libc/string/memcpy.3 +++ /dev/null @@ -1,84 +0,0 @@ -.\" Copyright (c) 1990, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" Chris Torek and the American National Standards Committee X3, -.\" on Information Processing Systems. -.\" -.\" 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 the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. -.\" -.\" @(#)memcpy.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD$ -.\" -.Dd June 4, 1993 -.Dt MEMCPY 3 -.Os -.Sh NAME -.Nm memcpy -.Nd copy byte string -.Sh SYNOPSIS -.Fd #include <string.h> -.Ft void * -.Fn memcpy "void *dst" "const void *src" "size_t len" -.Sh DESCRIPTION -The -.Fn memcpy -function -copies -.Fa len -bytes from string -.Fa src -to string -.Fa dst . -.Sh RETURN VALUES -The -.Fn memcpy -function -returns the original value of -.Fa dst . -.Sh SEE ALSO -.Xr bcopy 3 , -.Xr memccpy 3 , -.Xr memmove 3 , -.Xr strcpy 3 -.Sh STANDARDS -The -.Fn memcpy -function -conforms to -.St -ansiC . -.Sh BUGS -In this implementation -.Fn memcpy -is implemented using -.Xr bcopy 3 , -and therefore the strings may overlap. -On other systems, copying overlapping strings may produce surprises. -A simpler solution is to not use -.Fn memcpy . diff --git a/lib/libc/string/memcpy.c b/lib/libc/string/memcpy.c deleted file mode 100644 index ee11504..0000000 --- a/lib/libc/string/memcpy.c +++ /dev/null @@ -1,2 +0,0 @@ -#define MEMCOPY -#include "bcopy.c" diff --git a/lib/libc/string/memmove.3 b/lib/libc/string/memmove.3 deleted file mode 100644 index 7355600..0000000 --- a/lib/libc/string/memmove.3 +++ /dev/null @@ -1,76 +0,0 @@ -.\" Copyright (c) 1990, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" Chris Torek and the American National Standards Committee X3, -.\" on Information Processing Systems. -.\" -.\" 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 the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. -.\" -.\" @(#)memmove.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD$ -.\" -.Dd June 4, 1993 -.Dt MEMMOVE 3 -.Os -.Sh NAME -.Nm memmove -.Nd copy byte string -.Sh SYNOPSIS -.Fd #include <string.h> -.Ft void * -.Fn memmove "void *dst" "const void *src" "size_t len" -.Sh DESCRIPTION -The -.Fn memmove -function -copies -.Fa len -bytes from string -.Fa src -to string -.Fa dst . -The two strings may overlap; -the copy is always done in a non-destructive manner. -.Sh RETURN VALUES -The -.Fn memmove -function returns the original value of -.Fa dst . -.Sh SEE ALSO -.Xr bcopy 3 , -.Xr memccpy 3 , -.Xr memcpy 3 , -.Xr strcpy 3 -.Sh STANDARDS -The -.Fn memmove -function -conforms to -.St -ansiC . diff --git a/lib/libc/string/memmove.c b/lib/libc/string/memmove.c deleted file mode 100644 index e9bb2c2..0000000 --- a/lib/libc/string/memmove.c +++ /dev/null @@ -1,2 +0,0 @@ -#define MEMMOVE -#include "bcopy.c" diff --git a/lib/libc/string/memset.3 b/lib/libc/string/memset.3 deleted file mode 100644 index 9896514..0000000 --- a/lib/libc/string/memset.3 +++ /dev/null @@ -1,71 +0,0 @@ -.\" Copyright (c) 1990, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" Chris Torek and the American National Standards Committee X3, -.\" on Information Processing Systems. -.\" -.\" 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 the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. -.\" -.\" @(#)memset.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD$ -.\" -.Dd June 4, 1993 -.Dt MEMSET 3 -.Os -.Sh NAME -.Nm memset -.Nd write a byte to byte string -.Sh SYNOPSIS -.Fd #include <string.h> -.Ft void * -.Fn memset "void *b" "int c" "size_t len" -.Sh DESCRIPTION -The -.Fn memset -function -writes -.Fa len -bytes of value -.Fa c -(converted to an unsigned char) to the string -.Fa b . -.Sh RETURNS -The -.Fn memset -function returns its first argument. -.Sh SEE ALSO -.Xr bzero 3 , -.Xr swab 3 -.Sh STANDARDS -The -.Fn memset -function -conforms to -.St -ansiC . diff --git a/lib/libc/string/memset.c b/lib/libc/string/memset.c deleted file mode 100644 index afe5f96..0000000 --- a/lib/libc/string/memset.c +++ /dev/null @@ -1,132 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Mike Hibler and Chris Torek. - * - * 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 the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)memset.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include <sys/types.h> - -#include <limits.h> -#include <string.h> - -#define wsize sizeof(u_int) -#define wmask (wsize - 1) - -#ifdef BZERO -#define RETURN return -#define VAL 0 -#define WIDEVAL 0 - -void -bzero(dst0, length) - void *dst0; - register size_t length; -#else -#define RETURN return (dst0) -#define VAL c0 -#define WIDEVAL c - -void * -memset(dst0, c0, length) - void *dst0; - register int c0; - register size_t length; -#endif -{ - register size_t t; -#ifndef BZERO - register u_int c; -#endif - register u_char *dst; - - dst = dst0; - /* - * If not enough words, just fill bytes. A length >= 2 words - * guarantees that at least one of them is `complete' after - * any necessary alignment. For instance: - * - * |-----------|-----------|-----------| - * |00|01|02|03|04|05|06|07|08|09|0A|00| - * ^---------------------^ - * dst dst+length-1 - * - * but we use a minimum of 3 here since the overhead of the code - * to do word writes is substantial. - */ - if (length < 3 * wsize) { - while (length != 0) { - *dst++ = VAL; - --length; - } - RETURN; - } - -#ifndef BZERO - if ((c = (u_char)c0) != 0) { /* Fill the word. */ - c = (c << 8) | c; /* u_int is 16 bits. */ -#if UINT_MAX > 0xffff - c = (c << 16) | c; /* u_int is 32 bits. */ -#endif -#if UINT_MAX > 0xffffffff - c = (c << 32) | c; /* u_int is 64 bits. */ -#endif - } -#endif - /* Align destination by filling in bytes. */ - if ((t = (long)dst & wmask) != 0) { - t = wsize - t; - length -= t; - do { - *dst++ = VAL; - } while (--t != 0); - } - - /* Fill words. Length was >= 2*words so we know t >= 1 here. */ - t = length / wsize; - do { - *(u_int *)dst = WIDEVAL; - dst += wsize; - } while (--t != 0); - - /* Mop up trailing bytes, if any. */ - t = length & wmask; - if (t != 0) - do { - *dst++ = VAL; - } while (--t != 0); - RETURN; -} diff --git a/lib/libc/string/rindex.3 b/lib/libc/string/rindex.3 deleted file mode 100644 index 7a5c478..0000000 --- a/lib/libc/string/rindex.3 +++ /dev/null @@ -1,83 +0,0 @@ -.\" Copyright (c) 1990, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" Chris Torek. -.\" 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 the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. -.\" -.\" @(#)rindex.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD$ -.\" -.Dd June 4, 1993 -.Dt RINDEX 3 -.Os -.Sh NAME -.Nm rindex -.Nd locate character in string -.Sh SYNOPSIS -.Fd #include <string.h> -.Ft char * -.Fn rindex "const char *s" "int c" -.Sh DESCRIPTION -The -.Fn rindex -function -locates the last character -matching -.Fa c -(converted to a -.Em char ) -in the null-terminated string -.Fa s . -.Sh RETURN VALUES -A pointer to the character is returned if it is found; otherwise -NULL is returned. -If -.Fa c -is -.Ql \e0 , -.Fn rindex -locates the terminating -.Ql \e0 . -.Sh SEE ALSO -.Xr index 3 , -.Xr memchr 3 , -.Xr strchr 3 , -.Xr strcspn 3 , -.Xr strpbrk 3 , -.Xr strrchr 3 , -.Xr strsep 3 , -.Xr strspn 3 , -.Xr strstr 3 , -.Xr strtok 3 -.Sh HISTORY -A -.Fn rindex -function appeared in -.At v6 . diff --git a/lib/libc/string/rindex.c b/lib/libc/string/rindex.c deleted file mode 100644 index 69dced4..0000000 --- a/lib/libc/string/rindex.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 1988, 1993 - * The Regents of the University of California. 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 the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)rindex.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include <stddef.h> -#include <string.h> - -char * -#ifdef STRRCHR -strrchr(p, ch) -#else -rindex(p, ch) -#endif - register const char *p; - register int ch; -{ - register char *save; - - for (save = NULL;; ++p) { - if (*p == ch) - save = (char *)p; - if (!*p) - return(save); - } - /* NOTREACHED */ -} diff --git a/lib/libc/string/strcasecmp.3 b/lib/libc/string/strcasecmp.3 deleted file mode 100644 index 4521a06..0000000 --- a/lib/libc/string/strcasecmp.3 +++ /dev/null @@ -1,90 +0,0 @@ -.\" Copyright (c) 1990, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" Chris Torek. -.\" 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 the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. -.\" -.\" @(#)strcasecmp.3 8.1 (Berkeley) 6/9/93 -.\" $FreeBSD$ -.\" -.Dd June 9, 1993 -.Dt STRCASECMP 3 -.Os -.Sh NAME -.Nm strcasecmp , -.Nm strncasecmp -.Nd compare strings, ignoring case -.Sh SYNOPSIS -.Fd #include <string.h> -.Ft int -.Fn strcasecmp "const char *s1" "const char *s2" -.Ft int -.Fn strncasecmp "const char *s1" "const char *s2" "size_t len" -.Sh DESCRIPTION -The -.Fn strcasecmp -and -.Fn strncasecmp -functions -compare the null-terminated strings -.Fa s1 -and -.Fa s2 -and return an integer greater than, equal to, or less than 0, -according as -.Fa s1 -is lexicographically greater than, equal to, or less than -.Fa s2 -after translation of each corresponding character to lower-case. -The strings themselves are not modified. -The comparison is done using unsigned characters, so that -.Sq Li \e200 -is greater than -.Ql \e0 . -.Pp -The -.Fn strncasecmp -compares at most -.Fa len -characters. -.Sh SEE ALSO -.Xr bcmp 3 , -.Xr memcmp 3 , -.Xr strcmp 3 , -.Xr strcoll 3 , -.Xr strxfrm 3 , -.Xr tolower 3 -.Sh HISTORY -The -.Fn strcasecmp -and -.Fn strncasecmp -functions first appeared in -.Bx 4.4 . diff --git a/lib/libc/string/strcasecmp.c b/lib/libc/string/strcasecmp.c deleted file mode 100644 index 463c4de..0000000 --- a/lib/libc/string/strcasecmp.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 1987, 1993 - * The Regents of the University of California. 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 the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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> -#include <string.h> -#include <ctype.h> - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)strcasecmp.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -typedef unsigned char u_char; - -int -strcasecmp(s1, s2) - const char *s1, *s2; -{ - register const u_char - *us1 = (const u_char *)s1, - *us2 = (const u_char *)s2; - - while (tolower(*us1) == tolower(*us2++)) - if (*us1++ == '\0') - return (0); - return (tolower(*us1) - tolower(*--us2)); -} - -int -strncasecmp(s1, s2, n) - const char *s1, *s2; - register size_t n; -{ - if (n != 0) { - register const u_char - *us1 = (const u_char *)s1, - *us2 = (const u_char *)s2; - - do { - if (tolower(*us1) != tolower(*us2++)) - return (tolower(*us1) - tolower(*--us2)); - if (*us1++ == '\0') - break; - } while (--n != 0); - } - return (0); -} diff --git a/lib/libc/string/strcat.3 b/lib/libc/string/strcat.3 deleted file mode 100644 index 1f0aad2..0000000 --- a/lib/libc/string/strcat.3 +++ /dev/null @@ -1,99 +0,0 @@ -.\" Copyright (c) 1990, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" Chris Torek and the American National Standards Committee X3, -.\" on Information Processing Systems. -.\" -.\" 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 the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. -.\" -.\" @(#)strcat.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD$ -.\" -.Dd June 4, 1993 -.Dt STRCAT 3 -.Os -.Sh NAME -.Nm strcat -.Nd concatenate strings -.Sh SYNOPSIS -.Fd #include <string.h> -.Ft char * -.Fn strcat "char *s" "const char *append" -.Ft char * -.Fn strncat "char *s" "const char *append" "size_t count" -.Sh DESCRIPTION -The -.Fn strcat -and -.Fn strncat -functions -append a copy of the null-terminated string -.Fa append -to the end of the null-terminated string -.Fa s , -then add a terminating -.Ql \e0 . -The string -.Fa s -must have sufficient space to hold the result. -.Pp -The -.Fn strncat -function -appends not more than -.Fa count -characters from -.Fa append , -and then adds a terminating -.Ql \e0. -.Sh RETURN VALUES -The -.Fn strcat -and -.Fn strncat -functions -return the pointer -.Fa s . -.Sh SEE ALSO -.Xr bcopy 3 , -.Xr memccpy 3 , -.Xr memcpy 3 , -.Xr memmove 3 , -.Xr strcpy 3 , -.Xr strlcat 3 , -.Xr strlcpy 3 -.Sh STANDARDS -The -.Fn strcat -and -.Fn strncat -functions -conform to -.St -ansiC . diff --git a/lib/libc/string/strcat.c b/lib/libc/string/strcat.c deleted file mode 100644 index 95dcd1d..0000000 --- a/lib/libc/string/strcat.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 1988, 1993 - * The Regents of the University of California. 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 the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)strcat.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include <string.h> - -char * -strcat(s, append) - register char *s; - register const char *append; -{ - char *save = s; - - for (; *s; ++s); - while ((*s++ = *append++)); - return(save); -} diff --git a/lib/libc/string/strchr.3 b/lib/libc/string/strchr.3 deleted file mode 100644 index 8b5b892..0000000 --- a/lib/libc/string/strchr.3 +++ /dev/null @@ -1,88 +0,0 @@ -.\" Copyright (c) 1990, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" Chris Torek and the American National Standards Committee X3, -.\" on Information Processing Systems. -.\" -.\" 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 the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. -.\" -.\" @(#)strchr.3 8.2 (Berkeley) 4/19/94 -.\" $FreeBSD$ -.\" -.Dd April 19, 1994 -.Dt STRCHR 3 -.Os -.Sh NAME -.Nm strchr -.Nd locate character in string -.Sh SYNOPSIS -.Fd #include <string.h> -.Ft char * -.Fn strchr "const char *s" "int c" -.Sh DESCRIPTION -The -.Fn strchr -function locates the first occurrence of -.Ar c -in the string pointed to by -.Ar s . -The terminating -.Dv NUL -character is considered part of the string. -If -.Fa c -is -.Ql \e0 , -.Fn strchr -locates the terminating -.Ql \e0 . -.Sh RETURN VALUES -The function -.Fn strchr -returns a pointer to the located character, or -.Dv NULL -if the character does not appear in the string. -.Sh SEE ALSO -.Xr index 3 , -.Xr memchr 3 , -.Xr rindex 3 , -.Xr strcspn 3 , -.Xr strpbrk 3 , -.Xr strrchr 3 , -.Xr strsep 3 , -.Xr strspn 3 , -.Xr strstr 3 , -.Xr strtok 3 -.Sh STANDARDS -The -.Fn strchr -function -conforms to -.St -ansiC . diff --git a/lib/libc/string/strchr.c b/lib/libc/string/strchr.c deleted file mode 100644 index ee33662..0000000 --- a/lib/libc/string/strchr.c +++ /dev/null @@ -1,2 +0,0 @@ -#define STRCHR -#include "index.c" diff --git a/lib/libc/string/strcmp.3 b/lib/libc/string/strcmp.3 deleted file mode 100644 index 45abbc4..0000000 --- a/lib/libc/string/strcmp.3 +++ /dev/null @@ -1,95 +0,0 @@ -.\" Copyright (c) 1990, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" Chris Torek and the American National Standards Committee X3, -.\" on Information Processing Systems. -.\" -.\" 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 the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. -.\" -.\" @(#)strcmp.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD$ -.\" -.Dd June 4, 1993 -.Dt STRCMP 3 -.Os -.Sh NAME -.Nm strcmp , -.Nm strncmp -.Nd compare strings -.Sh SYNOPSIS -.Fd #include <string.h> -.Ft int -.Fn strcmp "const char *s1" "const char *s2" -.Ft int -.Fn strncmp "const char *s1" "const char *s2" "size_t len" -.Sh DESCRIPTION -The -.Fn strcmp -and -.Fn strncmp -functions -lexicographically compare the null-terminated strings -.Fa s1 -and -.Fa s2 . -.Pp -The -.Fn strncmp -compares not more than -.Fa len -characters. -.Sh RETURN VALUES -The -.Fn strcmp -and -.Fn strncmp -return an integer greater than, equal to, or less than 0, according -as the string -.Fa s1 -is greater than, equal to, or less than the string -.Fa s2 . -The comparison is done using unsigned characters, so that -.Ql \e200 -is greater than -.Ql \e0 . -.Sh SEE ALSO -.Xr bcmp 3 , -.Xr memcmp 3 , -.Xr strcasecmp 3 , -.Xr strcoll 3 , -.Xr strxfrm 3 -.Sh STANDARDS -The -.Fn strcmp -and -.Fn strncmp -functions -conform to -.St -ansiC . diff --git a/lib/libc/string/strcmp.c b/lib/libc/string/strcmp.c deleted file mode 100644 index cf25e50..0000000 --- a/lib/libc/string/strcmp.c +++ /dev/null @@ -1,55 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Chris Torek. - * - * 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 the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)strcmp.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include <sys/cdefs.h> -#include <string.h> - -/* - * Compare strings. - */ -int -strcmp(s1, s2) - register const char *s1, *s2; -{ - while (*s1 == *s2++) - if (*s1++ == 0) - return (0); - return (*(const unsigned char *)s1 - *(const unsigned char *)(s2 - 1)); -} diff --git a/lib/libc/string/strcoll.3 b/lib/libc/string/strcoll.3 deleted file mode 100644 index 2d72fe3..0000000 --- a/lib/libc/string/strcoll.3 +++ /dev/null @@ -1,73 +0,0 @@ -.\" Copyright (c) 1990, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" Chris Torek and the American National Standards Committee X3, -.\" on Information Processing Systems. -.\" -.\" 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 the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. -.\" -.\" @(#)strcoll.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD$ -.\" -.Dd June 4, 1993 -.Dt STRCOLL 3 -.Os -.Sh NAME -.Nm strcoll -.Nd compare strings according to current collation -.Sh SYNOPSIS -.Fd #include <string.h> -.Ft int -.Fn strcoll "const char *s1" "const char *s2" -.Sh DESCRIPTION -The -.Fn strcoll -function -lexicographically compares the null-terminated strings -.Fa s1 -and -.Fa s2 -according to the current locale collation if any, otherwise call -.Fa strcmp , -and returns an integer greater than, equal to, or less than 0, -according as -.Fa s1 -is greater than, equal to, or less than -.Fa s2 . -.Sh SEE ALSO -.Xr setlocale 3 , -.Xr strcmp 3 , -.Xr strxfrm 3 -.Sh STANDARDS -The -.Fn strcoll -function -conforms to -.St -ansiC . diff --git a/lib/libc/string/strcoll.c b/lib/libc/string/strcoll.c deleted file mode 100644 index 5213cf8..0000000 --- a/lib/libc/string/strcoll.c +++ /dev/null @@ -1,85 +0,0 @@ -/*- - * Copyright (c) 1995 Alex Tatmanjants <alex@elvisti.kiev.ua> - * at Electronni Visti IA, Kiev, Ukraine. - * 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. - * - * 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. - * - * $FreeBSD$ - */ - -#include <stdlib.h> -#include <string.h> -#include "collate.h" - -int -strcoll(s, s2) - const char *s, *s2; -{ - int len, len2, prim, prim2, sec, sec2, ret, ret2; - const char *t, *t2; - char *tt, *tt2; - - if (__collate_load_error) - return strcmp(s, s2); - - len = len2 = 1; - ret = ret2 = 0; - if (__collate_substitute_nontrivial) { - t = tt = __collate_substitute(s); - t2 = tt2 = __collate_substitute(s2); - } else { - tt = tt2 = NULL; - t = s; - t2 = s2; - } - while(*t && *t2) { - prim = prim2 = 0; - while(*t && !prim) { - __collate_lookup(t, &len, &prim, &sec); - t += len; - } - while(*t2 && !prim2) { - __collate_lookup(t2, &len2, &prim2, &sec2); - t2 += len2; - } - if(!prim || !prim2) - break; - if(prim != prim2) { - ret = prim - prim2; - goto end; - } - if(!ret2) - ret2 = sec - sec2; - } - if(!*t && *t2) - ret = -(int)((u_char)*t2); - else if(*t && !*t2) - ret = (u_char)*t; - else if(!*t && !*t2) - ret = ret2; - end: - free(tt); - free(tt2); - - return ret; -} diff --git a/lib/libc/string/strcpy.3 b/lib/libc/string/strcpy.3 deleted file mode 100644 index 0ecb732..0000000 --- a/lib/libc/string/strcpy.3 +++ /dev/null @@ -1,123 +0,0 @@ -.\" Copyright (c) 1990, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" Chris Torek and the American National Standards Committee X3, -.\" on Information Processing Systems. -.\" -.\" 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 the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. -.\" -.\" @(#)strcpy.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD$ -.\" -.Dd June 4, 1993 -.Dt STRCPY 3 -.Os BSD 4 -.Sh NAME -.Nm strcpy -.Nd copy strings -.Sh SYNOPSIS -.Fd #include <string.h> -.Ft char * -.Fn strcpy "char *dst" "const char *src" -.Ft char * -.Fn strncpy "char *dst" "const char *src" "size_t len" -.Sh DESCRIPTION -The -.Fn strcpy -and -.Fn strncpy -functions -copy the string -.Fa src -to -.Fa dst -(including the terminating -.Ql \e0 -character). -.Pp -The -.Fn strncpy -copies not more than -.Fa len -characters into -.Fa dst , -appending -.Ql \e0 -characters if -.Fa src -is less than -.Fa len -characters long, and -.Em not -terminating -.Fa dst -if -.Fa src -is more than -.Fa len -characters long. -.Sh RETURN VALUES -The -.Fn strcpy -and -.Fn strncpy -functions -return -.Fa dst . -.Sh EXAMPLES -The following sets -.Dq Li chararray -to -.Dq Li abc\e0\e0\e0 : -.Bd -literal -offset indent -(void)strncpy(chararray, "abc", 6). -.Ed -.Pp -The following sets -.Dq Li chararray -to -.Dq Li abcdef : -.Bd -literal -offset indent -(void)strncpy(chararray, "abcdefgh", 6); -.Ed -.Sh SEE ALSO -.Xr bcopy 3 , -.Xr memccpy 3 , -.Xr memcpy 3 , -.Xr memmove 3 , -.Xr strlcpy 3 -.Sh STANDARDS -The -.Fn strcpy -and -.Fn strncpy -functions -conform to -.St -ansiC . diff --git a/lib/libc/string/strcpy.c b/lib/libc/string/strcpy.c deleted file mode 100644 index c9b44b1..0000000 --- a/lib/libc/string/strcpy.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 1988, 1993 - * The Regents of the University of California. 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 the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)strcpy.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include <sys/cdefs.h> -#include <string.h> - -char * -strcpy(to, from) - register char *to; - register const char *from; -{ - char *save = to; - - for (; (*to = *from); ++from, ++to); - return(save); -} diff --git a/lib/libc/string/strcspn.3 b/lib/libc/string/strcspn.3 deleted file mode 100644 index 6590cb5..0000000 --- a/lib/libc/string/strcspn.3 +++ /dev/null @@ -1,85 +0,0 @@ -.\" Copyright (c) 1990, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" Chris Torek and the American National Standards Committee X3, -.\" on Information Processing Systems. -.\" -.\" 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 the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. -.\" -.\" @(#)strcspn.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD$ -.\" -.Dd June 4, 1993 -.Dt STRCSPN 3 -.Os -.Sh NAME -.Nm strcspn -.Nd span the complement of a string -.Sh SYNOPSIS -.Fd #include <string.h> -.Ft size_t -.Fn strcspn "const char *s" "const char *charset" -.Sh DESCRIPTION -The -.Fn strcspn -function -spans the initial part of the null-terminated string -.Fa s -as long as the characters from -.Fa s -do not occur in string -.Fa charset -(it -spans the -.Em complement -of -.Fa charset ) . -.Sh RETURN VALUES -The -.Fn strcspn -function -returns the number of characters spanned. -.Sh SEE ALSO -.Xr index 3 , -.Xr memchr 3 , -.Xr rindex 3 , -.Xr strchr 3 , -.Xr strpbrk 3 , -.Xr strrchr 3 , -.Xr strsep 3 , -.Xr strspn 3 , -.Xr strstr 3 , -.Xr strtok 3 -.Sh STANDARDS -The -.Fn strcspn -function -conforms to -.St -ansiC . diff --git a/lib/libc/string/strcspn.c b/lib/libc/string/strcspn.c deleted file mode 100644 index a1c2e1d..0000000 --- a/lib/libc/string/strcspn.c +++ /dev/null @@ -1,68 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Chris Torek. - * - * 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 the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)strcspn.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include <sys/cdefs.h> -#include <string.h> - -/* - * Span the complement of string s2. - */ -size_t -strcspn(s1, s2) - const char *s1; - register const char *s2; -{ - register const char *p, *spanp; - register char c, sc; - - /* - * Stop as soon as we find any character from s2. Note that there - * must be a NUL in s2; it suffices to stop when we find that, too. - */ - for (p = s1;;) { - c = *p++; - spanp = s2; - do { - if ((sc = *spanp++) == c) - return (p - 1 - s1); - } while (sc != 0); - } - /* NOTREACHED */ -} diff --git a/lib/libc/string/strdup.3 b/lib/libc/string/strdup.3 deleted file mode 100644 index 53c1d39..0000000 --- a/lib/libc/string/strdup.3 +++ /dev/null @@ -1,65 +0,0 @@ -.\" Copyright (c) 1990, 1991, 1993 -.\" The Regents of the University of California. 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 the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. -.\" -.\" @(#)strdup.3 8.1 (Berkeley) 6/9/93 -.\" $FreeBSD$ -.\" -.Dd June 9, 1993 -.Dt STRDUP 3 -.Os -.Sh NAME -.Nm strdup -.Nd save a copy of a string -.Sh SYNOPSIS -.Fd #include <string.h> -.Ft char * -.Fn strdup "const char *str" -.Sh DESCRIPTION -The -.Fn strdup -function -allocates sufficient memory for a copy -of the string -.Fa str , -does the copy, and returns a pointer to it. -The pointer may subsequently be used as an -argument to the function -.Xr free 3 . -.Pp -If insufficient memory is available, NULL is returned. -.Sh SEE ALSO -.Xr free 3 , -.Xr malloc 3 -.Sh HISTORY -The -.Fn strdup -function first appeared in -.Bx 4.4 . diff --git a/lib/libc/string/strdup.c b/lib/libc/string/strdup.c deleted file mode 100644 index a1c2eed..0000000 --- a/lib/libc/string/strdup.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 1988, 1993 - * The Regents of the University of California. 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 the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)strdup.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include <stddef.h> -#include <stdlib.h> -#include <string.h> - -char * -strdup(str) - const char *str; -{ - size_t len; - char *copy; - - len = strlen(str) + 1; - if ((copy = malloc(len)) == NULL) - return (NULL); - memcpy(copy, str, len); - return (copy); -} diff --git a/lib/libc/string/strerror.3 b/lib/libc/string/strerror.3 deleted file mode 100644 index a0f6b42..0000000 --- a/lib/libc/string/strerror.3 +++ /dev/null @@ -1,128 +0,0 @@ -.\" Copyright (c) 1980, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" the American National Standards Committee X3, on Information -.\" Processing Systems. -.\" -.\" 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 the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. -.\" -.\" @(#)strerror.3 8.1 (Berkeley) 6/9/93 -.\" $FreeBSD$ -.\" -.Dd June 9, 1993 -.Dt STRERROR 3 -.Os BSD 4 -.Sh NAME -.Nm perror , -.Nm strerror , -.Nm sys_errlist , -.Nm sys_nerr -.Nd system error messages -.Sh SYNOPSIS -.Fd #include <stdio.h> -.Ft void -.Fn perror "const char *string" -.Vt extern const char * const sys_errlist[]; -.Vt extern const int sys_nerr; -.Fd #include <string.h> -.Ft char * -.Fn strerror "int errnum" -.Sh DESCRIPTION -The -.Fn strerror -and -.Fn perror -functions look up the error message string corresponding to an -error number. -.Pp -The -.Fn strerror -function accepts an error number argument -.Fa errnum -and -returns a pointer to the corresponding -message string. -.Pp -The -.Fn perror -function finds the error message corresponding to the current -value of the global variable -.Va errno -.Pq Xr intro 2 -and writes it, followed by a newline, to the -standard error file descriptor. -If the argument -.Fa string -is -.Pf non- Dv NULL -and does not point to the null character, -this string is prepended to the message -string and separated from it by -a colon and space -.Pq Ql \&:\ \& ; -otherwise, only the error message string is printed. -.Pp -If -.Fa errnum -is not a recognized error number, -the error message string will contain -.Dq Li "Unknown error:\0 -followed by the error number in decimal. -.Pp -The message strings can be accessed directly using the external -array -.Va sys_errlist . -The external value -.Va sys_nerr -contains a count of the messages in -.Va sys_errlist . -The use of these variables is deprecated; -.Fn strerror -should be used instead. -.Sh SEE ALSO -.Xr intro 2 , -.Xr psignal 3 -.Sh HISTORY -The -.Fn strerror -and -.Fn perror -functions first appeared in -.Bx 4.4 . -.Sh BUGS -For unknown error numbers, the -.Fn strerror -function will return its result in a static buffer which -may be overwritten by subsequent calls. -.Pp -Programs that use the deprecated -.Va sys_errlist -variable often fail to compile because they declare it -inconsistently. diff --git a/lib/libc/string/strerror.c b/lib/libc/string/strerror.c deleted file mode 100644 index 5acefd9..0000000 --- a/lib/libc/string/strerror.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 1988, 1993 - * The Regents of the University of California. 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 the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)strerror.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include <stdio.h> -#include <string.h> - -char * -strerror(num) - int num; -{ -#define UPREFIX "Unknown error: " - static char ebuf[40] = UPREFIX; /* 64-bit number + slop */ - register unsigned int errnum; - register char *p, *t; - char tmp[40]; - - errnum = num; /* convert to unsigned */ - if (errnum < sys_nerr) - return ((char *)sys_errlist[errnum]); - - /* Do this by hand, so we don't link to stdio(3). */ - t = tmp; - if (num < 0) - errnum = -errnum; - do { - *t++ = "0123456789"[errnum % 10]; - } while (errnum /= 10); - if (num < 0) - *t++ = '-'; - for (p = ebuf + sizeof(UPREFIX) - 1;;) { - *p++ = *--t; - if (t <= tmp) - break; - } - *p = '\0'; - return (ebuf); -} diff --git a/lib/libc/string/string.3 b/lib/libc/string/string.3 deleted file mode 100644 index 947a745..0000000 --- a/lib/libc/string/string.3 +++ /dev/null @@ -1,156 +0,0 @@ -.\" Copyright (c) 1990, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" Chris Torek. -.\" 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 the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. -.\" -.\" @(#)string.3 8.2 (Berkeley) 12/11/93 -.\" $FreeBSD$ -.\" -.Dd December 11, 1993 -.Dt STRING 3 -.Os BSD 4 -.Sh NAME -.Nm strcat , -.Nm strncat , -.Nm strchr , -.Nm strrchr , -.Nm strcmp , -.Nm strncmp , -.Nm strcasecmp, -.Nm strncasecmp , -.Nm strcpy , -.Nm strncpy , -.Nm strerror , -.Nm strlen , -.Nm strpbrk , -.Nm strsep, -.Nm strspn , -.Nm strcspn , -.Nm strstr , -.Nm strtok , -.Nm index , -.Nm rindex -.Nd string specific functions -.Sh SYNOPSIS -.Fd #include <string.h> -.Ft char * -.Fn strcat "char *s" "const char * append" -.Ft char * -.Fn strncat "char *s" "const char *append" "size_t count" -.Ft char * -.Fn strchr "const char *s" "int c" -.Ft char * -.Fn strrchr "const char *s" "int c" -.Ft int -.Fn strcmp "const char *s1" "const char *s2" -.Ft int -.Fn strncmp "const char *s1" "const char *s2" "size_t count" -.Ft int -.Fn strcasecmp "const char *s1" "const char *s2" -.Ft int -.Fn strncasecmp "const char *s1" "const char *s2" "size_t count" -.Ft char * -.Fn strcpy "char *dst" "const char *src" -.Ft char * -.Fn strncpy "char *dst" "const char *src" "size_t count" -.Ft char * -.Fn strerror "int errno" -.Ft size_t -.Fn strlen "const char *s" -.Ft char * -.Fn strpbrk "const char *s" "const char *charset" -.Ft char * -.Fn strsep "char **stringp" "const char *delim" -.Ft size_t -.Fn strspn "const char *s" "const char *charset" -.Ft size_t -.Fn strcspn "const char *s" "const char *charset" -.Ft char * -.Fn strstr "const char *big" "const char *little" -.Ft char * -.Fn strtok "char *s" "const char *delim" -.Ft char * -.Fn index "const char *s" "int c" -.Ft char * -.Fn rindex "const char *s" "int c" -.Sh DESCRIPTION -The string -functions manipulate strings terminated by a -null byte. -.Pp -See the specific manual pages for more information. -For manipulating variable length generic objects as byte -strings (without the null byte check), see -.Xr bstring 3 . -.Pp -Except as noted in their specific manual pages, -the string functions do not test the destination -for size limitations. -.Sh SEE ALSO -.Xr bstring 3 , -.Xr index 3 , -.Xr rindex 3 , -.Xr strcasecmp 3 , -.Xr strcat 3 , -.Xr strchr 3 , -.Xr strcmp 3 , -.Xr strcpy 3 , -.Xr strcspn 3 , -.Xr strerror 3 , -.Xr strlen 3 , -.Xr strpbrk 3 , -.Xr strrchr 3 , -.Xr strsep 3 , -.Xr strspn 3 , -.Xr strstr 3 , -.Xr strtok 3 -.Sh STANDARDS -The -.Fn strcat , -.Fn strncat , -.Fn strchr , -.Fn strrchr , -.Fn strcmp , -.Fn strncmp , -.Fn strcpy , -.Fn strncpy , -.Fn strerror , -.Fn strlen , -.Fn strpbrk , -.Fn strsep , -.Fn strspn , -.Fn strcspn , -.Fn strstr , -and -.Fn strtok -functions -conform to -.St -ansiC . diff --git a/lib/libc/string/strlcat.c b/lib/libc/string/strlcat.c deleted file mode 100644 index 599994e..0000000 --- a/lib/libc/string/strlcat.c +++ /dev/null @@ -1,71 +0,0 @@ -/* $OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp $ */ - -/* - * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> - * 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. 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 ``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. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp $"; -#endif /* LIBC_SCCS and not lint */ - -#include <sys/types.h> -#include <string.h> - -/* - * Appends src to string dst of size siz (unlike strncat, siz is the - * full size of dst, not space left). At most siz-1 characters - * will be copied. Always NUL terminates (unless siz == 0). - * Returns strlen(src); if retval >= siz, truncation occurred. - */ -size_t strlcat(dst, src, siz) - char *dst; - const char *src; - size_t siz; -{ - register char *d = dst; - register const char *s = src; - register size_t n = siz; - size_t dlen; - - /* Find the end of dst and adjust bytes left but don't go past end */ - while (*d != '\0' && n-- != 0) - d++; - dlen = d - dst; - n = siz - dlen; - - if (n == 0) - return(dlen + strlen(s)); - while (*s != '\0') { - if (n != 1) { - *d++ = *s; - n--; - } - s++; - } - *d = '\0'; - - return(dlen + (s - src)); /* count does not include NUL */ -} diff --git a/lib/libc/string/strlcpy.3 b/lib/libc/string/strlcpy.3 deleted file mode 100644 index e1dddee..0000000 --- a/lib/libc/string/strlcpy.3 +++ /dev/null @@ -1,157 +0,0 @@ -.\" $OpenBSD: strlcpy.3,v 1.5 1999/06/06 15:17:32 aaron Exp $ -.\" -.\" Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> -.\" 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. 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 ``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. -.\" -.\" $FreeBSD$ -.\" -.Dd June 22, 1998 -.Dt STRLCPY 3 -.Os -.Sh NAME -.Nm strlcpy , -.Nm strlcat -.Nd size-bounded string copying and concatenation -.Sh SYNOPSIS -.Fd #include <string.h> -.Ft size_t -.Fn strlcpy "char *dst" "const char *src" "size_t size" -.Ft size_t -.Fn strlcat "char *dst" "const char *src" "size_t size" -.Sh DESCRIPTION -The -.Fn strlcpy -and -.Fn strlcat -functions copy and concatenate strings respectively. They are designed -to be safer, more consistent, and less error prone replacements for -.Xr strncpy 3 -and -.Xr strncat 3 . -Unlike those functions, -.Fn strlcpy -and -.Fn strlcat -take the full size of the buffer (not just the length) and guarantee to -NUL-terminate the result (as long as -.Fa size -is larger than 0). Note that you should include a byte for the NUL in -.Fa size . -.Pp -The -.Fn strlcpy -function copies up to -.Fa size -- 1 characters from the NUL-terminated string -.Fa src -to -.Fa dst , -NUL-terminating the result. -.Pp -The -.Fn strlcat -function appends the NUL-terminated string -.Fa src -to the end of -.Fa dst . -It will append at most -.Fa size -- strlen(dst) - 1 bytes, NUL-terminating the result. -.Sh RETURN VALUES -The -.Fn strlcpy -and -.Fn strlcat -functions return the total length of the string they tried to -create. For -.Fn strlcpy -that means the length of -.Fa src . -For -.Fn strlcat -that means the initial length of -.Fa dst -plus -the length of -.Fa src . -While this may seem somewhat confusing it was done to make -truncation detection simple. -.Sh EXAMPLES -The following code fragment illustrates the simple case: -.Bd -literal -offset indent -char *s, *p, buf[BUFSIZ]; - -.Li ... - -(void)strlcpy(buf, s, sizeof(buf)); -(void)strlcat(buf, p, sizeof(buf)); -.Ed -.Pp -To detect truncation, perhaps while building a pathname, something -like the following might be used: -.Bd -literal -offset indent -char *dir, *file, pname[MAXPATHNAMELEN]; - -.Li ... - -if (strlcpy(pname, dir, sizeof(pname)) >= sizeof(pname)) - goto toolong; -if (strlcat(pname, file, sizeof(pname)) >= sizeof(pname)) - goto toolong; -.Ed -.Pp -Since we know how many characters we copied the first time, we can -speed things up a bit by using a copy instead on an append: -.Bd -literal -offset indent -char *dir, *file, pname[MAXPATHNAMELEN]; -size_t n; - -.Li ... - -n = strlcpy(pname, dir, sizeof(pname)); -if (n >= sizeof(pname)) - goto toolong; -if (strlcpy(pname + n, file, sizeof(pname) - n) >= sizeof(pname) - n) - goto toolong; -.Ed -.Pp -However, one may question the validity of such optimizations, as they -defeat the whole purpose of -.Fn strlcpy -and -.Fn strlcat . -As a matter of fact, the first version of this manual page got it wrong. -.Sh SEE ALSO -.Xr snprintf 3 , -.Xr strncat 3 , -.Xr strncpy 3 -.Sh HISTORY -.Fn strlcpy -and -.Fn strlcat -functions first appeared in -.Ox 2.4 , -and made their appearance in -.Fx 3.3 . diff --git a/lib/libc/string/strlcpy.c b/lib/libc/string/strlcpy.c deleted file mode 100644 index 300a28b..0000000 --- a/lib/libc/string/strlcpy.c +++ /dev/null @@ -1,68 +0,0 @@ -/* $OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp $ */ - -/* - * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> - * 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. 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 ``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. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp $"; -#endif /* LIBC_SCCS and not lint */ - -#include <sys/types.h> -#include <string.h> - -/* - * Copy src to string dst of size siz. At most siz-1 characters - * will be copied. Always NUL terminates (unless siz == 0). - * Returns strlen(src); if retval >= siz, truncation occurred. - */ -size_t strlcpy(dst, src, siz) - char *dst; - const char *src; - size_t siz; -{ - register char *d = dst; - register const char *s = src; - register size_t n = siz; - - /* Copy as many bytes as will fit */ - if (n != 0 && --n != 0) { - do { - if ((*d++ = *s++) == 0) - break; - } while (--n != 0); - } - - /* Not enough room in dst, add NUL and traverse rest of src */ - if (n == 0) { - if (siz != 0) - *d = '\0'; /* NUL-terminate dst */ - while (*s++) - ; - } - - return(s - src - 1); /* count does not include NUL */ -} diff --git a/lib/libc/string/strlen.3 b/lib/libc/string/strlen.3 deleted file mode 100644 index 6514424..0000000 --- a/lib/libc/string/strlen.3 +++ /dev/null @@ -1,71 +0,0 @@ -.\" Copyright (c) 1990, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" Chris Torek and the American National Standards Committee X3, -.\" on Information Processing Systems. -.\" -.\" 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 the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. -.\" -.\" @(#)strlen.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD$ -.\" -.Dd June 4, 1993 -.Dt STRLEN 3 -.Os -.Sh NAME -.Nm strlen -.Nd find length of string -.Sh SYNOPSIS -.Fd #include <string.h> -.Ft size_t -.Fn strlen "const char *s" -.Sh DESCRIPTION -The -.Fn strlen -function -computes the length of the string -.Fa s . -.Sh RETURN VALUES -The -.Fn strlen -function -returns -the number of characters that precede the -terminating -.Dv NUL -character. -.Sh SEE ALSO -.Xr string 3 -.Sh STANDARDS -The -.Fn strlen -function -conforms to -.St -ansiC . diff --git a/lib/libc/string/strlen.c b/lib/libc/string/strlen.c deleted file mode 100644 index 323fbe4..0000000 --- a/lib/libc/string/strlen.c +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. 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 the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)strlen.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include <sys/cdefs.h> -#include <string.h> - -size_t -strlen(str) - const char *str; -{ - register const char *s; - - for (s = str; *s; ++s); - return(s - str); -} - diff --git a/lib/libc/string/strmode.3 b/lib/libc/string/strmode.3 deleted file mode 100644 index ca9bbc1..0000000 --- a/lib/libc/string/strmode.3 +++ /dev/null @@ -1,151 +0,0 @@ -.\" Copyright (c) 1990, 1991, 1993 -.\" The Regents of the University of California. 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 the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. -.\" -.\" @(#)strmode.3 8.3 (Berkeley) 7/28/94 -.\" $FreeBSD$ -.\" -.Dd July 28, 1994 -.Dt STRMODE 3 -.Os -.Sh NAME -.Nm strmode -.Nd convert inode status information into a symbolic string -.Sh SYNOPSIS -.Fd #include <string.h> -.Ft void -.Fn strmode "mode_t mode" "char *bp" -.Sh DESCRIPTION -The -.Fn strmode -function -converts a file -.Fa mode -(the type and permission information associated with an inode, see -.Xr stat 2 ) -into a symbolic string which is stored in the location referenced by -.Fa bp . -This stored string is eleven characters in length plus a trailing -.Dv NUL . -.Pp -The first character is the inode type, and will be one of the following: -.Pp -.Bl -tag -width flag -offset indent -compact -.It \- -regular file -.It b -block special -.It c -character special -.It d -directory -.It l -symbolic link -.It p -fifo -.It s -socket -.It w -whiteout -.It ? -unknown inode type -.El -.Pp -The next nine characters encode three sets of permissions, in three -characters each. -The first three characters are the permissions for the owner of the -file, the second three for the group the file belongs to, and the -third for the ``other'', or default, set of users. -.Pp -Permission checking is done as specifically as possible. -If read permission is denied to the owner of a file in the first set -of permissions, the owner of the file will not be able to read the file. -This is true even if the owner is in the file's group and the group -permissions allow reading or the ``other'' permissions allow reading. -.Pp -If the first character of the three character set is an ``r'', the file is -readable for that set of users; if a dash ``\-'', it is not readable. -.Pp -If the second character of the three character set is a ``w'', the file is -writable for that set of users; if a dash ``\-'', it is not writable. -.Pp -The third character is the first of the following characters that apply: -.Bl -tag -width xxxx -.It S -If the character is part of the owner permissions and the file is not -executable or the directory is not searchable by the owner, and the -set-user-id bit is set. -.It S -If the character is part of the group permissions and the file is not -executable or the directory is not searchable by the group, and the -set-group-id bit is set. -.It T -If the character is part of the other permissions and the file is not -executable or the directory is not searchable by others, and the ``sticky'' -.Pq Dv S_ISVTX -bit is set. -.It s -If the character is part of the owner permissions and the file is -executable or the directory searchable by the owner, and the set-user-id -bit is set. -.It s -If the character is part of the group permissions and the file is -executable or the directory searchable by the group, and the set-group-id -bit is set. -.It t -If the character is part of the other permissions and the file is -executable or the directory searchable by others, and the ``sticky'' -.Pq Dv S_ISVTX -bit is set. -.It x -The file is executable or the directory is searchable. -.It \- -None of the above apply. -.El -.Pp -The last character is a plus sign ``+'' if any there are any alternate -or additional access control methods associated with the inode, otherwise -it will be a space. -.Sh RETURN VALUES -The -.Fn strmode -function -always returns 0. -.Sh SEE ALSO -.Xr chmod 1 , -.Xr find 1 , -.Xr stat 2 , -.Xr getmode 3 , -.Xr setmode 3 -.Sh HISTORY -The -.Fn strmode -function first appeared in -.Bx 4.4 . diff --git a/lib/libc/string/strmode.c b/lib/libc/string/strmode.c deleted file mode 100644 index 2c3f44a..0000000 --- a/lib/libc/string/strmode.c +++ /dev/null @@ -1,152 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. 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 the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)strmode.c 8.3 (Berkeley) 8/15/94"; -#endif /* LIBC_SCCS and not lint */ - -#include <sys/types.h> -#include <sys/stat.h> -#include <string.h> - -void -strmode(mode, p) - register mode_t mode; - register char *p; -{ - /* print type */ - switch (mode & S_IFMT) { - case S_IFDIR: /* directory */ - *p++ = 'd'; - break; - case S_IFCHR: /* character special */ - *p++ = 'c'; - break; - case S_IFBLK: /* block special */ - *p++ = 'b'; - break; - case S_IFREG: /* regular */ - *p++ = '-'; - break; - case S_IFLNK: /* symbolic link */ - *p++ = 'l'; - break; - case S_IFSOCK: /* socket */ - *p++ = 's'; - break; -#ifdef S_IFIFO - case S_IFIFO: /* fifo */ - *p++ = 'p'; - break; -#endif -#ifdef S_IFWHT - case S_IFWHT: /* whiteout */ - *p++ = 'w'; - break; -#endif - default: /* unknown */ - *p++ = '?'; - break; - } - /* usr */ - if (mode & S_IRUSR) - *p++ = 'r'; - else - *p++ = '-'; - if (mode & S_IWUSR) - *p++ = 'w'; - else - *p++ = '-'; - switch (mode & (S_IXUSR | S_ISUID)) { - case 0: - *p++ = '-'; - break; - case S_IXUSR: - *p++ = 'x'; - break; - case S_ISUID: - *p++ = 'S'; - break; - case S_IXUSR | S_ISUID: - *p++ = 's'; - break; - } - /* group */ - if (mode & S_IRGRP) - *p++ = 'r'; - else - *p++ = '-'; - if (mode & S_IWGRP) - *p++ = 'w'; - else - *p++ = '-'; - switch (mode & (S_IXGRP | S_ISGID)) { - case 0: - *p++ = '-'; - break; - case S_IXGRP: - *p++ = 'x'; - break; - case S_ISGID: - *p++ = 'S'; - break; - case S_IXGRP | S_ISGID: - *p++ = 's'; - break; - } - /* other */ - if (mode & S_IROTH) - *p++ = 'r'; - else - *p++ = '-'; - if (mode & S_IWOTH) - *p++ = 'w'; - else - *p++ = '-'; - switch (mode & (S_IXOTH | S_ISVTX)) { - case 0: - *p++ = '-'; - break; - case S_IXOTH: - *p++ = 'x'; - break; - case S_ISVTX: - *p++ = 'T'; - break; - case S_IXOTH | S_ISVTX: - *p++ = 't'; - break; - } - *p++ = ' '; /* will be a '+' if ACL's implemented */ - *p = '\0'; -} diff --git a/lib/libc/string/strncat.c b/lib/libc/string/strncat.c deleted file mode 100644 index 1b82a75..0000000 --- a/lib/libc/string/strncat.c +++ /dev/null @@ -1,68 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Chris Torek. - * - * 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 the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)strncat.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include <sys/cdefs.h> -#include <string.h> - -/* - * Concatenate src on the end of dst. At most strlen(dst)+n+1 bytes - * are written at dst (at most n+1 bytes being appended). Return dst. - */ -char * -strncat(dst, src, n) - char *dst; - const char *src; - register size_t n; -{ - if (n != 0) { - register char *d = dst; - register const char *s = src; - - while (*d != 0) - d++; - do { - if ((*d = *s++) == 0) - break; - d++; - } while (--n != 0); - *d = 0; - } - return (dst); -} diff --git a/lib/libc/string/strncmp.c b/lib/libc/string/strncmp.c deleted file mode 100644 index 4b701a9..0000000 --- a/lib/libc/string/strncmp.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 1989, 1993 - * The Regents of the University of California. 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 the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)strncmp.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include <sys/cdefs.h> -#include <string.h> - -int -strncmp(s1, s2, n) - register const char *s1, *s2; - register size_t n; -{ - - if (n == 0) - return (0); - do { - if (*s1 != *s2++) - return (*(const unsigned char *)s1 - - *(const unsigned char *)(s2 - 1)); - if (*s1++ == 0) - break; - } while (--n != 0); - return (0); -} diff --git a/lib/libc/string/strncpy.c b/lib/libc/string/strncpy.c deleted file mode 100644 index 9e72740..0000000 --- a/lib/libc/string/strncpy.c +++ /dev/null @@ -1,68 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Chris Torek. - * - * 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 the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)strncpy.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include <sys/cdefs.h> -#include <string.h> - -/* - * Copy src to dst, truncating or null-padding to always copy n bytes. - * Return dst. - */ -char * -strncpy(dst, src, n) - char *dst; - const char *src; - register size_t n; -{ - if (n != 0) { - register char *d = dst; - register const char *s = src; - - do { - if ((*d++ = *s++) == 0) { - /* NUL pad the remaining n-1 bytes */ - while (--n != 0) - *d++ = 0; - break; - } - } while (--n != 0); - } - return (dst); -} diff --git a/lib/libc/string/strpbrk.3 b/lib/libc/string/strpbrk.3 deleted file mode 100644 index 2b5cf12..0000000 --- a/lib/libc/string/strpbrk.3 +++ /dev/null @@ -1,80 +0,0 @@ -.\" Copyright (c) 1990, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" Chris Torek and the American National Standards Committee X3, -.\" on Information Processing Systems. -.\" -.\" 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 the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. -.\" -.\" @(#)strpbrk.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD$ -.\" -.Dd June 4, 1993 -.Dt STRPBRK 3 -.Os -.Sh NAME -.Nm strpbrk -.Nd locate multiple characters in string -.Sh SYNOPSIS -.Fd #include <string.h> -.Ft char * -.Fn strpbrk "const char *s" "const char *charset" -.Sh DESCRIPTION -The -.Fn strpbrk -function -locates in the null-terminated string -.Fa s -the first occurrence of any character in the string -.Fa charset -and returns a pointer to this character. -If no characters from -.Fa charset -occur anywhere in -.Fa s -.Fn strpbrk -returns NULL. -.Sh SEE ALSO -.Xr index 3 , -.Xr memchr 3 , -.Xr rindex 3 , -.Xr strchr 3 , -.Xr strcspn 3 , -.Xr strrchr 3 , -.Xr strsep 3 , -.Xr strspn 3 , -.Xr strstr 3 , -.Xr strtok 3 -.Sh STANDARDS -The -.Fn strpbrk -function -conforms to -.St -ansiC . diff --git a/lib/libc/string/strpbrk.c b/lib/libc/string/strpbrk.c deleted file mode 100644 index 119d8b7..0000000 --- a/lib/libc/string/strpbrk.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 1985, 1993 - * The Regents of the University of California. 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 the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)strpbrk.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include <sys/cdefs.h> -#include <string.h> - -/* - * Find the first occurrence in s1 of a character in s2 (excluding NUL). - */ -char * -strpbrk(s1, s2) - register const char *s1, *s2; -{ - register const char *scanp; - register int c, sc; - - while ((c = *s1++) != 0) { - for (scanp = s2; (sc = *scanp++) != 0;) - if (sc == c) - return ((char *)(s1 - 1)); - } - return (NULL); -} diff --git a/lib/libc/string/strrchr.3 b/lib/libc/string/strrchr.3 deleted file mode 100644 index c44996a..0000000 --- a/lib/libc/string/strrchr.3 +++ /dev/null @@ -1,91 +0,0 @@ -.\" Copyright (c) 1990, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" Chris Torek and the American National Standards Committee X3, -.\" on Information Processing Systems. -.\" -.\" 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 the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. -.\" -.\" @(#)strrchr.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD$ -.\" -.Dd June 4, 1993 -.Dt STRRCHR 3 -.Os -.Sh NAME -.Nm strrchr -.Nd locate character in string -.Sh SYNOPSIS -.Fd #include <string.h> -.Ft char * -.Fn strrchr "const char *s" "int c" -.Sh DESCRIPTION -The -.Fn strrchr -function -locates the last occurrence of -.Fa c -(converted to a char) -in the string -.Fa s . -If -.Fa c -is -.Ql \e0 , -.Fn strrchr -locates the terminating -.Ql \e0 . -.Sh RETURN VALUES -The -.Fn strrchr -function -returns a pointer to the character, -or a null -pointer if -.Fa c -does not occur anywhere in -.Fa s . -.Sh SEE ALSO -.Xr index 3 , -.Xr memchr 3 , -.Xr rindex 3 , -.Xr strchr 3 , -.Xr strcspn 3 , -.Xr strpbrk 3 , -.Xr strsep 3 , -.Xr strspn 3 , -.Xr strstr 3 , -.Xr strtok 3 -.Sh STANDARDS -The -.Fn strrchr -function -conforms to -.St -ansiC . diff --git a/lib/libc/string/strrchr.c b/lib/libc/string/strrchr.c deleted file mode 100644 index 8fcf3a1..0000000 --- a/lib/libc/string/strrchr.c +++ /dev/null @@ -1,2 +0,0 @@ -#define STRRCHR -#include "rindex.c" diff --git a/lib/libc/string/strsep.3 b/lib/libc/string/strsep.3 deleted file mode 100644 index f66d79e..0000000 --- a/lib/libc/string/strsep.3 +++ /dev/null @@ -1,110 +0,0 @@ -.\" Copyright (c) 1990, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" Chris Torek. -.\" -.\" 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 the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. -.\" -.\" @(#)strsep.3 8.1 (Berkeley) 6/9/93 -.\" $FreeBSD$ -.\" -.Dd June 9, 1993 -.Dt STRSEP 3 -.Os -.Sh NAME -.Nm strsep -.Nd separate strings -.Sh SYNOPSIS -.Fd #include <string.h> -.Ft char * -.Fn strsep "char **stringp" "const char *delim" -.Sh DESCRIPTION -The -.Fn strsep -function locates, in the string referenced by -.Fa *stringp , -the first occurrence of any character in the string -.Fa delim -(or the terminating -.Ql \e0 -character) and replaces it with a -.Ql \e0 . -The location of the next character after the delimiter character -(or NULL, if the end of the string was reached) is stored in -.Fa *stringp . -The original value of -.Fa *stringp -is returned. -.Pp -An ``empty'' field, i.e. one caused by two adjacent delimiter characters, -can be detected by comparing the location referenced by the pointer returned -in -.Fa *stringp -to -.Ql \e0 . -.Pp -If -.Fa *stringp -is initially -.Dv NULL , -.Fn strsep -returns -.Dv NULL . -.Sh EXAMPLES -The following uses -.Fn strsep -to parse a string, containing tokens delimited by white space, into an -argument vector: -.Bd -literal -offset indent -char **ap, *argv[10], *inputstring; - -for (ap = argv; (*ap = strsep(&inputstring, " \et")) != NULL;) - if (**ap != '\e0') - if (++ap >= &argv[10]) - break; -.Ed -.Sh HISTORY -The -.Fn strsep -function -is intended as a replacement for the -.Fn strtok -function. -While the -.Fn strtok -function should be preferred for portability reasons (it conforms to -.St -ansiC ) -it is unable to handle empty fields, i.e. detect fields delimited by -two adjacent delimiter characters, or to be used for more than a single -string at a time. -The -.Fn strsep -function first appeared in -.Bx 4.4 . diff --git a/lib/libc/string/strsep.c b/lib/libc/string/strsep.c deleted file mode 100644 index ddad596..0000000 --- a/lib/libc/string/strsep.c +++ /dev/null @@ -1,80 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. 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 the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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> -#include <string.h> -#include <stdio.h> - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)strsep.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -/* - * Get next token from string *stringp, where tokens are possibly-empty - * strings separated by characters from delim. - * - * Writes NULs into the string at *stringp to end tokens. - * delim need not remain constant from call to call. - * On return, *stringp points past the last NUL written (if there might - * be further tokens), or is NULL (if there are definitely no more tokens). - * - * If *stringp is NULL, strsep returns NULL. - */ -char * -strsep(stringp, delim) - register char **stringp; - register const char *delim; -{ - register char *s; - register const char *spanp; - register int c, sc; - char *tok; - - if ((s = *stringp) == NULL) - return (NULL); - for (tok = s;;) { - c = *s++; - spanp = delim; - do { - if ((sc = *spanp++) == c) { - if (c == 0) - s = NULL; - else - s[-1] = 0; - *stringp = s; - return (tok); - } - } while (sc != 0); - } - /* NOTREACHED */ -} diff --git a/lib/libc/string/strsignal.c b/lib/libc/string/strsignal.c deleted file mode 100644 index 5ec6365..0000000 --- a/lib/libc/string/strsignal.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 1988, 1993 - * The Regents of the University of California. 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 the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)strerror.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include <stdio.h> -#include <string.h> -#include <signal.h> - -char * -strsignal(num) - int num; -{ -#define UPREFIX "Unknown signal: " - static char ebuf[40] = UPREFIX; /* 64-bit number + slop */ - register unsigned int signum; - register char *p, *t; - char tmp[40]; - - signum = num; /* convert to unsigned */ - if (signum < sys_nsig) - return ((char *)sys_siglist[signum]); - - /* Do this by hand, so we don't link to stdio(3). */ - t = tmp; - if (num < 0) - signum = -signum; - do { - *t++ = "0123456789"[signum % 10]; - } while (signum /= 10); - if (num < 0) - *t++ = '-'; - for (p = ebuf + sizeof(UPREFIX) - 1;;) { - *p++ = *--t; - if (t <= tmp) - break; - } - *p = '\0'; - return (ebuf); -} diff --git a/lib/libc/string/strspn.3 b/lib/libc/string/strspn.3 deleted file mode 100644 index a33abc7..0000000 --- a/lib/libc/string/strspn.3 +++ /dev/null @@ -1,80 +0,0 @@ -.\" Copyright (c) 1990, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" Chris Torek and the American National Standards Committee X3, -.\" on Information Processing Systems. -.\" -.\" 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 the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. -.\" -.\" @(#)strspn.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD$ -.\" -.Dd June 4, 1993 -.Dt STRSPN 3 -.Os -.Sh NAME -.Nm strspn -.Nd span a string -.Sh SYNOPSIS -.Fd #include <string.h> -.Ft size_t -.Fn strspn "const char *s" "const char *charset" -.Sh DESCRIPTION -The -.Fn strspn -function -spans the initial part of the null-terminated string -.Fa s -as long as the characters from -.Fa s -occur in string -.Fa charset . -.Sh RETURN VALUES -The -.Fn strspn -function -returns the number of characters spanned. -.Sh SEE ALSO -.Xr index 3 , -.Xr memchr 3 , -.Xr rindex 3 , -.Xr strchr 3 , -.Xr strcspn 3 , -.Xr strpbrk 3 , -.Xr strrchr 3 , -.Xr strsep 3 , -.Xr strstr 3 , -.Xr strtok 3 -.Sh STANDARDS -The -.Fn strspn -function -conforms to -.St -ansiC . diff --git a/lib/libc/string/strspn.c b/lib/libc/string/strspn.c deleted file mode 100644 index 4676bd4..0000000 --- a/lib/libc/string/strspn.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 1989, 1993 - * The Regents of the University of California. 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 the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)strspn.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include <sys/cdefs.h> -#include <string.h> - -/* - * Span the string s2 (skip characters that are in s2). - */ -size_t -strspn(s1, s2) - const char *s1; - register const char *s2; -{ - register const char *p = s1, *spanp; - register char c, sc; - - /* - * Skip any characters in s2, excluding the terminating \0. - */ -cont: - c = *p++; - for (spanp = s2; (sc = *spanp++) != 0;) - if (sc == c) - goto cont; - return (p - 1 - s1); -} diff --git a/lib/libc/string/strstr.3 b/lib/libc/string/strstr.3 deleted file mode 100644 index dfd7ac2..0000000 --- a/lib/libc/string/strstr.3 +++ /dev/null @@ -1,89 +0,0 @@ -.\" Copyright (c) 1990, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" Chris Torek and the American National Standards Committee X3, -.\" on Information Processing Systems. -.\" -.\" 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 the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. -.\" -.\" @(#)strstr.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD$ -.\" -.Dd June 4, 1993 -.Dt STRSTR 3 -.Os -.Sh NAME -.Nm strstr -.Nd locate a substring in a string -.Sh SYNOPSIS -.Fd #include <string.h> -.Ft char * -.Fn strstr "const char *big" "const char *little" -.Sh DESCRIPTION -The -.Fn strstr -function -locates the first occurrence of the null-terminated string -.Fa little -in the null-terminated string -.Fa big . -If -.Fa little -is the empty string, -.Fn strstr -returns -.Fa big ; -if -.Fa little -occurs nowhere in -.Fa big , -.Fn strstr -returns NULL; -otherwise -.Fn strstr -returns a pointer to the first character of the first occurrence of -.Fa little . -.Sh SEE ALSO -.Xr index 3 , -.Xr memchr 3 , -.Xr rindex 3 , -.Xr strchr 3 , -.Xr strcspn 3 , -.Xr strpbrk 3 , -.Xr strrchr 3 , -.Xr strsep 3 , -.Xr strspn 3 , -.Xr strtok 3 -.Sh STANDARDS -The -.Fn strstr -function -conforms to -.St -ansiC . diff --git a/lib/libc/string/strstr.c b/lib/libc/string/strstr.c deleted file mode 100644 index 1f10961..0000000 --- a/lib/libc/string/strstr.c +++ /dev/null @@ -1,65 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Chris Torek. - * - * 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 the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)strstr.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include <sys/cdefs.h> -#include <string.h> - -/* - * Find the first occurrence of find in s. - */ -char * -strstr(s, find) - register const char *s, *find; -{ - register char c, sc; - register size_t len; - - if ((c = *find++) != 0) { - len = strlen(find); - do { - do { - if ((sc = *s++) == 0) - return (NULL); - } while (sc != c); - } while (strncmp(s, find, len) != 0); - s--; - } - return ((char *)s); -} diff --git a/lib/libc/string/strtok.3 b/lib/libc/string/strtok.3 deleted file mode 100644 index 26b3a1d..0000000 --- a/lib/libc/string/strtok.3 +++ /dev/null @@ -1,169 +0,0 @@ -.\" Copyright (c) 1998 Softweyr LLC. All rights reserved. -.\" -.\" strtok_r, from Berkeley strtok -.\" Oct 13, 1998 by Wes Peters <wes@softweyr.com> -.\" -.\" Copyright (c) 1988, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" the American National Standards Committee X3, on Information -.\" Processing Systems. -.\" -.\" 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 -.\" notices, this list of conditions and the following disclaimer. -.\" -.\" 2. Redistributions in binary form must reproduce the above -.\" copyright notices, 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 Softweyr LLC, the -.\" University of California, Berkeley, and its contributors. -.\" -.\" 4. Neither the name of Softweyr LLC, the University nor the names -.\" of its contributors may be used to endorse or promote products -.\" derived from this software without specific prior written -.\" permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY SOFTWEYR LLC, THE REGENTS AND -.\" CONTRIBUTORS ``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 SOFTWEYR LLC, THE REGENTS, OR -.\" CONTRIBUTORS 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. -.\" -.\" @(#)strtok.3 8.2 (Berkeley) 2/3/94 -.\" $FreeBSD$ -.\" -.Dd November 27, 1998 -.Dt STRTOK 3 -.Os FreeBSD 3.0 -.Sh NAME -.Nm strtok, strtok_r -.Nd string tokens -.Sh SYNOPSIS -.Fd #include <string.h> -.Ft char * -.Fn strtok "char *str" "const char *sep" -.Ft char * -.Fn strtok_r "char *str" "const char *sep" "char **last" -.Sh DESCRIPTION -.Bf -symbolic -This interface is obsoleted by strsep(3). -.Ef -.Pp -The -.Fn strtok -function -is used to isolate sequential tokens in a null-terminated string, -.Fa str . -These tokens are separated in the string by at least one of the -characters in -.Fa sep . -The first time that -.Fn strtok -is called, -.Fa str -should be specified; subsequent calls, wishing to obtain further tokens -from the same string, should pass a null pointer instead. -The separator string, -.Fa sep , -must be supplied each time, and may change between calls. -.Pp -The -.Fn strtok_r -function is a reentrant version of -.Fn strtok . -The context pointer -.Fa last -must be provided on each call. -.Fn strtok_r -may also be used to nest two parsing loops within one another, as -long as separate context pointers are used. -.Pp -The -.Fn strtok -and -.Fn strtok_r -functions -return a pointer to the beginning of each subsequent token in the string, -after replacing the token itself with a -.Dv NUL -character. -When no more tokens remain, a null pointer is returned. -.Sh EXAMPLE -The following uses -.Fn strtok_r -to parse two strings using separate contexts: -.Bd -literal -char test[80], blah[80]; -char *sep = "\e\e/:;=-"; -char *word, *phrase, *brkt, *brkb; - -strcpy(test, "This;is.a:test:of=the/string\e\etokenizer-function."); - -for (word = strtok_r(test, sep, &brkt); - word; - word = strtok_r(NULL, sep, &brkt)) -{ - strcpy(blah, "blah:blat:blab:blag"); - - for (phrase = strtok_r(blah, sep, &brkb); - phrase; - phrase = strtok_r(NULL, sep, &brkb)) - { - printf("So far we're at %s:%s\en", word, phrase); - } -} -.Ed -.Sh SEE ALSO -.Xr index 3 , -.Xr memchr 3 , -.Xr rindex 3 , -.Xr strchr 3 , -.Xr strcspn 3 , -.Xr strpbrk 3 , -.Xr strrchr 3 , -.Xr strsep 3 , -.Xr strspn 3 , -.Xr strstr 3 -.Sh STANDARDS -The -.Fn strtok -function -conforms to -.St -ansiC . -.Sh BUGS -The System V -.Fn strtok , -if handed a string containing only delimiter characters, -will not alter the next starting point, so that a call to -.Fn strtok -with a different (or empty) delimiter string -may return a -.Pf non- Dv NULL -value. -Since this implementation always alters the next starting point, -such a sequence of calls would always return -.Dv NULL . -.Sh AUTHORS -.An Wes Peters, Softweyr LLC: Aq wes@softweyr.com -.br -Based on the -.Fx 3.0 -implementation. diff --git a/lib/libc/string/strtok.c b/lib/libc/string/strtok.c deleted file mode 100644 index 1140bfc..0000000 --- a/lib/libc/string/strtok.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 1998 Softweyr LLC. All rights reserved. - * - * strtok_r, from Berkeley strtok - * Oct 13, 1998 by Wes Peters <wes@softweyr.com> - * - * Copyright (c) 1988, 1993 - * The Regents of the University of California. 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 - * notices, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notices, 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 Softweyr LLC, the - * University of California, Berkeley, and its contributors. - * - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY SOFTWEYR LLC, THE REGENTS AND CONTRIBUTORS - * ``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 SOFTWEYR LLC, THE - * REGENTS, OR CONTRIBUTORS 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 <stddef.h> -#include <string.h> - -char * -strtok_r(char *s, const char *delim, char **last) -{ - char *spanp; - int c, sc; - char *tok; - - if (s == NULL && (s = *last) == NULL) - { - return NULL; - } - - /* - * Skip (span) leading delimiters (s += strspn(s, delim), sort of). - */ -cont: - c = *s++; - for (spanp = (char *)delim; (sc = *spanp++) != 0; ) - { - if (c == sc) - { - goto cont; - } - } - - if (c == 0) /* no non-delimiter characters */ - { - *last = NULL; - return NULL; - } - tok = s - 1; - - /* - * Scan token (scan for delimiters: s += strcspn(s, delim), sort of). - * Note that delim must have one NUL; we stop if we see that, too. - */ - for (;;) - { - c = *s++; - spanp = (char *)delim; - do - { - if ((sc = *spanp++) == c) - { - if (c == 0) - { - s = NULL; - } - else - { - char *w = s - 1; - *w = '\0'; - } - *last = s; - return tok; - } - } - while (sc != 0); - } - /* NOTREACHED */ -} - - -char * -strtok(char *s, const char *delim) -{ - static char *last; - - return strtok_r(s, delim, &last); -} - - -#if defined(DEBUG_STRTOK) - -/* - * Test the tokenizer. - */ -int -main() -{ - char test[80], blah[80]; - char *sep = "\\/:;=-"; - char *word, *phrase, *brkt, *brkb; - - printf("String tokenizer test:\n"); - - strcpy(test, "This;is.a:test:of=the/string\\tokenizer-function."); - - for (word = strtok(test, sep); - word; - word = strtok(NULL, sep)) - { - printf("Next word is \"%s\".\n", word); - } - - phrase = "foo"; - - strcpy(test, "This;is.a:test:of=the/string\\tokenizer-function."); - - for (word = strtok_r(test, sep, &brkt); - word; - word = strtok_r(NULL, sep, &brkt)) - { - strcpy(blah, "blah:blat:blab:blag"); - - for (phrase = strtok_r(blah, sep, &brkb); - phrase; - phrase = strtok_r(NULL, sep, &brkb)) - { - printf("So far we're at %s:%s\n", word, phrase); - } - } - - return 0; -} - -#endif /* DEBUG_STRTOK */ diff --git a/lib/libc/string/strxfrm.3 b/lib/libc/string/strxfrm.3 deleted file mode 100644 index 4c7e2fa..0000000 --- a/lib/libc/string/strxfrm.3 +++ /dev/null @@ -1,97 +0,0 @@ -.\" Copyright (c) 1990, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" Chris Torek and the American National Standards Committee X3, -.\" on Information Processing Systems. -.\" -.\" 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 the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. -.\" -.\" @(#)strxfrm.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD$ -.\" -.Dd June 4, 1993 -.Dt STRXFRM 3 -.Os -.Sh NAME -.Nm strxfrm -.Nd transform a string under locale -.Sh SYNOPSIS -.Fd #include <string.h> -.Ft size_t -.Fn strxfrm "char *dst" "const char *src" "size_t n" -.Sh DESCRIPTION -The -.Fn strxfrm -function transforms a null-terminated string pointed to by -.Fa src -according to the current locale collation if any, -then copies the transformed string -into -.Fa dst . -Not more than -.Fa n -characters are copied into -.Fa dst , -including the terminating null character added. -If -.Fa n -is set to 0 -(it helps to determine an actual size needed -for transformation), -.Fa dst -is permitted to be a NULL pointer. -.Pp -Comparing two strings using -.Fn strcmp -after -.Fn strxfrm -is equal to comparing -two original strings with -.Fn strcoll . -.Sh RETURN VALUES -Upon successful completion, -.Fn strxfrm -returns the length of the transformed string not including -the terminating null character. -If this value is -.Fa n -or more, the contents of -.Fa dst -are indeterminate. -.Sh SEE ALSO -.Xr setlocale 3 , -.Xr strcmp 3 , -.Xr strcoll 3 -.Sh STANDARDS -The -.Fn strxfrm -function -conforms to -.St -ansiC . diff --git a/lib/libc/string/strxfrm.c b/lib/libc/string/strxfrm.c deleted file mode 100644 index ac172f8..0000000 --- a/lib/libc/string/strxfrm.c +++ /dev/null @@ -1,85 +0,0 @@ -/*- - * Copyright (c) 1995 Alex Tatmanjants <alex@elvisti.kiev.ua> - * at Electronni Visti IA, Kiev, Ukraine. - * 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. - * - * 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. - * - * $FreeBSD$ - */ - -#include <stdlib.h> -#include <string.h> -#include "collate.h" - -size_t -strxfrm(dest, src, len) - char *dest; - const char *src; - size_t len; -{ - int prim, sec, l; - size_t slen; - char *s, *ss; - - if (!*src) { - if (len > 0) - *dest = '\0'; - return 0; - } - - if (__collate_load_error) { - slen = strlen(src); - if (len > 0) { - if (slen < len) - strcpy(dest, src); - else { - strncpy(dest, src, len - 1); - dest[len - 1] = '\0'; - } - } - return slen; - } - - slen = 0; - prim = sec = 0; - ss = s = __collate_substitute(src); - while (*s) { - while (*s && !prim) { - __collate_lookup(s, &l, &prim, &sec); - s += l; - } - if (prim) { - if (len > 1) { - *dest++ = (char)prim; - len--; - } - slen++; - prim = 0; - } - } - free(ss); - if (len > 0) - *dest = '\0'; - - return slen; -} diff --git a/lib/libc/string/swab.3 b/lib/libc/string/swab.3 deleted file mode 100644 index 7efc22f..0000000 --- a/lib/libc/string/swab.3 +++ /dev/null @@ -1,66 +0,0 @@ -.\" Copyright (c) 1990, 1991, 1993 -.\" The Regents of the University of California. 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 the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. -.\" -.\" @(#)swab.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD$ -.\" -.Dd June 4, 1993 -.Dt SWAB 3 -.Os -.Sh NAME -.Nm swab -.Nd swap adjacent bytes -.Sh SYNOPSIS -.Fd #include <string.h> -.Ft void -.Fn swab "const void *src" "void *dst" "size_t len" -.Sh DESCRIPTION -The function -.Fn swab -copies -.Fa len -bytes from the location referenced by -.Fa src -to the location referenced by -.Fa dst , -swapping adjacent bytes. -.Pp -The argument -.Fa len -must be an even number. -.Sh SEE ALSO -.Xr bzero 3 , -.Xr memset 3 -.Sh HISTORY -A -.Fn swab -function appeared in -.At v7 . diff --git a/lib/libc/string/swab.c b/lib/libc/string/swab.c deleted file mode 100644 index a4fc3b9..0000000 --- a/lib/libc/string/swab.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Jeffrey Mogul. - * - * 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 the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)swab.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include <string.h> - -void -swab(from, to, len) - const void *from; - void *to; - size_t len; -{ - register unsigned long temp; - register int n; - register char *fp, *tp; - - n = (len >> 1) + 1; - fp = (char *)from; - tp = (char *)to; -#define STEP temp = *fp++,*tp++ = *fp++,*tp++ = temp - /* round to multiple of 8 */ - while ((--n) & 07) - STEP; - n >>= 3; - while (--n >= 0) { - STEP; STEP; STEP; STEP; - STEP; STEP; STEP; STEP; - } -} |