Sync lib/libc/string with FreeBSD:
authorPeter Avalos <pavalos@theshell.com>
Wed, 14 Jan 2009 21:01:28 +0000 (16:01 -0500)
committerPeter Avalos <pavalos@theshell.com>
Tue, 7 Apr 2009 07:08:27 +0000 (21:08 -1000)
commit716024cd274740e5ee0a906854b489160f9f02f3
tree75ecfff97b3a28bb6778867b245a24876d3da6a3
parent3073a60ce93e71acad3ab8cbe9dd105205680343
Sync lib/libc/string with FreeBSD:

-Move legacy functions to strings.h.

-A few WARNS and style cleanup.

-Add ffsl(), fls(), flsl(), ffsll(), flsll().

-Merge index.3 and rindex.3 since they are so similar.  Do the same for
strrchr().

-Add memrchr().

-Remove advertising clause from copyrights.

-Add memmem() which is basically the same as strstr().

-Add stpcpy().

-Add a SECURITY CONSIDERATIONS section to remind people about buffer
overflows, etc.

-Add restrict keyword where required.

-Add strndup().

-Correctly document the return value of strerror() and strerror_r() and
the contents of the returned buffer for unknown error codes.

-Add NLS catalogs support to strerror(), strerror_r() and strsignal().
Controlled by NLS define.

-For strl* files, use a less restrictive copyright (original author
changed it).

-strmode.3: strmode does not return 0.

-Move swab()'s prototype to unistd.h IAW SUS.

-Simplify by removing unneeded local variables and explicit
null termination is wcs* functions.

-Move wcscoll() and wcsxfrm() to string/ and do locale-sensitive
collation for single-byte locales.

-Add wcsdup().

-Remove unneeded includes.

-Reimplement wcsrchr(3) more efficiently, using a single forward scan
(like strrchr(3)) instead of scanning forwards to find the end of the
string then scanning backwards to find the character.

-Slightly optimize wcswidth().

-Tell contrib srcs that we have strndup now since some of them provide
their own static definition which will blow up a buildworld.
114 files changed:
gnu/usr.bin/binutils217/libiberty/config.h
gnu/usr.bin/cc41/libiberty/config.h
gnu/usr.bin/gdb/libiberty/config.h
include/string.h
include/strings.h
kerberos5/include/config.h
lib/libbind/port_after.h
lib/libc/locale/Makefile.inc
lib/libc/string/Makefile.inc
lib/libc/string/bcmp.3
lib/libc/string/bcmp.c
lib/libc/string/bcopy.3
lib/libc/string/bcopy.c
lib/libc/string/bstring.3
lib/libc/string/bzero.3
lib/libc/string/ffs.3
lib/libc/string/ffs.c
lib/libc/string/ffsl.c [copied from include/strings.h with 84% similarity]
lib/libc/string/ffsll.c [copied from include/strings.h with 84% similarity]
lib/libc/string/fls.c [copied from include/strings.h with 84% similarity]
lib/libc/string/flsl.c [copied from include/strings.h with 84% similarity]
lib/libc/string/flsll.c [copied from include/strings.h with 84% similarity]
lib/libc/string/index.3
lib/libc/string/index.c
lib/libc/string/memccpy.3
lib/libc/string/memccpy.c
lib/libc/string/memchr.3
lib/libc/string/memchr.c
lib/libc/string/memcmp.3
lib/libc/string/memcmp.c
lib/libc/string/memcpy.3
lib/libc/string/memmem.3 [copied from lib/libc/string/wcswidth.3 with 54% similarity]
lib/libc/string/memmem.c [moved from lib/libc/locale/wcsxfrm.c with 55% similarity]
lib/libc/string/memmove.3
lib/libc/string/memrchr.c [new file with mode: 0644]
lib/libc/string/memset.3
lib/libc/string/memset.c
lib/libc/string/rindex.3 [deleted file]
lib/libc/string/rindex.c
lib/libc/string/stpcpy.c [copied from include/strings.h with 80% similarity]
lib/libc/string/strcasecmp.3
lib/libc/string/strcasecmp.c
lib/libc/string/strcasestr.c
lib/libc/string/strcat.3
lib/libc/string/strcat.c
lib/libc/string/strchr.3
lib/libc/string/strcmp.3
lib/libc/string/strcmp.c
lib/libc/string/strcoll.3
lib/libc/string/strcpy.3
lib/libc/string/strcpy.c
lib/libc/string/strcspn.3
lib/libc/string/strdup.3
lib/libc/string/strdup.c
lib/libc/string/strerror.3
lib/libc/string/strerror.c
lib/libc/string/string.3
lib/libc/string/strlcat.c
lib/libc/string/strlcpy.3
lib/libc/string/strlcpy.c
lib/libc/string/strlen.3
lib/libc/string/strlen.c
lib/libc/string/strmode.3
lib/libc/string/strmode.c
lib/libc/string/strncat.c
lib/libc/string/strncmp.c
lib/libc/string/strncpy.c
lib/libc/string/strndup.c [copied from include/strings.h with 77% similarity]
lib/libc/string/strnstr.c
lib/libc/string/strpbrk.3
lib/libc/string/strpbrk.c
lib/libc/string/strrchr.3 [deleted file]
lib/libc/string/strsep.3
lib/libc/string/strsep.c
lib/libc/string/strsignal.c
lib/libc/string/strspn.3
lib/libc/string/strstr.3
lib/libc/string/strstr.c
lib/libc/string/strtok.3
lib/libc/string/strtok.c
lib/libc/string/strxfrm.3
lib/libc/string/strxfrm.c
lib/libc/string/swab.3
lib/libc/string/swab.c
lib/libc/string/wcscat.c
lib/libc/string/wcscmp.c
lib/libc/string/wcscoll.3 [moved from lib/libc/locale/wcscoll.3 with 80% similarity]
lib/libc/string/wcscoll.c [new file with mode: 0644]
lib/libc/string/wcscpy.c
lib/libc/string/wcscspn.c
lib/libc/string/wcsdup.c [moved from lib/libc/locale/wcscoll.c with 77% similarity]
lib/libc/string/wcslcat.c
lib/libc/string/wcslcpy.c
lib/libc/string/wcslen.c
lib/libc/string/wcsncat.c
lib/libc/string/wcsncmp.c
lib/libc/string/wcsncpy.c
lib/libc/string/wcspbrk.c
lib/libc/string/wcsrchr.c
lib/libc/string/wcsspn.c
lib/libc/string/wcsstr.c
lib/libc/string/wcstok.3 [copied from lib/libc/string/strtok.3 with 57% similarity]
lib/libc/string/wcstok.c [new file with mode: 0644]
lib/libc/string/wcswidth.3
lib/libc/string/wcswidth.c
lib/libc/string/wcsxfrm.3 [moved from lib/libc/locale/wcsxfrm.3 with 73% similarity]
lib/libc/string/wcsxfrm.c [copied from lib/libc/string/strxfrm.c with 57% similarity]
lib/libc/string/wmemchr.3
lib/libc/string/wmemchr.c
lib/libc/string/wmemcmp.c
lib/libc/string/wmemcpy.c
lib/libc/string/wmemmove.c
lib/libc/string/wmemset.c
lib/libmagic/config.h