From 9ef0d5fb5b0acfd35d73a5557198f46525ab1667 Mon Sep 17 00:00:00 2001 From: cvs2svn Date: Sun, 13 Apr 2014 15:49:51 +0000 Subject: This commit was manufactured by cvs2git to create tag 'butholakala'. --- src/lib/libc/string/Makefile.inc | 175 ------------------------------- src/lib/libc/string/bcmp.3 | 88 ---------------- src/lib/libc/string/bcmp.c | 55 ---------- src/lib/libc/string/bcopy.3 | 67 ------------ src/lib/libc/string/bcopy.c | 128 ----------------------- src/lib/libc/string/bstring.3 | 108 ------------------- src/lib/libc/string/bzero.3 | 74 ------------- src/lib/libc/string/bzero.c | 48 --------- src/lib/libc/string/explicit_bzero.c | 20 ---- src/lib/libc/string/ffs.3 | 61 ----------- src/lib/libc/string/ffs.c | 44 -------- src/lib/libc/string/index.c | 47 --------- src/lib/libc/string/memccpy.3 | 81 --------------- src/lib/libc/string/memccpy.c | 48 --------- src/lib/libc/string/memchr.3 | 102 ------------------ src/lib/libc/string/memchr.c | 48 --------- src/lib/libc/string/memcmp.3 | 85 --------------- src/lib/libc/string/memcmp.c | 51 --------- src/lib/libc/string/memcpy.3 | 79 -------------- src/lib/libc/string/memmem.3 | 77 -------------- src/lib/libc/string/memmem.c | 63 ------------ src/lib/libc/string/memmove.3 | 76 -------------- src/lib/libc/string/memrchr.c | 38 ------- src/lib/libc/string/memset.3 | 75 -------------- src/lib/libc/string/memset.c | 47 --------- src/lib/libc/string/rindex.c | 49 --------- src/lib/libc/string/stpcpy.3 | 184 --------------------------------- src/lib/libc/string/stpcpy.c | 44 -------- src/lib/libc/string/stpncpy.c | 56 ---------- src/lib/libc/string/strcasecmp.3 | 92 ----------------- src/lib/libc/string/strcasecmp.c | 105 ------------------- src/lib/libc/string/strcasestr.c | 60 ----------- src/lib/libc/string/strcat.3 | 81 --------------- src/lib/libc/string/strcat.c | 51 --------- src/lib/libc/string/strchr.3 | 114 --------------------- src/lib/libc/string/strcmp.3 | 97 ------------------ src/lib/libc/string/strcmp.c | 51 --------- src/lib/libc/string/strcoll.3 | 73 ------------- src/lib/libc/string/strcoll.c | 44 -------- src/lib/libc/string/strcpy.3 | 92 ----------------- src/lib/libc/string/strcpy.c | 50 --------- src/lib/libc/string/strcspn.3 | 108 ------------------- src/lib/libc/string/strcspn.c | 58 ----------- src/lib/libc/string/strdup.3 | 112 -------------------- src/lib/libc/string/strdup.c | 49 --------- src/lib/libc/string/strerror.3 | 123 ---------------------- src/lib/libc/string/strerror.c | 41 -------- src/lib/libc/string/strerror_r.c | 137 ------------------------- src/lib/libc/string/string.3 | 136 ------------------------ src/lib/libc/string/strlcat.c | 55 ---------- src/lib/libc/string/strlcpy.3 | 188 ---------------------------------- src/lib/libc/string/strlcpy.c | 51 --------- src/lib/libc/string/strlen.3 | 105 ------------------- src/lib/libc/string/strlen.c | 47 --------- src/lib/libc/string/strmode.3 | 157 ---------------------------- src/lib/libc/string/strmode.c | 140 ------------------------- src/lib/libc/string/strncat.3 | 128 ----------------------- src/lib/libc/string/strncat.c | 57 ----------- src/lib/libc/string/strncmp.c | 51 --------- src/lib/libc/string/strncpy.3 | 153 --------------------------- src/lib/libc/string/strncpy.c | 62 ----------- src/lib/libc/string/strndup.c | 39 ------- src/lib/libc/string/strnlen.c | 36 ------- src/lib/libc/string/strpbrk.3 | 80 --------------- src/lib/libc/string/strpbrk.c | 48 --------- src/lib/libc/string/strrchr.3 | 116 --------------------- src/lib/libc/string/strsep.3 | 110 -------------------- src/lib/libc/string/strsep.c | 70 ------------- src/lib/libc/string/strsignal.3 | 68 ------------ src/lib/libc/string/strsignal.c | 41 -------- src/lib/libc/string/strspn.3 | 92 ----------------- src/lib/libc/string/strspn.c | 51 --------- src/lib/libc/string/strstr.3 | 100 ------------------ src/lib/libc/string/strstr.c | 56 ---------- src/lib/libc/string/strtok.3 | 166 ------------------------------ src/lib/libc/string/strtok.c | 86 ---------------- src/lib/libc/string/strxfrm.3 | 79 -------------- src/lib/libc/string/strxfrm.c | 51 --------- src/lib/libc/string/swab.3 | 61 ----------- src/lib/libc/string/swab.c | 61 ----------- src/lib/libc/string/timingsafe_bcmp.c | 33 ------ src/lib/libc/string/wcscasecmp.3 | 94 ----------------- src/lib/libc/string/wcscasecmp.c | 61 ----------- src/lib/libc/string/wcscat.3 | 115 --------------------- src/lib/libc/string/wcscat.c | 55 ---------- src/lib/libc/string/wcschr.3 | 85 --------------- src/lib/libc/string/wcschr.c | 50 --------- src/lib/libc/string/wcscmp.3 | 92 ----------------- src/lib/libc/string/wcscmp.c | 51 --------- src/lib/libc/string/wcscpy.3 | 129 ----------------------- src/lib/libc/string/wcscpy.c | 52 ---------- src/lib/libc/string/wcscspn.3 | 83 --------------- src/lib/libc/string/wcscspn.c | 53 ---------- src/lib/libc/string/wcsdup.3 | 97 ------------------ src/lib/libc/string/wcsdup.c | 31 ------ src/lib/libc/string/wcslcat.c | 56 ---------- src/lib/libc/string/wcslcpy.3 | 153 --------------------------- src/lib/libc/string/wcslcpy.c | 52 ---------- src/lib/libc/string/wcslen.3 | 70 ------------- src/lib/libc/string/wcslen.c | 44 -------- src/lib/libc/string/wcsncat.c | 52 ---------- src/lib/libc/string/wcsncmp.c | 52 ---------- src/lib/libc/string/wcsncpy.c | 50 --------- src/lib/libc/string/wcspbrk.3 | 81 --------------- src/lib/libc/string/wcspbrk.c | 53 ---------- src/lib/libc/string/wcsrchr.3 | 85 --------------- src/lib/libc/string/wcsrchr.c | 50 --------- src/lib/libc/string/wcsspn.3 | 79 -------------- src/lib/libc/string/wcsspn.c | 55 ---------- src/lib/libc/string/wcsstr.3 | 88 ---------------- src/lib/libc/string/wcsstr.c | 70 ------------- src/lib/libc/string/wcstok.3 | 151 --------------------------- src/lib/libc/string/wcstok.c | 93 ----------------- src/lib/libc/string/wcswcs.c | 5 - src/lib/libc/string/wcswidth.3 | 69 ------------- src/lib/libc/string/wcswidth.c | 50 --------- src/lib/libc/string/wmemchr.3 | 81 --------------- src/lib/libc/string/wmemchr.c | 47 --------- src/lib/libc/string/wmemcmp.3 | 78 -------------- src/lib/libc/string/wmemcmp.c | 50 --------- src/lib/libc/string/wmemcpy.3 | 79 -------------- src/lib/libc/string/wmemcpy.c | 40 -------- src/lib/libc/string/wmemmove.3 | 78 -------------- src/lib/libc/string/wmemmove.c | 40 -------- src/lib/libc/string/wmemset.3 | 73 ------------- src/lib/libc/string/wmemset.c | 46 --------- 126 files changed, 9548 deletions(-) delete mode 100644 src/lib/libc/string/Makefile.inc delete mode 100644 src/lib/libc/string/bcmp.3 delete mode 100644 src/lib/libc/string/bcmp.c delete mode 100644 src/lib/libc/string/bcopy.3 delete mode 100644 src/lib/libc/string/bcopy.c delete mode 100644 src/lib/libc/string/bstring.3 delete mode 100644 src/lib/libc/string/bzero.3 delete mode 100644 src/lib/libc/string/bzero.c delete mode 100644 src/lib/libc/string/explicit_bzero.c delete mode 100644 src/lib/libc/string/ffs.3 delete mode 100644 src/lib/libc/string/ffs.c delete mode 100644 src/lib/libc/string/index.c delete mode 100644 src/lib/libc/string/memccpy.3 delete mode 100644 src/lib/libc/string/memccpy.c delete mode 100644 src/lib/libc/string/memchr.3 delete mode 100644 src/lib/libc/string/memchr.c delete mode 100644 src/lib/libc/string/memcmp.3 delete mode 100644 src/lib/libc/string/memcmp.c delete mode 100644 src/lib/libc/string/memcpy.3 delete mode 100644 src/lib/libc/string/memmem.3 delete mode 100644 src/lib/libc/string/memmem.c delete mode 100644 src/lib/libc/string/memmove.3 delete mode 100644 src/lib/libc/string/memrchr.c delete mode 100644 src/lib/libc/string/memset.3 delete mode 100644 src/lib/libc/string/memset.c delete mode 100644 src/lib/libc/string/rindex.c delete mode 100644 src/lib/libc/string/stpcpy.3 delete mode 100644 src/lib/libc/string/stpcpy.c delete mode 100644 src/lib/libc/string/stpncpy.c delete mode 100644 src/lib/libc/string/strcasecmp.3 delete mode 100644 src/lib/libc/string/strcasecmp.c delete mode 100644 src/lib/libc/string/strcasestr.c delete mode 100644 src/lib/libc/string/strcat.3 delete mode 100644 src/lib/libc/string/strcat.c delete mode 100644 src/lib/libc/string/strchr.3 delete mode 100644 src/lib/libc/string/strcmp.3 delete mode 100644 src/lib/libc/string/strcmp.c delete mode 100644 src/lib/libc/string/strcoll.3 delete mode 100644 src/lib/libc/string/strcoll.c delete mode 100644 src/lib/libc/string/strcpy.3 delete mode 100644 src/lib/libc/string/strcpy.c delete mode 100644 src/lib/libc/string/strcspn.3 delete mode 100644 src/lib/libc/string/strcspn.c delete mode 100644 src/lib/libc/string/strdup.3 delete mode 100644 src/lib/libc/string/strdup.c delete mode 100644 src/lib/libc/string/strerror.3 delete mode 100644 src/lib/libc/string/strerror.c delete mode 100644 src/lib/libc/string/strerror_r.c delete mode 100644 src/lib/libc/string/string.3 delete mode 100644 src/lib/libc/string/strlcat.c delete mode 100644 src/lib/libc/string/strlcpy.3 delete mode 100644 src/lib/libc/string/strlcpy.c delete mode 100644 src/lib/libc/string/strlen.3 delete mode 100644 src/lib/libc/string/strlen.c delete mode 100644 src/lib/libc/string/strmode.3 delete mode 100644 src/lib/libc/string/strmode.c delete mode 100644 src/lib/libc/string/strncat.3 delete mode 100644 src/lib/libc/string/strncat.c delete mode 100644 src/lib/libc/string/strncmp.c delete mode 100644 src/lib/libc/string/strncpy.3 delete mode 100644 src/lib/libc/string/strncpy.c delete mode 100644 src/lib/libc/string/strndup.c delete mode 100644 src/lib/libc/string/strnlen.c delete mode 100644 src/lib/libc/string/strpbrk.3 delete mode 100644 src/lib/libc/string/strpbrk.c delete mode 100644 src/lib/libc/string/strrchr.3 delete mode 100644 src/lib/libc/string/strsep.3 delete mode 100644 src/lib/libc/string/strsep.c delete mode 100644 src/lib/libc/string/strsignal.3 delete mode 100644 src/lib/libc/string/strsignal.c delete mode 100644 src/lib/libc/string/strspn.3 delete mode 100644 src/lib/libc/string/strspn.c delete mode 100644 src/lib/libc/string/strstr.3 delete mode 100644 src/lib/libc/string/strstr.c delete mode 100644 src/lib/libc/string/strtok.3 delete mode 100644 src/lib/libc/string/strtok.c delete mode 100644 src/lib/libc/string/strxfrm.3 delete mode 100644 src/lib/libc/string/strxfrm.c delete mode 100644 src/lib/libc/string/swab.3 delete mode 100644 src/lib/libc/string/swab.c delete mode 100644 src/lib/libc/string/timingsafe_bcmp.c delete mode 100644 src/lib/libc/string/wcscasecmp.3 delete mode 100644 src/lib/libc/string/wcscasecmp.c delete mode 100644 src/lib/libc/string/wcscat.3 delete mode 100644 src/lib/libc/string/wcscat.c delete mode 100644 src/lib/libc/string/wcschr.3 delete mode 100644 src/lib/libc/string/wcschr.c delete mode 100644 src/lib/libc/string/wcscmp.3 delete mode 100644 src/lib/libc/string/wcscmp.c delete mode 100644 src/lib/libc/string/wcscpy.3 delete mode 100644 src/lib/libc/string/wcscpy.c delete mode 100644 src/lib/libc/string/wcscspn.3 delete mode 100644 src/lib/libc/string/wcscspn.c delete mode 100644 src/lib/libc/string/wcsdup.3 delete mode 100644 src/lib/libc/string/wcsdup.c delete mode 100644 src/lib/libc/string/wcslcat.c delete mode 100644 src/lib/libc/string/wcslcpy.3 delete mode 100644 src/lib/libc/string/wcslcpy.c delete mode 100644 src/lib/libc/string/wcslen.3 delete mode 100644 src/lib/libc/string/wcslen.c delete mode 100644 src/lib/libc/string/wcsncat.c delete mode 100644 src/lib/libc/string/wcsncmp.c delete mode 100644 src/lib/libc/string/wcsncpy.c delete mode 100644 src/lib/libc/string/wcspbrk.3 delete mode 100644 src/lib/libc/string/wcspbrk.c delete mode 100644 src/lib/libc/string/wcsrchr.3 delete mode 100644 src/lib/libc/string/wcsrchr.c delete mode 100644 src/lib/libc/string/wcsspn.3 delete mode 100644 src/lib/libc/string/wcsspn.c delete mode 100644 src/lib/libc/string/wcsstr.3 delete mode 100644 src/lib/libc/string/wcsstr.c delete mode 100644 src/lib/libc/string/wcstok.3 delete mode 100644 src/lib/libc/string/wcstok.c delete mode 100644 src/lib/libc/string/wcswcs.c delete mode 100644 src/lib/libc/string/wcswidth.3 delete mode 100644 src/lib/libc/string/wcswidth.c delete mode 100644 src/lib/libc/string/wmemchr.3 delete mode 100644 src/lib/libc/string/wmemchr.c delete mode 100644 src/lib/libc/string/wmemcmp.3 delete mode 100644 src/lib/libc/string/wmemcmp.c delete mode 100644 src/lib/libc/string/wmemcpy.3 delete mode 100644 src/lib/libc/string/wmemcpy.c delete mode 100644 src/lib/libc/string/wmemmove.3 delete mode 100644 src/lib/libc/string/wmemmove.c delete mode 100644 src/lib/libc/string/wmemset.3 delete mode 100644 src/lib/libc/string/wmemset.c (limited to 'src/lib/libc/string') diff --git a/src/lib/libc/string/Makefile.inc b/src/lib/libc/string/Makefile.inc deleted file mode 100644 index 1f6d756182..0000000000 --- a/src/lib/libc/string/Makefile.inc +++ /dev/null @@ -1,175 +0,0 @@ -# $OpenBSD: Makefile.inc,v 1.34 2014/03/23 23:16:48 tedu Exp $ - -# string sources -.PATH: ${LIBCSRCDIR}/arch/${MACHINE_CPU}/string ${LIBCSRCDIR}/string - -SRCS+= explicit_bzero.c memccpy.c memmem.c memrchr.c stpcpy.c stpncpy.c \ - strcasecmp.c strcasestr.c strcoll.c strdup.c \ - strerror.c strerror_r.c strlcat.c strmode.c strndup.c strnlen.c \ - strsignal.c strtok.c strxfrm.c \ - wcscat.c wcschr.c wcscmp.c wcscpy.c wcscspn.c wcslcat.c wcslcpy.c \ - wcslen.c wcsncat.c wcsncmp.c wcsncpy.c wcspbrk.c wcsrchr.c wcsspn.c \ - wcsstr.c wcstok.c wcswcs.c wcswidth.c wmemchr.c wmemcmp.c wmemcpy.c \ - wmemmove.c wmemset.c wcsdup.c \ - timingsafe_bcmp.c wcscasecmp.c - -# machine-dependent net sources -# m-d Makefile.inc must include sources for: -# bcmp() bcopy() bzero() ffs() index() memchr() memcmp() memset() -# rindex() strcat() strcmp() strcpy() strcspn() strlen() strlcpy() -# strncat() strncmp() strncpy() strpbrk() strsep() -# strspn() strstr() swav() -# m-d Makefile.inc may include sources for: -# memcpy() memmove() strchr() strrchr() - -.include "${LIBCSRCDIR}/arch/${MACHINE_CPU}/string/Makefile.inc" - -# if no machine specific memmove(3), build one out of bcopy(3). -.if empty(SRCS:Mmemmove.S) -OBJS+= memmove.o -memmove.o: bcopy.c - ${CC} -DMEMMOVE ${CFLAGS} ${CPPFLAGS} -c ${.ALLSRC} -o ${.TARGET} - @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET} - @mv ${.TARGET}.tmp ${.TARGET} - -memmove.go: bcopy.c - ${CC} -g -DMEMMOVE ${CFLAGS} ${CPPFLAGS} -c ${.ALLSRC} -o ${.TARGET} - @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET} - @mv ${.TARGET}.tmp ${.TARGET} - -memmove.po: bcopy.c - ${CC} -DMEMMOVE ${CFLAGS} ${CPPFLAGS} -c -p ${.ALLSRC} -o ${.TARGET} - @${LD} -o ${.TARGET}.tmp -X -r ${.TARGET} - @mv ${.TARGET}.tmp ${.TARGET} - -memmove.so: bcopy.c - ${CC} ${PICFLAG} -DPIC -DMEMMOVE ${CFLAGS} ${CPPFLAGS} -c ${.ALLSRC} \ - -o ${.TARGET} - -memmove.do: bcopy.c - ${CC} -DMEMMOVE ${CFLAGS} ${CPPFLAGS} ${DIST_CFLAGS} -c ${.ALLSRC} \ - -o ${.TARGET} - @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET} - @mv ${.TARGET}.tmp ${.TARGET} -.endif - -# if no machine specific memcpy(3), build one out of bcopy(3). -# if there is a machine specific memmove(3), we'll assume it aliases -# memcpy(3). -.if empty(SRCS:Mmemcpy.S) -.if empty(SRCS:Mmemmove.S) -OBJS+= memcpy.o -memcpy.o: bcopy.c - ${CC} -DMEMCOPY ${CFLAGS} ${CPPFLAGS} -c ${.ALLSRC} -o ${.TARGET} - @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET} - @mv ${.TARGET}.tmp ${.TARGET} - -memcpy.go: bcopy.c - ${CC} -g -DMEMCOPY ${CFLAGS} ${CPPFLAGS} -c ${.ALLSRC} -o ${.TARGET} - @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET} - @mv ${.TARGET}.tmp ${.TARGET} - -memcpy.po: bcopy.c - ${CC} -DMEMCOPY ${CFLAGS} ${CPPFLAGS} -c -p ${.ALLSRC} -o ${.TARGET} - @${LD} -o ${.TARGET}.tmp -X -r ${.TARGET} - @mv ${.TARGET}.tmp ${.TARGET} - -memcpy.so: bcopy.c - ${CC} ${PICFLAG} -DPIC -DMEMCOPY ${CFLAGS} ${CPPFLAGS} -c ${.ALLSRC} \ - -o ${.TARGET} - -memcpy.do: bcopy.c - ${CC} -DMEMCOPY ${CFLAGS} ${CPPFLAGS} ${DIST_CFLAGS} -c ${.ALLSRC} \ - -o ${.TARGET} - @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET} - @mv ${.TARGET}.tmp ${.TARGET} -.endif -.endif - -# if no machine specific strchr(3), build one out of index(3). -.if empty(SRCS:Mstrchr.S) -OBJS+= strchr.o -strchr.o: index.c - ${CC} -DSTRCHR ${CFLAGS} ${CPPFLAGS} -c ${.ALLSRC} -o ${.TARGET} - @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET} - @mv ${.TARGET}.tmp ${.TARGET} - -strchr.go: index.c - ${CC} -g -DSTRCHR ${CFLAGS} ${CPPFLAGS} -c ${.ALLSRC} -o ${.TARGET} - @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET} - @mv ${.TARGET}.tmp ${.TARGET} - -strchr.po: index.c - ${CC} -DSTRCHR ${CFLAGS} ${CPPFLAGS} -c -p ${.ALLSRC} -o ${.TARGET} - @${LD} -o ${.TARGET}.tmp -X -r ${.TARGET} - @mv ${.TARGET}.tmp ${.TARGET} - -strchr.so: index.c - ${CC} ${PICFLAG} -DPIC -DSTRCHR ${CFLAGS} ${CPPFLAGS} -c ${.ALLSRC} \ - -o ${.TARGET} - -strchr.do: index.c - ${CC} -DSTRCHR ${CFLAGS} ${CPPFLAGS} ${DIST_CFLAGS} -c ${.ALLSRC} \ - -o ${.TARGET} - @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET} - @mv ${.TARGET}.tmp ${.TARGET} -.endif - -# if no machine specific strrchr(3), build one out of rindex(3). -.if empty(SRCS:Mstrrchr.S) -OBJS+= strrchr.o -strrchr.o: rindex.c - ${CC} -DSTRRCHR ${CFLAGS} ${CPPFLAGS} -c ${.ALLSRC} -o ${.TARGET} - @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET} - @mv ${.TARGET}.tmp ${.TARGET} - -strrchr.go: rindex.c - ${CC} -g -DSTRRCHR ${CFLAGS} ${CPPFLAGS} -c ${.ALLSRC} -o ${.TARGET} - @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET} - @mv ${.TARGET}.tmp ${.TARGET} - -strrchr.po: rindex.c - ${CC} -DSTRRCHR ${CFLAGS} ${CPPFLAGS} -c -p ${.ALLSRC} -o ${.TARGET} - @${LD} -o ${.TARGET}.tmp -X -r ${.TARGET} - @mv ${.TARGET}.tmp ${.TARGET} - -strrchr.so: rindex.c - ${CC} ${PICFLAG} -DPIC -DSTRRCHR ${CFLAGS} ${CPPFLAGS} -c ${.ALLSRC} \ - -o ${.TARGET} - -strrchr.do: rindex.c - ${CC} -DSTRRCHR ${CFLAGS} ${CPPFLAGS} ${DIST_CFLAGS} -c ${.ALLSRC} \ - -o ${.TARGET} - @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET} - @mv ${.TARGET}.tmp ${.TARGET} -.endif - -MAN+= bcmp.3 bcopy.3 bstring.3 bzero.3 ffs.3 memccpy.3 memchr.3 \ - memcmp.3 memcpy.3 memmem.3 memmove.3 memset.3 stpcpy.3 strcasecmp.3 \ - strcat.3 strchr.3 strcmp.3 strcoll.3 strcpy.3 strcspn.3 strdup.3 \ - strerror.3 string.3 strlen.3 strmode.3 strncat.3 strncpy.3 strpbrk.3 \ - strrchr.3 strsep.3 strsignal.3 strspn.3 strstr.3 strtok.3 strxfrm.3 \ - swab.3 strlcpy.3 wcscasecmp.3 wcscat.3 wcschr.3 wcscmp.3 wcscpy.3 \ - wcscspn.3 wcsdup.3 wcslcpy.3 wcslen.3 wcspbrk.3 wcsrchr.3 wcsspn.3 \ - wcsstr.3 wcstok.3 wcswidth.3 wmemchr.3 wmemcmp.3 wmemcpy.3 wmemmove.3 \ - wmemset.3 - -MLINKS+=bzero.3 explicit_bzero.3 -MLINKS+=memchr.3 memrchr.3 -MLINKS+=stpcpy.3 stpncpy.3 -MLINKS+=strchr.3 index.3 -MLINKS+=strrchr.3 rindex.3 -MLINKS+=strcasecmp.3 strncasecmp.3 -MLINKS+=strcmp.3 strncmp.3 -MLINKS+=strdup.3 strndup.3 -MLINKS+=strlcpy.3 strlcat.3 -MLINKS+=strlen.3 strnlen.3 -MLINKS+=strstr.3 strcasestr.3 -MLINKS+=strtok.3 strtok_r.3 -MLINKS+=strerror.3 strerror_r.3 -MLINKS+=wcscasecmp.3 wcsncasecmp.3 -MLINKS+=wcscat.3 wcsncat.3 -MLINKS+=wcscmp.3 wcsncmp.3 -MLINKS+=wcscpy.3 wcsncpy.3 -MLINKS+=wcslcpy.3 wcslcat.3 -MLINKS+=bcmp.3 timingsafe_bcmp.3 diff --git a/src/lib/libc/string/bcmp.3 b/src/lib/libc/string/bcmp.3 deleted file mode 100644 index 52584b4b83..0000000000 --- a/src/lib/libc/string/bcmp.3 +++ /dev/null @@ -1,88 +0,0 @@ -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.\" $OpenBSD: bcmp.3,v 1.10 2013/06/05 03:39:23 tedu Exp $ -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt BCMP 3 -.Os -.Sh NAME -.Nm bcmp , -.Nm timingsafe_bcmp -.Nd compare byte string -.Sh SYNOPSIS -.In string.h -.Ft int -.Fn bcmp "const void *b1" "const void *b2" "size_t len" -.Ft int -.Fn timingsafe_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. -.Pp -The -.Fn timingsafe_bcmp -function has the same semantics as -.Fn bcmp , -but its running time is independent of the contents of -.Fa b1 -and -.Fa b2 , -making it safe to use for comparing secret values such as cryptographic MACs. -In contrast, -.Fn bcmp -returns after finding the first differing byte, -making it vulnerable to timing attacks. -.Sh SEE ALSO -.Xr memcmp 3 , -.Xr strcasecmp 3 , -.Xr strcmp 3 , -.Xr strcoll 3 , -.Xr strxfrm 3 -.Sh HISTORY -The -.Fn bcmp -function first appeared in -.Bx 4.2 . -.Pp -The -.Fn timingsafe_bcmp -function first appeared in -.Ox 4.9 . diff --git a/src/lib/libc/string/bcmp.c b/src/lib/libc/string/bcmp.c deleted file mode 100644 index fd5c93121e..0000000000 --- a/src/lib/libc/string/bcmp.c +++ /dev/null @@ -1,55 +0,0 @@ -/* $OpenBSD: bcmp.c,v 1.9 2008/03/19 03:00:23 ray Exp $ */ - -/* - * Copyright (c) 1987 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. 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(_KERNEL) && !defined(_STANDALONE) -#include -#else -#include -#endif - -/* - * bcmp -- vax cmpc3 instruction - */ -int -bcmp(const void *b1, const void *b2, size_t length) -{ - char *p1, *p2; - - if (length == 0) - return (0); - p1 = (char *)b1; - p2 = (char *)b2; - do - if (*p1++ != *p2++) - return (1); - while (--length); - return (0); -} diff --git a/src/lib/libc/string/bcopy.3 b/src/lib/libc/string/bcopy.3 deleted file mode 100644 index 94a8231fcb..0000000000 --- a/src/lib/libc/string/bcopy.3 +++ /dev/null @@ -1,67 +0,0 @@ -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.\" $OpenBSD: bcopy.3,v 1.11 2013/06/05 03:39:23 tedu Exp $ -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt BCOPY 3 -.Os -.Sh NAME -.Nm bcopy -.Nd copy bytes -.Sh SYNOPSIS -.In 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 buffer -.Fa src -to buffer -.Fa dst . -The two buffers 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 strlcpy 3 , -.Xr strncpy 3 -.Sh HISTORY -The -.Fn bcopy -function first appeared in -.Bx 4.2 . diff --git a/src/lib/libc/string/bcopy.c b/src/lib/libc/string/bcopy.c deleted file mode 100644 index 4308c6484a..0000000000 --- a/src/lib/libc/string/bcopy.c +++ /dev/null @@ -1,128 +0,0 @@ -/* $OpenBSD: bcopy.c,v 1.5 2005/08/08 08:05:37 espie Exp $ */ -/*- - * Copyright (c) 1990 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. 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 - -/* - * sizeof(word) MUST BE A POWER OF TWO - * SO THAT wmask BELOW IS ALL ONES - */ -typedef long 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(void *dst0, const void *src0, size_t length) -#else -#ifdef MEMMOVE -void * -memmove(void *dst0, const void *src0, size_t length) -#else -void -bcopy(const void *src0, void *dst0, size_t length) -#endif -#endif -{ - char *dst = dst0; - const char *src = src0; - 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 = (long)src; /* only need low bits */ - if ((t | (long)dst) & wmask) { - /* - * Try to align operands. This cannot be done - * unless the low bits match. - */ - if ((t ^ (long)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 = (long)src; - if ((t | (long)dst) & wmask) { - if ((t ^ (long)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/src/lib/libc/string/bstring.3 b/src/lib/libc/string/bstring.3 deleted file mode 100644 index d88b78f504..0000000000 --- a/src/lib/libc/string/bstring.3 +++ /dev/null @@ -1,108 +0,0 @@ -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.\" $OpenBSD: bstring.3,v 1.10 2013/06/05 03:39:23 tedu Exp $ -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt BSTRING 3 -.Os -.Sh NAME -.Nm bstring -.Nd byte string operations -.Sh SYNOPSIS -.In 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 NUL 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 -.Fn bcmp , -.Fn bcopy , -and -.Fn bzero -functions first appeared in -.Bx 4.2 . -The -.Fn memchr , -.Fn memcmp , -.Fn memccpy , -.Fn memcpy , -and -.Fn memset -functions first appeared in -.At V -and were reimplemented for -.Bx 4.3 Tahoe . -The -.Fn memmove -function first appeared in -.Bx 4.3 Reno . diff --git a/src/lib/libc/string/bzero.3 b/src/lib/libc/string/bzero.3 deleted file mode 100644 index 3e21c4241f..0000000000 --- a/src/lib/libc/string/bzero.3 +++ /dev/null @@ -1,74 +0,0 @@ -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.\" $OpenBSD: bzero.3,v 1.11 2014/01/22 22:21:25 jmc Exp $ -.\" -.Dd $Mdocdate: January 22 2014 $ -.Dt BZERO 3 -.Os -.Sh NAME -.Nm bzero , -.Nm explicit_bzero -.Nd write zeroes to a byte string -.Sh SYNOPSIS -.In string.h -.Ft void -.Fn bzero "void *b" "size_t len" -.Ft void -.Fn explicit_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. -.Pp -The -.Fn explicit_bzero -variant behaves the same, but will not be removed by a compiler's dead store -optimization pass, making it useful for clearing sensitive memory such as a -password. -.Sh SEE ALSO -.Xr memset 3 , -.Xr swab 3 -.Sh HISTORY -The -.Fn bzero -function first appeared in -.Bx 4.2 . -The -.Fn explicit_bzero -function first appeared in -.Ox 5.5 . diff --git a/src/lib/libc/string/bzero.c b/src/lib/libc/string/bzero.c deleted file mode 100644 index 4d267d4f40..0000000000 --- a/src/lib/libc/string/bzero.c +++ /dev/null @@ -1,48 +0,0 @@ -/* $OpenBSD: bzero.c,v 1.7 2005/08/08 08:05:37 espie Exp $ */ - -/* - * Copyright (c) 1987 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. 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(_KERNEL) && !defined(_STANDALONE) -#include -#else -#include -#endif - -/* - * bzero -- vax movc5 instruction - */ -void -bzero(void *b, size_t length) -{ - char *p; - - for (p = b; length--;) - *p++ = '\0'; -} diff --git a/src/lib/libc/string/explicit_bzero.c b/src/lib/libc/string/explicit_bzero.c deleted file mode 100644 index fd2948ca44..0000000000 --- a/src/lib/libc/string/explicit_bzero.c +++ /dev/null @@ -1,20 +0,0 @@ -/* $OpenBSD: explicit_bzero.c,v 1.1 2014/01/22 21:06:45 tedu Exp $ */ -/* - * Public domain. - * Written by Ted Unangst - */ - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#else -#include -#endif - -/* - * explicit_bzero - don't let the compiler optimize away bzero - */ -void -explicit_bzero(void *p, size_t n) -{ - bzero(p, n); -} diff --git a/src/lib/libc/string/ffs.3 b/src/lib/libc/string/ffs.3 deleted file mode 100644 index c0ed7baa9e..0000000000 --- a/src/lib/libc/string/ffs.3 +++ /dev/null @@ -1,61 +0,0 @@ -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.\" $OpenBSD: ffs.3,v 1.9 2013/06/05 03:39:23 tedu Exp $ -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt FFS 3 -.Os -.Sh NAME -.Nm ffs -.Nd find first bit set in a bit string -.Sh SYNOPSIS -.In 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 rightmost bit. -A return value of 0 means that the argument was zero. -.Sh SEE ALSO -.Xr bitstring 3 -.Sh STANDARDS -The -.Fn ffs -function conforms to -.St -p1003.1-2008 . -.Sh HISTORY -The -.Fn ffs -function first appeared in -.Bx 4.2 . diff --git a/src/lib/libc/string/ffs.c b/src/lib/libc/string/ffs.c deleted file mode 100644 index 7dec1613a8..0000000000 --- a/src/lib/libc/string/ffs.c +++ /dev/null @@ -1,44 +0,0 @@ -/* $OpenBSD: ffs.c,v 1.7 2005/08/08 08:05:37 espie Exp $ */ - -/* - * Public domain. - * Written by Dale Rahn. - */ - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#else -#include -#endif - -/* - * ffs -- vax ffs instruction - */ -int -ffs(int mask) -{ - int bit; - unsigned int r = mask; - static const signed char t[16] = { - -28, 1, 2, 1, - 3, 1, 2, 1, - 4, 1, 2, 1, - 3, 1, 2, 1 - }; - - bit = 0; - if (!(r & 0xffff)) { - bit += 16; - r >>= 16; - } - if (!(r & 0xff)) { - bit += 8; - r >>= 8; - } - if (!(r & 0xf)) { - bit += 4; - r >>= 4; - } - - return (bit + t[ r & 0xf ]); -} diff --git a/src/lib/libc/string/index.c b/src/lib/libc/string/index.c deleted file mode 100644 index 50e9ca35ab..0000000000 --- a/src/lib/libc/string/index.c +++ /dev/null @@ -1,47 +0,0 @@ -/* $OpenBSD: index.c,v 1.5 2005/08/08 08:05:37 espie Exp $ */ -/*- - * Copyright (c) 1990 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. 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 - -char * -#ifdef STRCHR -strchr(const char *p, int ch) -#else -index(const char *p, int ch) -#endif -{ - for (;; ++p) { - if (*p == ch) - return((char *)p); - if (!*p) - return((char *)NULL); - } - /* NOTREACHED */ -} diff --git a/src/lib/libc/string/memccpy.3 b/src/lib/libc/string/memccpy.3 deleted file mode 100644 index 98326d6871..0000000000 --- a/src/lib/libc/string/memccpy.3 +++ /dev/null @@ -1,81 +0,0 @@ -.\" $OpenBSD: memccpy.3,v 1.12 2013/09/25 21:49:30 millert Exp $ -.\" -.\" 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. 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 -.\" -.Dd $Mdocdate: September 25 2013 $ -.Dt MEMCCPY 3 -.Os -.Sh NAME -.Nm memccpy -.Nd copy string until character found -.Sh SYNOPSIS -.In 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 -.Li 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. -.Pp -If the -.Fa src -and -.Fa dst -strings overlap, the behavior is undefined. -.Sh SEE ALSO -.Xr bcopy 3 , -.Xr memcpy 3 , -.Xr memmove 3 , -.Xr strcpy 3 , -.Xr strlcpy 3 -.Sh HISTORY -The -.Fn memccpy -function first appeared in -.At V -and was reimplemented for -.Bx 4.3 Tahoe . diff --git a/src/lib/libc/string/memccpy.c b/src/lib/libc/string/memccpy.c deleted file mode 100644 index 485c55fcab..0000000000 --- a/src/lib/libc/string/memccpy.c +++ /dev/null @@ -1,48 +0,0 @@ -/* $OpenBSD: memccpy.c,v 1.6 2005/08/08 08:05:37 espie Exp $ */ - -/*- - * 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. 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 - -void * -memccpy(void *t, const void *f, int c, size_t n) -{ - - if (n) { - unsigned char *tp = t; - const unsigned char *fp = f; - unsigned char uc = c; - do { - if ((*tp++ = *fp++) == uc) - return (tp); - } while (--n != 0); - } - return (0); -} diff --git a/src/lib/libc/string/memchr.3 b/src/lib/libc/string/memchr.3 deleted file mode 100644 index 8d8a9ddf9c..0000000000 --- a/src/lib/libc/string/memchr.3 +++ /dev/null @@ -1,102 +0,0 @@ -.\" $OpenBSD: memchr.3,v 1.12 2014/04/07 17:57:56 schwarze Exp $ -.\" -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.Dd $Mdocdate: April 7 2014 $ -.Dt MEMCHR 3 -.Os -.Sh NAME -.Nm memchr , -.Nm memrchr -.Nd locate byte in byte string -.Sh SYNOPSIS -.In string.h -.Ft void * -.Fn memchr "const void *b" "int c" "size_t len" -.Ft void * -.Fn memrchr "const void *b" "int c" "size_t len" -.Sh DESCRIPTION -The -.Fn memchr -function locates the first occurrence of -.Fa c -(converted to an -.Li unsigned char ) -in string -.Fa b . -.Pp -The -.Fn memrchr -function behaves like -.Fn memchr , -except that it locates the last occurrence of -.Fa c -in string -.Fa b . -.Sh RETURN VALUES -The -.Fn memchr -and -.Fn memrchr -functions return a pointer to the byte located, or -.Dv NULL -if no such byte exists within -.Fa len -bytes. -.Sh SEE ALSO -.Xr strchr 3 , -.Xr strcspn 3 , -.Xr strpbrk 3 , -.Xr strrchr 3 , -.Xr strsep 3 , -.Xr strspn 3 , -.Xr strstr 3 , -.Xr strtok 3 , -.Xr wmemchr 3 -.Sh STANDARDS -The -.Fn memchr -function conforms to -.St -ansiC . -.Pp -The -.Fn memrchr -function is an -.Ox -extension. -.Sh HISTORY -The -.Fn memchr -function first appeared in -.At V -and was reimplemented for -.Bx 4.3 Tahoe . diff --git a/src/lib/libc/string/memchr.c b/src/lib/libc/string/memchr.c deleted file mode 100644 index 4573e3ceb1..0000000000 --- a/src/lib/libc/string/memchr.c +++ /dev/null @@ -1,48 +0,0 @@ -/* $OpenBSD: memchr.c,v 1.7 2005/08/08 08:05:37 espie Exp $ */ -/*- - * Copyright (c) 1990 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. 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 - -void * -memchr(const void *s, int c, size_t n) -{ - if (n != 0) { - const unsigned char *p = s; - - do { - if (*p++ == (unsigned char)c) - return ((void *)(p - 1)); - } while (--n != 0); - } - return (NULL); -} diff --git a/src/lib/libc/string/memcmp.3 b/src/lib/libc/string/memcmp.3 deleted file mode 100644 index ebd838825a..0000000000 --- a/src/lib/libc/string/memcmp.3 +++ /dev/null @@ -1,85 +0,0 @@ -.\" $OpenBSD: memcmp.3,v 1.8 2013/06/05 03:39:23 tedu Exp $ -.\" -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt MEMCMP 3 -.Os -.Sh NAME -.Nm memcmp -.Nd compare byte string -.Sh SYNOPSIS -.In 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 -.Li 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 , -.Xr wmemcmp 3 -.Sh STANDARDS -The -.Fn memcmp -function conforms to -.St -ansiC . -.Sh HISTORY -The -.Fn memcmp -function first appeared in -.At V -and was reimplemented for -.Bx 4.3 Tahoe . diff --git a/src/lib/libc/string/memcmp.c b/src/lib/libc/string/memcmp.c deleted file mode 100644 index 49384a6fb9..0000000000 --- a/src/lib/libc/string/memcmp.c +++ /dev/null @@ -1,51 +0,0 @@ -/* $OpenBSD: memcmp.c,v 1.5 2005/08/08 08:05:37 espie Exp $ */ -/*- - * Copyright (c) 1990 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. 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 - -/* - * Compare memory regions. - */ -int -memcmp(const void *s1, const void *s2, size_t n) -{ - if (n != 0) { - const unsigned char *p1 = s1, *p2 = s2; - - do { - if (*p1++ != *p2++) - return (*--p1 - *--p2); - } while (--n != 0); - } - return (0); -} diff --git a/src/lib/libc/string/memcpy.3 b/src/lib/libc/string/memcpy.3 deleted file mode 100644 index 8df2a785b9..0000000000 --- a/src/lib/libc/string/memcpy.3 +++ /dev/null @@ -1,79 +0,0 @@ -.\" $OpenBSD: memcpy.3,v 1.10 2013/06/05 03:39:23 tedu Exp $ -.\" -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt MEMCPY 3 -.Os -.Sh NAME -.Nm memcpy -.Nd copy bytes -.Sh SYNOPSIS -.In 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 buffer -.Fa src -to buffer -.Fa dst . -If the two buffers may overlap, -.Xr memmove 3 -must be used instead. -.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 , -.Xr strlcpy 3 , -.Xr wmemcpy 3 -.Sh STANDARDS -The -.Fn memcpy -function conforms to -.St -ansiC . -.Sh HISTORY -The -.Fn memcpy -function first appeared in -.At V -and was reimplemented for -.Bx 4.3 Tahoe . diff --git a/src/lib/libc/string/memmem.3 b/src/lib/libc/string/memmem.3 deleted file mode 100644 index b0b0bb966b..0000000000 --- a/src/lib/libc/string/memmem.3 +++ /dev/null @@ -1,77 +0,0 @@ -.\" $OpenBSD: memmem.3,v 1.2 2013/07/16 15:21:11 schwarze Exp $ -.\" -.\" Copyright (c) 2005 Pascal Gloor -.\" -.\" 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 BY THE AUTHOR 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 AUTHOR 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. -.\" -.Dd $Mdocdate: July 16 2013 $ -.Dt MEMMEM 3 -.Os -.Sh NAME -.Nm memmem -.Nd locate a byte substring in a byte string -.Sh SYNOPSIS -.In string.h -.Ft "void *" -.Fo memmem -.Fa "const void *big" "size_t big_len" -.Fa "const void *little" "size_t little_len" -.Fc -.Sh DESCRIPTION -The -.Fn memmem -function -locates the first occurrence of the byte string -.Fa little -in the byte string -.Fa big . -.Sh RETURN VALUES -If -.Fa little -is zero length, -.Fa big -is returned; if -.Fa little -occurs nowhere in -.Fa big , -.Dv NULL -is returned; -otherwise a pointer to the first character of the first occurrence of -.Fa little -is returned. -.Sh SEE ALSO -.Xr memchr 3 , -.Xr strchr 3 , -.Xr strstr 3 -.Sh STANDARDS -.Fn memmem -is a GNU extension. -.Sh HISTORY -The -.Fn memmem -function first appeared in -.Ox 5.4 . -.Sh AUTHORS -.An Pascal Gloor Aq Mt pascal.gloor@spale.com diff --git a/src/lib/libc/string/memmem.c b/src/lib/libc/string/memmem.c deleted file mode 100644 index 5793a7dfd7..0000000000 --- a/src/lib/libc/string/memmem.c +++ /dev/null @@ -1,63 +0,0 @@ -/* $OpenBSD: memmem.c,v 1.3 2013/05/30 01:10:45 ajacoutot Exp $ */ -/*- - * Copyright (c) 2005 Pascal Gloor - * - * 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 BY THE AUTHOR 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 AUTHOR 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 - -/* - * Find the first occurrence of the byte string s in byte string l. - */ - -void * -memmem(const void *l, size_t l_len, const void *s, size_t s_len) -{ - const char *cur, *last; - const char *cl = l; - const char *cs = s; - - /* a zero length needle should just return the haystack */ - if (s_len == 0) - return (void *)cl; - - /* "s" must be smaller or equal to "l" */ - if (l_len < s_len) - return NULL; - - /* special case where s_len == 1 */ - if (s_len == 1) - return memchr(l, *cs, l_len); - - /* the last position where its possible to find "s" in "l" */ - last = cl + l_len - s_len; - - for (cur = cl; cur <= last; cur++) - if (cur[0] == cs[0] && memcmp(cur, cs, s_len) == 0) - return (void *)cur; - - return NULL; -} diff --git a/src/lib/libc/string/memmove.3 b/src/lib/libc/string/memmove.3 deleted file mode 100644 index 8665e4abcf..0000000000 --- a/src/lib/libc/string/memmove.3 +++ /dev/null @@ -1,76 +0,0 @@ -.\" $OpenBSD: memmove.3,v 1.9 2013/06/05 03:39:23 tedu Exp $ -.\" -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt MEMMOVE 3 -.Os -.Sh NAME -.Nm memmove -.Nd copy bytes -.Sh SYNOPSIS -.In 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 buffer -.Fa src -to buffer -.Fa dst . -The two buffers 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 , -.Xr strlcpy 3 , -.Xr wmemmove 3 -.Sh STANDARDS -The -.Fn memmove -function conforms to -.St -ansiC . -.Sh HISTORY -The -.Fn memmove -function first appeared in -.Bx 4.3 Reno . diff --git a/src/lib/libc/string/memrchr.c b/src/lib/libc/string/memrchr.c deleted file mode 100644 index bd27ebc620..0000000000 --- a/src/lib/libc/string/memrchr.c +++ /dev/null @@ -1,38 +0,0 @@ -/* $OpenBSD: memrchr.c,v 1.2 2007/11/27 16:22:12 martynas Exp $ */ - -/* - * Copyright (c) 2007 Todd C. Miller - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include - -/* - * Reverse memchr() - * Find the last occurrence of 'c' in the buffer 's' of size 'n'. - */ -void * -memrchr(const void *s, int c, size_t n) -{ - const unsigned char *cp; - - if (n != 0) { - cp = (unsigned char *)s + n; - do { - if (*(--cp) == (unsigned char)c) - return((void *)cp); - } while (--n != 0); - } - return(NULL); -} diff --git a/src/lib/libc/string/memset.3 b/src/lib/libc/string/memset.3 deleted file mode 100644 index ac5b7e90ad..0000000000 --- a/src/lib/libc/string/memset.3 +++ /dev/null @@ -1,75 +0,0 @@ -.\" $OpenBSD: memset.3,v 1.8 2013/06/05 03:39:23 tedu Exp $ -.\" -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt MEMSET 3 -.Os -.Sh NAME -.Nm memset -.Nd write a byte to byte string -.Sh SYNOPSIS -.In 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 -.Li unsigned char ) -to the string -.Fa b . -.Sh RETURN VALUES -The -.Fn memset -function returns the original value of -.Fa b . -.Sh SEE ALSO -.Xr bzero 3 , -.Xr swab 3 , -.Xr wmemset 3 -.Sh STANDARDS -The -.Fn memset -function conforms to -.St -ansiC . -.Sh HISTORY -The -.Fn memset -function first appeared in -.At V -and was reimplemented for -.Bx 4.3 Tahoe . diff --git a/src/lib/libc/string/memset.c b/src/lib/libc/string/memset.c deleted file mode 100644 index 61709c139d..0000000000 --- a/src/lib/libc/string/memset.c +++ /dev/null @@ -1,47 +0,0 @@ -/* $OpenBSD: memset.c,v 1.6 2008/03/15 21:40:39 ray Exp $ */ -/*- - * Copyright (c) 1990 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. 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 - -void * -memset(void *dst, int c, size_t n) -{ - if (n != 0) { - unsigned char *d = dst; - - do - *d++ = (unsigned char)c; - while (--n != 0); - } - return (dst); -} diff --git a/src/lib/libc/string/rindex.c b/src/lib/libc/string/rindex.c deleted file mode 100644 index bf9d6f7cf1..0000000000 --- a/src/lib/libc/string/rindex.c +++ /dev/null @@ -1,49 +0,0 @@ -/* $OpenBSD: rindex.c,v 1.6 2005/08/08 08:05:37 espie Exp $ */ -/* - * Copyright (c) 1988 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. 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 - -char * -#ifdef STRRCHR -strrchr(const char *p, int ch) -#else -rindex(const char *p, int ch) -#endif -{ - char *save; - - for (save = NULL;; ++p) { - if (*p == ch) - save = (char *)p; - if (!*p) - return(save); - } - /* NOTREACHED */ -} diff --git a/src/lib/libc/string/stpcpy.3 b/src/lib/libc/string/stpcpy.3 deleted file mode 100644 index 973eebecdd..0000000000 --- a/src/lib/libc/string/stpcpy.3 +++ /dev/null @@ -1,184 +0,0 @@ -.\" $OpenBSD: stpcpy.3,v 1.6 2014/02/23 23:09:34 schwarze Exp $ -.\" -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.Dd $Mdocdate: February 23 2014 $ -.Dt STPCPY 3 -.Os -.Sh NAME -.Nm stpcpy , -.Nm stpncpy -.Nd copy strings -.Sh SYNOPSIS -.In string.h -.Ft char * -.Fn stpcpy "char *dst" "const char *src" -.Ft char * -.Fn stpncpy "char *dst" "const char *src" "size_t len" -.Sh DESCRIPTION -The -.Fn stpcpy -and -.Fn stpncpy -functions copy the string -.Fa src -to -.Fa dst -(including the terminating -.Ql \e0 -character). -.Pp -The -.Fn stpncpy -function 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 the length of -.Fa src -is greater than or equal to -.Fa len . -.Pp -If the -.Fa src -and -.Fa dst -strings overlap, the behavior is undefined. -.Sh RETURN VALUES -The -.Fn stpcpy -function returns a pointer to the terminating -.Ql \e0 -character written into -.Fa dst . -.Pp -The -.Fn stpncpy -function returns a pointer to the first -.Ql \e0 -character written into -.Fa dst , -or to -.Fa &dst[len] -if the length of -.Fa src -is greater than or equal to -.Fa len . -.Sh EXAMPLES -The most common use of -.Fn stpcpy -is to build up a string from multiple elements. -The following example builds up a pathname from -directory and file components using -.Fn stpcpy : -.Bd -literal -offset indent -char *dir, *file, pname[PATH_MAX]; - -\&... - -if (strlen(dir) + strlen("/") + strlen(file) >= sizeof(pname)) - goto toolong; -stpcpy(stpcpy(stpcpy(pname, dir), "/"), file); -.Ed -.Pp -However, the size check required to avoid a buffer overflow is error -prone since the check can become out of sync with the code that -performs the copy. -.Pp -One might expect that -.Fn stpncpy -could be safely used instead, but it suffers from the same defects as -.Fn strncpy . -The example below using -.Fn stpncpy -is even more prone to error and will not detect when truncation occurs: -.Bd -literal -offset indent -char *dir, *file, pname[PATH_MAX]; -char *p1, *p2; - -\&... - -p1 = stpncpy(pname, dir, sizeof(pname) - 1); -p2 = stpncpy(p1, "/", sizeof(pname) - 1 - (p1 - pname)); -stpncpy(p2, file, sizeof(pname) - 1 - (p2 - pname)); -pname[sizeof(pname) - 1] = '\e0'; -.Ed -.Pp -A safer (and simpler) approach is to use -.Fn snprintf : -.Bd -literal -offset indent -char *dir, *file, pname[PATH_MAX]; -int len; - -\&... - -len = snprintf(pname, sizeof(pname), "%s/%s", dir, file); -if (len >= sizeof(pname)) - goto toolong; -.Ed -.Pp -In most cases, it is better to use -.Fn snprintf , -.Fn strlcpy , -or -.Fn strlcat . -.Sh SEE ALSO -.Xr snprintf 3 , -.Xr strcpy 3 , -.Xr strlcpy 3 , -.Xr strncpy 3 -.Sh STANDARDS -The -.Fn stpcpy -and -.Fn stpncpy -functions conform to -.St -p1003.1-2008 . -.Sh HISTORY -The function -.Fn stpcpy -first appeared in the Lattice C AmigaDOS compiler (1986 or earlier). -The function -.Fn stpncpy -first appeared in the GNU C library version 1.07 (1993). -Both functions have been available since -.Ox 5.1 . diff --git a/src/lib/libc/string/stpcpy.c b/src/lib/libc/string/stpcpy.c deleted file mode 100644 index d3d61e0f14..0000000000 --- a/src/lib/libc/string/stpcpy.c +++ /dev/null @@ -1,44 +0,0 @@ -/* $OpenBSD: stpcpy.c,v 1.1 2012/01/17 02:48:01 guenther Exp $ */ - -/* - * Copyright (c) 1988 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. 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 - -#if defined(APIWARN) -__warn_references(stpcpy, - "warning: stpcpy() is dangerous GNU crap; don't use it"); -#endif - -char * -stpcpy(char *to, const char *from) -{ - for (; (*to = *from) != '\0'; ++from, ++to); - return(to); -} diff --git a/src/lib/libc/string/stpncpy.c b/src/lib/libc/string/stpncpy.c deleted file mode 100644 index c7c2a57c4c..0000000000 --- a/src/lib/libc/string/stpncpy.c +++ /dev/null @@ -1,56 +0,0 @@ -/* $OpenBSD: stpncpy.c,v 1.2 2012/07/11 10:44:59 naddy Exp $ */ - -/*- - * Copyright (c) 1990 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. 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 - -char * -stpncpy(char *dst, const char *src, size_t n) -{ - if (n != 0) { - char *d = dst; - const char *s = src; - - dst = &dst[n]; - do { - if ((*d++ = *s++) == 0) { - dst = d - 1; - /* NUL pad the remaining n-1 bytes */ - while (--n != 0) - *d++ = 0; - break; - } - } while (--n != 0); - } - return (dst); -} diff --git a/src/lib/libc/string/strcasecmp.3 b/src/lib/libc/string/strcasecmp.3 deleted file mode 100644 index 8bd7387dc5..0000000000 --- a/src/lib/libc/string/strcasecmp.3 +++ /dev/null @@ -1,92 +0,0 @@ -.\" $OpenBSD: strcasecmp.3,v 1.12 2013/06/05 03:39:23 tedu Exp $ -.\" -.\" 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. 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 -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt STRCASECMP 3 -.Os -.Sh NAME -.Nm strcasecmp , -.Nm strncasecmp -.Nd compare strings, ignoring case -.Sh SYNOPSIS -.In 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 NUL-terminated strings -.Fa s1 -and -.Fa s2 -and return an integer greater than, equal to, or less than 0, -according to whether -.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 -.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 wcscasecmp 3 -.Sh STANDARDS -The -.Fn strcasecmp -and -.Fn strncasecmp -functions conform to -.St -p1003.1-2008 . -.Sh HISTORY -The -.Fn strcasecmp -and -.Fn strncasecmp -functions first appeared in -.Bx 4.3 Tahoe . diff --git a/src/lib/libc/string/strcasecmp.c b/src/lib/libc/string/strcasecmp.c deleted file mode 100644 index 2be09136c0..0000000000 --- a/src/lib/libc/string/strcasecmp.c +++ /dev/null @@ -1,105 +0,0 @@ -/* $OpenBSD: strcasecmp.c,v 1.6 2005/08/08 08:05:37 espie Exp $ */ - -/* - * 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. 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 - -typedef unsigned char u_char; - -/* - * This array is designed for mapping upper and lower case letter - * together for a case independent comparison. The mappings are - * based upon ascii character sequences. - */ -static const u_char charmap[] = { - '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007', - '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017', - '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027', - '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037', - '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047', - '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057', - '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067', - '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077', - '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147', - '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', - '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', - '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137', - '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147', - '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', - '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', - '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177', - '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207', - '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217', - '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', - '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', - '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247', - '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257', - '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267', - '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277', - '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307', - '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317', - '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327', - '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337', - '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', - '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', - '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', - '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377', -}; - -int -strcasecmp(const char *s1, const char *s2) -{ - const u_char *cm = charmap; - const u_char *us1 = (const u_char *)s1; - const u_char *us2 = (const u_char *)s2; - - while (cm[*us1] == cm[*us2++]) - if (*us1++ == '\0') - return (0); - return (cm[*us1] - cm[*--us2]); -} - -int -strncasecmp(const char *s1, const char *s2, size_t n) -{ - if (n != 0) { - const u_char *cm = charmap; - const u_char *us1 = (const u_char *)s1; - const u_char *us2 = (const u_char *)s2; - - do { - if (cm[*us1] != cm[*us2++]) - return (cm[*us1] - cm[*--us2]); - if (*us1++ == '\0') - break; - } while (--n != 0); - } - return (0); -} diff --git a/src/lib/libc/string/strcasestr.c b/src/lib/libc/string/strcasestr.c deleted file mode 100644 index aa74c0176d..0000000000 --- a/src/lib/libc/string/strcasestr.c +++ /dev/null @@ -1,60 +0,0 @@ -/* $OpenBSD: strcasestr.c,v 1.3 2006/03/31 05:34:55 deraadt Exp $ */ -/* $NetBSD: strcasestr.c,v 1.2 2005/02/09 21:35:47 kleink Exp $ */ - -/*- - * 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. 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 -#include - -/* - * Find the first occurrence of find in s, ignore case. - */ -char * -strcasestr(const char *s, const char *find) -{ - char c, sc; - size_t len; - - if ((c = *find++) != 0) { - c = (char)tolower((unsigned char)c); - len = strlen(find); - do { - do { - if ((sc = *s++) == 0) - return (NULL); - } while ((char)tolower((unsigned char)sc) != c); - } while (strncasecmp(s, find, len) != 0); - s--; - } - return ((char *)s); -} diff --git a/src/lib/libc/string/strcat.3 b/src/lib/libc/string/strcat.3 deleted file mode 100644 index fba992edd9..0000000000 --- a/src/lib/libc/string/strcat.3 +++ /dev/null @@ -1,81 +0,0 @@ -.\" $OpenBSD: strcat.3,v 1.16 2013/12/19 20:52:37 millert Exp $ -.\" -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.Dd $Mdocdate: December 19 2013 $ -.Dt STRCAT 3 -.Os -.Sh NAME -.Nm strcat -.Nd concatenate two strings -.Sh SYNOPSIS -.In string.h -.Ft char * -.Fn strcat "char *s" "const char *append" -.Sh DESCRIPTION -The -.Fn strcat -function appends a copy of the NUL-terminated string -.Fa append -to the end of the NUL-terminated string -.Fa s , -then adds a terminating -.Ql \e0 . -The string -.Fa s -must have sufficient space to hold the result. -.Sh RETURN VALUES -The -.Fn strcat -function return the pointer -.Fa s . -.Sh SEE ALSO -.Xr bcopy 3 , -.Xr memccpy 3 , -.Xr memcpy 3 , -.Xr memmove 3 , -.Xr strcpy 3 , -.Xr strlcpy 3 , -.Xr strncat 3 , -.Xr wcscat 3 , -.Xr wcslcpy 3 -.Sh STANDARDS -The -.Fn strcat -function conforms to -.St -ansiC . -.Sh HISTORY -The -.Fn strcat -function first appeared in the Programmer's Workbench (PWB/UNIX) -and was ported to -.At v7 . diff --git a/src/lib/libc/string/strcat.c b/src/lib/libc/string/strcat.c deleted file mode 100644 index 7cea5229fb..0000000000 --- a/src/lib/libc/string/strcat.c +++ /dev/null @@ -1,51 +0,0 @@ -/* $OpenBSD: strcat.c,v 1.8 2005/08/08 08:05:37 espie Exp $ */ - -/* - * Copyright (c) 1988 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. 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(_KERNEL) && !defined(_STANDALONE) -#include -#else -#include -#endif - -#if defined(APIWARN) -__warn_references(strcat, - "warning: strcat() is almost always misused, please use strlcat()"); -#endif - -char * -strcat(char *s, const char *append) -{ - char *save = s; - - for (; *s; ++s); - while ((*s++ = *append++) != '\0'); - return(save); -} diff --git a/src/lib/libc/string/strchr.3 b/src/lib/libc/string/strchr.3 deleted file mode 100644 index eb9ac8e833..0000000000 --- a/src/lib/libc/string/strchr.3 +++ /dev/null @@ -1,114 +0,0 @@ -.\" $OpenBSD: strchr.3,v 1.11 2013/06/05 03:39:23 tedu Exp $ -.\" -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt STRCHR 3 -.Os -.Sh NAME -.Nm strchr , -.Nm index -.Nd locate first occurrence of a character in a string -.Sh SYNOPSIS -.In string.h -.Ft char * -.Fn strchr "const char *s" "int c" -.Ft char * -.Fn index "const char *s" "int c" -.Sh DESCRIPTION -The -.Fn strchr -function locates the first occurrence of the character -.Fa c -in the string -.Fa s . -The terminating NUL character is considered part of the string. -If -.Fa c -is -.Ql \e0 , -.Fn strchr -locates the terminating -.Ql \e0 . -.Pp -The -.Fn index -function is an old synonym for -.Fn strchr . -.Sh RETURN VALUES -The -.Fn strchr -function returns a pointer to the located character or -.Dv NULL -if the character does not appear in the string. -.Sh EXAMPLES -After the following call to -.Fn strchr , -.Va p -will point to the string -.Qq oobar : -.Bd -literal -offset indent -char *p; -char *s = "foobar"; - -p = strchr(s, 'o'); -.Ed -.Sh SEE ALSO -.Xr memchr 3 , -.Xr strcspn 3 , -.Xr strpbrk 3 , -.Xr strrchr 3 , -.Xr strsep 3 , -.Xr strspn 3 , -.Xr strstr 3 , -.Xr strtok 3 , -.Xr wcschr 3 -.Sh STANDARDS -The -.Fn strchr -function conforms to -.St -ansiC . -.Pp -The -.Fn index -function is deprecated and shouldn't be used in new code. -.Sh HISTORY -The -.Fn index -function first appeared in -.At v7 . -The -.Fn strchr -function first appeared in -.At III -and was reimplemented for -.Bx 4.3 Tahoe . diff --git a/src/lib/libc/string/strcmp.3 b/src/lib/libc/string/strcmp.3 deleted file mode 100644 index 63dc7fed2d..0000000000 --- a/src/lib/libc/string/strcmp.3 +++ /dev/null @@ -1,97 +0,0 @@ -.\" $OpenBSD: strcmp.3,v 1.14 2013/07/17 05:42:11 schwarze Exp $ -.\" -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.Dd $Mdocdate: July 17 2013 $ -.Dt STRCMP 3 -.Os -.Sh NAME -.Nm strcmp , -.Nm strncmp -.Nd compare strings -.Sh SYNOPSIS -.In 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 NUL-terminated strings -.Fa s1 -and -.Fa s2 . -The -.Fn strncmp -function compares at most -.Fa len -characters. -.Sh RETURN VALUES -The -.Fn strcmp -and -.Fn strncmp -functions return an integer greater than, equal to, or less than 0, according -to whether 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 , -.Xr wcscmp 3 -.Sh STANDARDS -The -.Fn strcmp -and -.Fn strncmp -functions conform to -.St -ansiC . -.Sh HISTORY -The -.Fn strcmp -function first appeared in the Programmer's Workbench (PWB/UNIX) -and was ported to -.At v7 ; -.Fn strncmp -first appeared in -.At v7 . diff --git a/src/lib/libc/string/strcmp.c b/src/lib/libc/string/strcmp.c deleted file mode 100644 index 816fd111ac..0000000000 --- a/src/lib/libc/string/strcmp.c +++ /dev/null @@ -1,51 +0,0 @@ -/* $OpenBSD: strcmp.c,v 1.7 2005/08/08 08:05:37 espie Exp $ */ - -/*- - * Copyright (c) 1990 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. 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(_KERNEL) && !defined(_STANDALONE) -#include -#else -#include -#endif - -/* - * Compare strings. - */ -int -strcmp(const char *s1, const char *s2) -{ - while (*s1 == *s2++) - if (*s1++ == 0) - return (0); - return (*(unsigned char *)s1 - *(unsigned char *)--s2); -} diff --git a/src/lib/libc/string/strcoll.3 b/src/lib/libc/string/strcoll.3 deleted file mode 100644 index d421200b62..0000000000 --- a/src/lib/libc/string/strcoll.3 +++ /dev/null @@ -1,73 +0,0 @@ -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.\" $OpenBSD: strcoll.3,v 1.9 2013/06/05 03:39:23 tedu Exp $ -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt STRCOLL 3 -.Os -.Sh NAME -.Nm strcoll -.Nd compare strings according to current collation -.Sh SYNOPSIS -.In string.h -.Ft int -.Fn strcoll "const char *s1" "const char *s2" -.Sh DESCRIPTION -The -.Fn strcoll -function lexicographically compares the NUL-terminated strings -.Fa s1 -and -.Fa s2 -according to the current locale collation -and returns an integer greater than, equal to, or less than 0, -according to whether -.Fa s1 -is greater than, equal to, or less than -.Fa s2 . -.Sh SEE ALSO -.Xr bcmp 3 , -.Xr memcmp 3 , -.Xr setlocale 3 , -.Xr strcasecmp 3 , -.Xr strcmp 3 , -.Xr strxfrm 3 -.Sh STANDARDS -The -.Fn strcoll -function conforms to -.St -ansiC . -.Sh HISTORY -The -.Fn strcoll -function first appeared in -.Bx 4.3 Reno . diff --git a/src/lib/libc/string/strcoll.c b/src/lib/libc/string/strcoll.c deleted file mode 100644 index 2df983bd65..0000000000 --- a/src/lib/libc/string/strcoll.c +++ /dev/null @@ -1,44 +0,0 @@ -/* $OpenBSD: strcoll.c,v 1.5 2005/08/08 08:05:37 espie Exp $ */ -/*- - * Copyright (c) 1990 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. 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 - -/* - * Compare strings according to LC_COLLATE category of current locale. - */ -int -strcoll(const char *s1, const char *s2) -{ - /* LC_COLLATE is unimplemented, hence always "C" */ - return (strcmp(s1, s2)); -} diff --git a/src/lib/libc/string/strcpy.3 b/src/lib/libc/string/strcpy.3 deleted file mode 100644 index 849184d1f5..0000000000 --- a/src/lib/libc/string/strcpy.3 +++ /dev/null @@ -1,92 +0,0 @@ -.\" $OpenBSD: strcpy.3,v 1.20 2013/12/19 20:52:37 millert Exp $ -.\" -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.Dd $Mdocdate: December 19 2013 $ -.Dt STRCPY 3 -.Os -.Sh NAME -.Nm strcpy -.Nd copy a string -.Sh SYNOPSIS -.In string.h -.Ft char * -.Fn strcpy "char *dst" "const char *src" -.Sh DESCRIPTION -The -.Fn strcpy -function copies the string -.Fa src -to -.Fa dst -(including the terminating -.Ql \e0 -character). -The string -.Fa dst -must be at least as large as -.Fa src -to hold the result. -.Pp -If the -.Fa src -and -.Fa dst -strings overlap, the behavior is undefined. -.Sh RETURN VALUES -The -.Fn strcpy -function returns -.Fa dst . -.Sh SEE ALSO -.Xr bcopy 3 , -.Xr memccpy 3 , -.Xr memcpy 3 , -.Xr memmove 3 , -.Xr strcat 3 , -.Xr strlcpy 3 , -.Xr strncpy 3 , -.Xr wcscpy 3 , -.Xr wcslcpy 3 -.Sh STANDARDS -The -.Fn strcpy -and -.Fn strncpy -functions conform to -.St -ansiC . -.Sh HISTORY -The -.Fn strcpy -function first appeared in the Programmer's Workbench (PWB/UNIX) -and was ported to -.At v7 . diff --git a/src/lib/libc/string/strcpy.c b/src/lib/libc/string/strcpy.c deleted file mode 100644 index 71d90d4100..0000000000 --- a/src/lib/libc/string/strcpy.c +++ /dev/null @@ -1,50 +0,0 @@ -/* $OpenBSD: strcpy.c,v 1.8 2005/08/08 08:05:37 espie Exp $ */ - -/* - * Copyright (c) 1988 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. 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(_KERNEL) && !defined(_STANDALONE) -#include -#else -#include -#endif - -#if defined(APIWARN) -__warn_references(strcpy, - "warning: strcpy() is almost always misused, please use strlcpy()"); -#endif - -char * -strcpy(char *to, const char *from) -{ - char *save = to; - - for (; (*to = *from) != '\0'; ++from, ++to); - return(save); -} diff --git a/src/lib/libc/string/strcspn.3 b/src/lib/libc/string/strcspn.3 deleted file mode 100644 index 07eb9ca26f..0000000000 --- a/src/lib/libc/string/strcspn.3 +++ /dev/null @@ -1,108 +0,0 @@ -.\" $OpenBSD: strcspn.3,v 1.11 2013/06/05 03:39:23 tedu Exp $ -.\" -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt STRCSPN 3 -.Os -.Sh NAME -.Nm strcspn -.Nd span the complement of a string -.Sh SYNOPSIS -.In 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 NUL-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 EXAMPLES -The following call to -.Fn strcspn -will return 3, since the first three characters of string -.Fa s -do not occur in string -.Fa charset : -.Bd -literal -offset indent -char *s = "foobar"; -char *charset = "bar"; -size_t span; - -span = strcspn(s, charset); -.Ed -.Pp -The following removes the first (if any) newline character from string -.Fa line . -This is useful for trimming the newline after a -.Xr fgets 3 -call. -.Bd -literal -offset indent -char line[BUFSIZ]; - -if (fgets(line, sizeof(line), fp) != NULL) - line[strcspn(line, "\en")] = '\e0'; -.Ed -.Sh SEE ALSO -.Xr memchr 3 , -.Xr strchr 3 , -.Xr strpbrk 3 , -.Xr strrchr 3 , -.Xr strsep 3 , -.Xr strspn 3 , -.Xr strstr 3 , -.Xr strtok 3 , -.Xr wcscspn 3 -.Sh STANDARDS -The -.Fn strcspn -function conforms to -.St -ansiC . -.Sh HISTORY -The -.Fn strcspn -function first appeared in -.At III -and was reimplemented for -.Bx 4.3 Tahoe . diff --git a/src/lib/libc/string/strcspn.c b/src/lib/libc/string/strcspn.c deleted file mode 100644 index 1eb233614d..0000000000 --- a/src/lib/libc/string/strcspn.c +++ /dev/null @@ -1,58 +0,0 @@ -/* $OpenBSD: strcspn.c,v 1.5 2005/08/08 08:05:37 espie Exp $ */ -/*- - * Copyright (c) 1990 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. 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 - -/* - * Span the complement of string s2. - */ -size_t -strcspn(const char *s1, const char *s2) -{ - const char *p, *spanp; - 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/src/lib/libc/string/strdup.3 b/src/lib/libc/string/strdup.3 deleted file mode 100644 index 2d7fa0bb96..0000000000 --- a/src/lib/libc/string/strdup.3 +++ /dev/null @@ -1,112 +0,0 @@ -.\" $OpenBSD: strdup.3,v 1.20 2013/06/05 03:39:23 tedu Exp $ -.\" -.\" 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. 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 -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt STRDUP 3 -.Os -.Sh NAME -.Nm strdup , -.Nm strndup -.Nd save a copy of a string -.Sh SYNOPSIS -.In string.h -.Ft char * -.Fn strdup "const char *s" -.Ft char * -.Fn strndup "const char *s" "size_t maxlen" -.Sh DESCRIPTION -The -.Fn strdup -function allocates sufficient memory for a copy of the string -.Fa s , -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 -The -.Fn strndup -function behaves similarly to -.Nm strdup -but only copies up to -.Fa maxlen -characters from -.Fa s . -The resulting string is always NUL-terminated. -.Pp -If insufficient memory is available, -.Dv NULL -is returned. -.Sh EXAMPLES -The following will point -.Va p -to an allocated area of memory containing the NUL-terminated string -.Qq foobar : -.Bd -literal -offset indent -char *p; - -p = strdup("foobar"); -if (p == NULL) - err(1, NULL); -.Ed -.Sh ERRORS -The -.Fn strdup -and -.Fn strndup -functions may fail and set the external variable -.Va errno -for any of the errors specified for the library function -.Xr malloc 3 . -.Sh SEE ALSO -.Xr free 3 , -.Xr malloc 3 , -.Xr strcpy 3 , -.Xr strlcpy 3 , -.Xr strlen 3 , -.Xr wcsdup 3 -.Sh STANDARDS -The -.Fn strdup -and -.Fn strndup -functions conform to -.St -p1003.1-2008 . -.Sh HISTORY -The -.Fn strdup -function first appeared in -.Bx 4.3 Reno . -The -.Fn strndup -function appeared in glibc 2.0, was reimplemented for -.Nx 4.0 , -and ported to -.Ox 4.8 . diff --git a/src/lib/libc/string/strdup.c b/src/lib/libc/string/strdup.c deleted file mode 100644 index a6aa1e03b0..0000000000 --- a/src/lib/libc/string/strdup.c +++ /dev/null @@ -1,49 +0,0 @@ -/* $OpenBSD: strdup.c,v 1.6 2005/08/08 08:05:37 espie Exp $ */ - -/* - * 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. 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 - -#include -#include -#include - -char * -strdup(const char *str) -{ - size_t siz; - char *copy; - - siz = strlen(str) + 1; - if ((copy = malloc(siz)) == NULL) - return(NULL); - (void)memcpy(copy, str, siz); - return(copy); -} diff --git a/src/lib/libc/string/strerror.3 b/src/lib/libc/string/strerror.3 deleted file mode 100644 index 264ac39052..0000000000 --- a/src/lib/libc/string/strerror.3 +++ /dev/null @@ -1,123 +0,0 @@ -.\" Copyright (c) 1980, 1991 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. 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. -.\" -.\" $OpenBSD: strerror.3,v 1.13 2014/04/07 17:57:56 schwarze Exp $ -.\" -.Dd $Mdocdate: April 7 2014 $ -.Dt STRERROR 3 -.Os -.Sh NAME -.Nm strerror , -.Nm strerror_r -.Nd get error message string -.Sh SYNOPSIS -.In string.h -.Ft char * -.Fn strerror "int errnum" -.Ft int -.Fn strerror_r "int errnum" "char *strerrbuf" "size_t buflen" -.Sh DESCRIPTION -The -.Fn strerror -and -.Fn strerror_r -functions map the error number -.Fa errnum -to a language-dependent error message string. -.Pp -.Fn strerror -returns a string containing a maximum of -.Dv NL_TEXTMAX -characters, including the trailing NUL. -This string is not to be modified by the calling program, -but may be overwritten by subsequent calls to -.Fn strerror . -.Pp -.Fn strerror_r -is a thread safe version of -.Fn strerror -that places the error message in the specified buffer -.Fa strerrbuf . -.Sh RETURN VALUES -.Fn strerror -returns a pointer to the error message string. -If an error occurs, the error code is stored in -.Va errno . -.Pp -.Fn strerror_r -returns zero upon successful completion. -If an error occurs, the error code is stored in -.Va errno -and the error code is returned. -.Sh ERRORS -.Fn strerror -and -.Fn strerror_r -may fail if: -.Bl -tag -width Er -.It Bq Er EINVAL -.Fa errnum -is not a valid error number. -The returned error string will consist of an error message that includes -.Fa errnum . -.El -.Pp -.Fn strerror_r -may fail if: -.Bl -tag -width Er -.It Bq Er ERANGE -The error message is larger than -.Fa buflen -characters. -The message will be truncated to fit. -.El -.Sh SEE ALSO -.Xr intro 2 , -.Xr perror 3 , -.Xr setlocale 3 -.Sh STANDARDS -The -.Fn strerror -function conforms to -.St -ansiC-99 . -The -.Fn strerror_r -function conforms to -.St -p1003.1-2008 . -.Sh HISTORY -The -.Fn strerror -function first appeared in -.Bx 4.3 Reno . -The -.Fn strerror_r -function first appeared in -.Ox 3.3 . diff --git a/src/lib/libc/string/strerror.c b/src/lib/libc/string/strerror.c deleted file mode 100644 index 13996f08e9..0000000000 --- a/src/lib/libc/string/strerror.c +++ /dev/null @@ -1,41 +0,0 @@ -/* $OpenBSD: strerror.c,v 1.7 2005/08/08 08:05:37 espie Exp $ */ -/* - * Copyright (c) 1988 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. 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 -#include - -char * -strerror(int num) -{ - static char buf[NL_TEXTMAX]; - - (void)strerror_r(num, buf, sizeof(buf)); - return (buf); -} diff --git a/src/lib/libc/string/strerror_r.c b/src/lib/libc/string/strerror_r.c deleted file mode 100644 index b85136055b..0000000000 --- a/src/lib/libc/string/strerror_r.c +++ /dev/null @@ -1,137 +0,0 @@ -/* $OpenBSD: strerror_r.c,v 1.8 2013/06/01 21:26:18 stsp Exp $ */ -/* Public Domain */ - -#ifdef NLS -#define catclose _catclose -#define catgets _catgets -#define catopen _catopen -#include -#endif - -#define sys_errlist _sys_errlist -#define sys_nerr _sys_nerr -#define sys_siglist _sys_siglist - -#include -#include -#include -#include - -static size_t -__digits10(unsigned int num) -{ - size_t i = 0; - - do { - num /= 10; - i++; - } while (num != 0); - - return i; -} - -static int -__itoa(int num, int sign, char *buffer, size_t start, size_t end) -{ - size_t pos; - unsigned int a; - int neg; - - if (sign && num < 0) { - a = -num; - neg = 1; - } - else { - a = num; - neg = 0; - } - - pos = start + __digits10(a); - if (neg) - pos++; - - if (pos < end) - buffer[pos] = '\0'; - else - return ERANGE; - pos--; - do { - buffer[pos] = (a % 10) + '0'; - pos--; - a /= 10; - } while (a != 0); - if (neg) - buffer[pos] = '-'; - return 0; -} - - -static int -__num2string(int num, int sign, int setid, char *buf, size_t buflen, - char * list[], size_t max, const char *def) -{ - int ret = 0; - size_t len; - -#ifdef NLS - nl_catd catd; - catd = catopen("libc", NL_CAT_LOCALE); -#endif - - if (0 <= num && num < max) { -#ifdef NLS - len = strlcpy(buf, catgets(catd, setid, num, list[num]), - buflen); -#else - len = strlcpy(buf, list[num], buflen); -#endif - if (len >= buflen) - ret = ERANGE; - } else { -#ifdef NLS - len = strlcpy(buf, catgets(catd, setid, 0xffff, def), buflen); -#else - len = strlcpy(buf, def, buflen); -#endif - if (len >= buflen) - ret = ERANGE; - else { - ret = __itoa(num, sign, buf, len, buflen); - if (ret == 0) - ret = EINVAL; - } - } - -#ifdef NLS - catclose(catd); -#endif - - return ret; -} - -#define UPREFIX "Unknown error: " - -int -strerror_r(int errnum, char *strerrbuf, size_t buflen) -{ - int save_errno; - int ret_errno; - - save_errno = errno; - - ret_errno = __num2string(errnum, 1, 1, strerrbuf, buflen, - sys_errlist, sys_nerr, UPREFIX); - - errno = ret_errno ? ret_errno : save_errno; - return (ret_errno); -} - -#define USIGPREFIX "Unknown signal: " - -char * -__strsignal(int num, char *buf) -{ - __num2string(num, 0, 2, buf, NL_TEXTMAX, (char **)sys_siglist, NSIG, - USIGPREFIX); - return buf; -} diff --git a/src/lib/libc/string/string.3 b/src/lib/libc/string/string.3 deleted file mode 100644 index 2373d1fb9c..0000000000 --- a/src/lib/libc/string/string.3 +++ /dev/null @@ -1,136 +0,0 @@ -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.\" $OpenBSD: string.3,v 1.13 2013/06/05 03:39:23 tedu Exp $ -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt STRING 3 -.Os -.Sh NAME -.Nm string -.Nd string specific functions -.Sh SYNOPSIS -.In string.h -.Ft char * -.Fn strcat "char *s" "const char *append" -.Ft char * -.Fn strlcat "char *s" "const char *append" "size_t size" -.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 strlcpy "char *dst" "const char *src" "size_t size" -.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 -NUL byte. -.Pp -See the specific manual pages for more information. -For manipulating variable length generic objects as byte -strings (without the NUL-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 strlcat 3 , -.Xr strlcpy 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 strspn , -.Fn strcspn , -.Fn strstr , -and -.Fn strtok -functions conform to -.St -ansiC . diff --git a/src/lib/libc/string/strlcat.c b/src/lib/libc/string/strlcat.c deleted file mode 100644 index ceab094411..0000000000 --- a/src/lib/libc/string/strlcat.c +++ /dev/null @@ -1,55 +0,0 @@ -/* $OpenBSD: strlcat.c,v 1.13 2005/08/08 08:05:37 espie Exp $ */ - -/* - * Copyright (c) 1998 Todd C. Miller - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include - -/* - * 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 <= strlen(dst)). - * Returns strlen(src) + MIN(siz, strlen(initial dst)). - * If retval >= siz, truncation occurred. - */ -size_t -strlcat(char *dst, const char *src, size_t siz) -{ - char *d = dst; - const char *s = src; - size_t n = siz; - size_t dlen; - - /* Find the end of dst and adjust bytes left but don't go past end */ - while (n-- != 0 && *d != '\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/src/lib/libc/string/strlcpy.3 b/src/lib/libc/string/strlcpy.3 deleted file mode 100644 index 044c959c0c..0000000000 --- a/src/lib/libc/string/strlcpy.3 +++ /dev/null @@ -1,188 +0,0 @@ -.\" $OpenBSD: strlcpy.3,v 1.26 2013/09/30 12:02:35 millert Exp $ -.\" -.\" Copyright (c) 1998, 2000 Todd C. Miller -.\" -.\" Permission to use, copy, modify, and distribute this software for any -.\" purpose with or without fee is hereby granted, provided that the above -.\" copyright notice and this permission notice appear in all copies. -.\" -.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -.\" -.Dd $Mdocdate: September 30 2013 $ -.Dt STRLCPY 3 -.Os -.Sh NAME -.Nm strlcpy , -.Nm strlcat -.Nd size-bounded string copying and concatenation -.Sh SYNOPSIS -.In string.h -.Ft size_t -.Fn strlcpy "char *dst" "const char *src" "size_t dstsize" -.Ft size_t -.Fn strlcat "char *dst" "const char *src" "size_t dstsize" -.Sh DESCRIPTION -The -.Fn strlcpy -and -.Fn strlcat -functions copy and concatenate strings with the -same input parameters and output result as -.Xr snprintf 3 . -They are designed to be safer, more consistent, and less error -prone replacements for the easily misused functions -.Xr strncpy 3 -and -.Xr strncat 3 . -.Pp -.Fn strlcpy -and -.Fn strlcat -take the full size of the destination buffer and guarantee -NUL-termination if there is room. -Note that room for the NUL should be included in -.Fa dstsize . -.Pp -.Fn strlcpy -copies up to -.Fa dstsize -\- 1 characters from the string -.Fa src -to -.Fa dst , -NUL-terminating the result if -.Fa dstsize -is not 0. -.Pp -.Fn strlcat -appends string -.Fa src -to the end of -.Fa dst . -It will append at most -.Fa dstsize -\- strlen(dst) \- 1 characters. -It will then NUL-terminate, unless -.Fa dstsize -is 0 or the original -.Fa dst -string was longer than -.Fa dstsize -(in practice this should not happen -as it means that either -.Fa dstsize -is incorrect or that -.Fa dst -is not a proper string). -.Pp -If the -.Fa src -and -.Fa dst -strings overlap, the behavior is undefined. -.Sh RETURN VALUES -Besides quibbles over the return type -.Pf ( Va size_t -versus -.Va int ) -and signal handler safety -.Pf ( Xr snprintf 3 -is not entirely safe on some systems), the -following two are equivalent: -.Bd -literal -offset indent -n = strlcpy(dst, src, len); -n = snprintf(dst, len, "%s", src); -.Ed -.Pp -Like -.Xr snprintf 3 , -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 . -.Pp -If the return value is -.Cm >= -.Va dstsize , -the output string has been truncated. -It is the caller's responsibility to handle this. -.Sh EXAMPLES -The following code fragment illustrates the simple case: -.Bd -literal -offset indent -char *s, *p, buf[BUFSIZ]; - -\&... - -(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[PATH_MAX]; - -\&... - -if (strlcpy(pname, dir, sizeof(pname)) >= sizeof(pname)) - goto toolong; -if (strlcat(pname, file, sizeof(pname)) >= sizeof(pname)) - goto toolong; -.Ed -.Pp -Since it is known how many characters were copied the first time, things -can be sped up a bit by using a copy instead of an append: -.Bd -literal -offset indent -char *dir, *file, pname[PATH_MAX]; -size_t n; - -\&... - -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 , -.Xr wcslcpy 3 -.Sh HISTORY -.Fn strlcpy -and -.Fn strlcat -first appeared in -.Ox 2.4 . -.Sh AUTHORS -.Fn strlcpy -and -.Fn strlcat -were created by -.An Todd C. Miller Aq Mt Todd.Miller@courtesan.com . diff --git a/src/lib/libc/string/strlcpy.c b/src/lib/libc/string/strlcpy.c deleted file mode 100644 index d32b6590f1..0000000000 --- a/src/lib/libc/string/strlcpy.c +++ /dev/null @@ -1,51 +0,0 @@ -/* $OpenBSD: strlcpy.c,v 1.11 2006/05/05 15:27:38 millert Exp $ */ - -/* - * Copyright (c) 1998 Todd C. Miller - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include - -/* - * 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(char *dst, const char *src, size_t siz) -{ - char *d = dst; - const char *s = src; - size_t n = siz; - - /* Copy as many bytes as will fit */ - if (n != 0) { - while (--n != 0) { - if ((*d++ = *s++) == '\0') - break; - } - } - - /* 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/src/lib/libc/string/strlen.3 b/src/lib/libc/string/strlen.3 deleted file mode 100644 index 5428627abb..0000000000 --- a/src/lib/libc/string/strlen.3 +++ /dev/null @@ -1,105 +0,0 @@ -.\" $OpenBSD: strlen.3,v 1.12 2013/07/17 05:42:11 schwarze Exp $ -.\" -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.Dd $Mdocdate: July 17 2013 $ -.Dt STRLEN 3 -.Os -.Sh NAME -.Nm strlen , -.Nm strnlen -.Nd find length of a string -.Sh SYNOPSIS -.In string.h -.Ft size_t -.Fn strlen "const char *s" -.Ft size_t -.Fn strnlen "const char *s" "size_t maxlen" -.Sh DESCRIPTION -The -.Fn strlen -function computes the length of the string -.Fa s . -.Pp -The -.Fn strnlen -function computes the length of the string -.Fa s , -up to -.Fa maxlen -characters. -The -.Fn strnlen -function will never attempt to address more than -.Fa maxlen -characters, making it suitable for use with character arrays that are -not guaranteed to be NUL-terminated. -.Sh RETURN VALUES -The -.Fn strlen -function returns the number of characters that precede the terminating -.Tn NUL -character. -.Pp -The -.Fn strnlen -function returns the number of characters that precede the terminating -.Tn NUL -or -.Fa maxlen , -whichever is smaller. -.Sh SEE ALSO -.Xr string 3 , -.Xr wcslen 3 -.Sh STANDARDS -The -.Fn strlen -function conforms to -.St -ansiC . -.Pp -The -.Fn strlen -and -.Fn strnlen -functions conform to -.St -p1003.1-2008 . -.Sh HISTORY -The -.Fn strlen -function first appeared in the Programmer's Workbench (PWB/UNIX) -and was ported to -.At v7 . -The -.Fn strnlen -function appeared in glibc 2.0 -and was reimplemented for -.Ox 4.8 . diff --git a/src/lib/libc/string/strlen.c b/src/lib/libc/string/strlen.c deleted file mode 100644 index 12d9ec4dad..0000000000 --- a/src/lib/libc/string/strlen.c +++ /dev/null @@ -1,47 +0,0 @@ -/* $OpenBSD: strlen.c,v 1.7 2005/08/08 08:05:37 espie Exp $ */ - -/*- - * 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. 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(_KERNEL) && !defined(_STANDALONE) -#include -#else -#include -#endif - -size_t -strlen(const char *str) -{ - const char *s; - - for (s = str; *s; ++s) - ; - return (s - str); -} - diff --git a/src/lib/libc/string/strmode.3 b/src/lib/libc/string/strmode.3 deleted file mode 100644 index bebda2ca1c..0000000000 --- a/src/lib/libc/string/strmode.3 +++ /dev/null @@ -1,157 +0,0 @@ -.\" $OpenBSD: strmode.3,v 1.16 2013/06/05 03:39:23 tedu Exp $ -.\" -.\" 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. 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 -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt STRMODE 3 -.Os -.Sh NAME -.Nm strmode -.Nd convert inode status information into a symbolic string -.Sh SYNOPSIS -.In 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 NUL byte. -.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 \&? -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 -.Dq 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 -.Dq other -permissions allow reading. -.Pp -If the first character of the three character set is an -.Sq r , -the file is readable for that set of users; if a dash -.Pq Ql - , -it is not readable. -.Pp -If the second character of the three character set is a -.Sq w , -the file is writable for that set of users; if a dash -.Pq Ql - , -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 -.Dq 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 -.Dq 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 -.Pq Ql + -if 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.3 Reno . diff --git a/src/lib/libc/string/strmode.c b/src/lib/libc/string/strmode.c deleted file mode 100644 index 6f0fa34ed8..0000000000 --- a/src/lib/libc/string/strmode.c +++ /dev/null @@ -1,140 +0,0 @@ -/* $OpenBSD: strmode.c,v 1.7 2005/08/08 08:05:37 espie Exp $ */ -/*- - * Copyright (c) 1990 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. 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 -#include -#include - -/* XXX mode should be mode_t */ - -void -strmode(int mode, 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 - 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/src/lib/libc/string/strncat.3 b/src/lib/libc/string/strncat.3 deleted file mode 100644 index bd15ef10fa..0000000000 --- a/src/lib/libc/string/strncat.3 +++ /dev/null @@ -1,128 +0,0 @@ -.\" $OpenBSD: strncat.3,v 1.2 2013/12/19 22:00:58 jmc Exp $ -.\" -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.Dd $Mdocdate: December 19 2013 $ -.Dt STRNCAT 3 -.Os -.Sh NAME -.Nm strncat -.Nd concatenate a string with part of another -.Sh SYNOPSIS -.In string.h -.Ft char * -.Fn strncat "char *s" "const char *append" "size_t count" -.Sh DESCRIPTION -The -.Fn strncat -function appends not more than -.Fa count -characters of the NUL-terminated string -.Fa append -to the end of the NUL-terminated string -.Fa s . -Space for the terminating -.Ql \e0 -should not be included in -.Fa count . -The string -.Fa s -must have sufficient space to hold the result. -.Sh RETURN VALUES -The -.Fn strncat -function returns the pointer -.Fa s . -.Sh EXAMPLES -The following appends -.Dq Li abc -to -.Va chararray : -.Bd -literal -offset indent -char *letters = "abcdefghi"; - -(void)strncat(chararray, letters, 3); -.Ed -.Pp -The following example shows how to use -.Fn strncat -safely in conjunction with -.Xr strncpy 3 . -.Bd -literal -offset indent -char buf[BUFSIZ]; -char *input, *suffix; - -(void)strncpy(buf, input, sizeof(buf) - 1); -buf[sizeof(buf) - 1] = '\e0'; -(void)strncat(buf, suffix, sizeof(buf) - 1 - strlen(buf)); -.Ed -.Pp -The above will copy as many characters from -.Va input -to -.Va buf -as will fit. -It then appends as many characters from -.Va suffix -as will fit (or none -if there is no space). -For operations like this, the -.Xr strlcpy 3 -and -.Xr strlcat 3 -functions are a better choice, as shown below. -.Bd -literal -offset indent -(void)strlcpy(buf, input, sizeof(buf)); -(void)strlcat(buf, suffix, sizeof(buf)); -.Ed -.Sh SEE ALSO -.Xr bcopy 3 , -.Xr memccpy 3 , -.Xr memcpy 3 , -.Xr memmove 3 , -.Xr strcat 3 , -.Xr strcpy 3 , -.Xr strlcpy 3 , -.Xr wcscat 3 , -.Xr wcslcpy 3 -.Sh STANDARDS -The -.Fn strcat -and -.Fn strncat -functions conform to -.St -ansiC . -.Sh HISTORY -The -.Fn strncat -function first appeared in -.At v7 . diff --git a/src/lib/libc/string/strncat.c b/src/lib/libc/string/strncat.c deleted file mode 100644 index c4df4f2fad..0000000000 --- a/src/lib/libc/string/strncat.c +++ /dev/null @@ -1,57 +0,0 @@ -/* $OpenBSD: strncat.c,v 1.5 2005/08/08 08:05:37 espie Exp $ */ -/*- - * Copyright (c) 1990 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. 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 - -/* - * 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(char *dst, const char *src, size_t n) -{ - if (n != 0) { - char *d = dst; - 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/src/lib/libc/string/strncmp.c b/src/lib/libc/string/strncmp.c deleted file mode 100644 index 0aea80d7d9..0000000000 --- a/src/lib/libc/string/strncmp.c +++ /dev/null @@ -1,51 +0,0 @@ -/* $OpenBSD: strncmp.c,v 1.7 2005/08/08 08:05:37 espie Exp $ */ - -/* - * Copyright (c) 1989 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. 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(_KERNEL) && !defined(_STANDALONE) -#include -#else -#include -#endif - -int -strncmp(const char *s1, const char *s2, size_t n) -{ - - if (n == 0) - return (0); - do { - if (*s1 != *s2++) - return (*(unsigned char *)s1 - *(unsigned char *)--s2); - if (*s1++ == 0) - break; - } while (--n != 0); - return (0); -} diff --git a/src/lib/libc/string/strncpy.3 b/src/lib/libc/string/strncpy.3 deleted file mode 100644 index dd8ddb86fc..0000000000 --- a/src/lib/libc/string/strncpy.3 +++ /dev/null @@ -1,153 +0,0 @@ -.\" $OpenBSD: strncpy.3,v 1.1 2013/12/19 20:52:37 millert Exp $ -.\" -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.Dd $Mdocdate: December 19 2013 $ -.Dt STRNCPY 3 -.Os -.Sh NAME -.Nm strncpy -.Nd copy part of a string to another -.Sh SYNOPSIS -.In string.h -.Ft char * -.Fn strncpy "char *dst" "const char *src" "size_t len" -.Sh DESCRIPTION -The -.Fn strncpy -function copies not more than -.Fa len -characters from the string -.Fa src -to -.Fa dst . -If -.Fa src -is less than -.Fa len -characters long, -it appends -.Ql \e0 -characters for the rest of -.Fa len . -If the length of -.Fa src -is greater than or equal to -.Fa len , -.Fa dst -will -.Em not -be NUL-terminated. -.Pp -If the -.Fa src -and -.Fa dst -strings overlap, the behavior is undefined. -.Sh RETURN VALUES -The -.Fn strncpy -function returns -.Fa dst . -.Sh EXAMPLES -The following sets -.Va chararray -to -.Dq abc\e0\e0\e0 : -.Bd -literal -offset indent -(void)strncpy(chararray, "abc", 6); -.Ed -.Pp -The following sets -.Va chararray -to -.Dq abcdef -and does -.Em not -NUL terminate -.Va chararray -because the length of the source string is greater than or equal to the -length parameter. -.Fn strncpy -.Em only -NUL terminates the destination string when the length of the source -string is less than the length parameter. -.Bd -literal -offset indent -(void)strncpy(chararray, "abcdefgh", 6); -.Ed -.Pp -The following copies as many characters from -.Va input -to -.Va buf -as will fit and NUL terminates the result. -Because -.Fn strncpy -does -.Em not -guarantee to NUL terminate the string itself, it must be done by hand. -.Bd -literal -offset indent -char buf[BUFSIZ]; - -(void)strncpy(buf, input, sizeof(buf) - 1); -buf[sizeof(buf) - 1] = '\e0'; -.Ed -.Pp -Note that -.Xr strlcpy 3 -is a better choice for this kind of operation. -The equivalent using -.Xr strlcpy 3 -is simply: -.Bd -literal -offset indent -(void)strlcpy(buf, input, sizeof(buf)); -.Ed -.Sh SEE ALSO -.Xr bcopy 3 , -.Xr memccpy 3 , -.Xr memcpy 3 , -.Xr memmove 3 , -.Xr strcat 3 , -.Xr strlcpy 3 , -.Xr strncat 3 , -.Xr wcscpy 3 , -.Xr wcslcpy 3 -.Sh STANDARDS -The -.Fn strncpy -function conforms to -.St -ansiC . -.Sh HISTORY -The -.Fn strncpy -function first appeared in -.At v7 . diff --git a/src/lib/libc/string/strncpy.c b/src/lib/libc/string/strncpy.c deleted file mode 100644 index 4426cbe2e3..0000000000 --- a/src/lib/libc/string/strncpy.c +++ /dev/null @@ -1,62 +0,0 @@ -/* $OpenBSD: strncpy.c,v 1.6 2005/08/08 08:05:37 espie Exp $ */ - -/*- - * Copyright (c) 1990 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. 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(_KERNEL) && !defined(_STANDALONE) -#include -#else -#include -#endif - -/* - * Copy src to dst, truncating or null-padding to always copy n bytes. - * Return dst. - */ -char * -strncpy(char *dst, const char *src, size_t n) -{ - if (n != 0) { - char *d = dst; - 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/src/lib/libc/string/strndup.c b/src/lib/libc/string/strndup.c deleted file mode 100644 index 27701ac555..0000000000 --- a/src/lib/libc/string/strndup.c +++ /dev/null @@ -1,39 +0,0 @@ -/* $OpenBSD: strndup.c,v 1.1 2010/05/18 22:24:55 tedu Exp $ */ - -/* - * Copyright (c) 2010 Todd C. Miller - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include - -#include -#include -#include - -char * -strndup(const char *str, size_t maxlen) -{ - char *copy; - size_t len; - - len = strnlen(str, maxlen); - copy = malloc(len + 1); - if (copy != NULL) { - (void)memcpy(copy, str, len); - copy[len] = '\0'; - } - - return copy; -} diff --git a/src/lib/libc/string/strnlen.c b/src/lib/libc/string/strnlen.c deleted file mode 100644 index a5e13ae04e..0000000000 --- a/src/lib/libc/string/strnlen.c +++ /dev/null @@ -1,36 +0,0 @@ -/* $OpenBSD: strnlen.c,v 1.4 2012/04/26 01:22:31 matthew Exp $ */ - -/* - * Copyright (c) 2010 Todd C. Miller - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#else -#include -#endif - -size_t -strnlen(const char *str, size_t maxlen) -{ - const char *cp; - - for (cp = str; maxlen != 0 && *cp != '\0'; cp++, maxlen--) - ; - - return (size_t)(cp - str); -} diff --git a/src/lib/libc/string/strpbrk.3 b/src/lib/libc/string/strpbrk.3 deleted file mode 100644 index b758df6854..0000000000 --- a/src/lib/libc/string/strpbrk.3 +++ /dev/null @@ -1,80 +0,0 @@ -.\" $OpenBSD: strpbrk.3,v 1.10 2013/06/05 03:39:23 tedu Exp $ -.\" -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt STRPBRK 3 -.Os -.Sh NAME -.Nm strpbrk -.Nd locate multiple characters in string -.Sh SYNOPSIS -.In string.h -.Ft char * -.Fn strpbrk "const char *s" "const char *charset" -.Sh DESCRIPTION -The -.Fn strpbrk -function locates in the NUL-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 -.Dv NULL . -.Sh SEE ALSO -.Xr memchr 3 , -.Xr strchr 3 , -.Xr strcspn 3 , -.Xr strrchr 3 , -.Xr strsep 3 , -.Xr strspn 3 , -.Xr strstr 3 , -.Xr strtok 3 , -.Xr wcspbrk 3 -.Sh STANDARDS -The -.Fn strpbrk -function conforms to -.St -ansiC . -.Sh HISTORY -The -.Fn strpbrk -function first appeared in -.At III -and was reimplemented for -.Bx 4.3 Tahoe . diff --git a/src/lib/libc/string/strpbrk.c b/src/lib/libc/string/strpbrk.c deleted file mode 100644 index cd3b71c0d3..0000000000 --- a/src/lib/libc/string/strpbrk.c +++ /dev/null @@ -1,48 +0,0 @@ -/* $OpenBSD: strpbrk.c,v 1.5 2005/08/08 08:05:37 espie Exp $ */ -/* - * Copyright (c) 1985 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. 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 - -/* - * Find the first occurrence in s1 of a character in s2 (excluding NUL). - */ -char * -strpbrk(const char *s1, const char *s2) -{ - const char *scanp; - 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/src/lib/libc/string/strrchr.3 b/src/lib/libc/string/strrchr.3 deleted file mode 100644 index 046b28ce56..0000000000 --- a/src/lib/libc/string/strrchr.3 +++ /dev/null @@ -1,116 +0,0 @@ -.\" $OpenBSD: strrchr.3,v 1.10 2013/06/05 03:39:23 tedu Exp $ -.\" -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt STRRCHR 3 -.Os -.Sh NAME -.Nm strrchr , -.Nm rindex -.Nd locate last occurrence of a character in a string -.Sh SYNOPSIS -.In string.h -.Ft char * -.Fn strrchr "const char *s" "int c" -.Ft char * -.Fn rindex "const char *s" "int c" -.Sh DESCRIPTION -The -.Fn strrchr -function locates the last occurrence of the character -.Fa c -in the string -.Fa s . -The terminating -.Tn NUL -character is considered part of the string. -If -.Fa c -is -.Ql \e0 , -.Fn strrchr -locates the terminating -.Ql \e0 . -.Pp -The -.Fn rindex -function is an old synonym for -.Fn strrchr . -.Sh RETURN VALUES -The -.Fn strrchr -function returns a pointer to the located character or -.Dv NULL -if the character does not appear in the string. -.Sh EXAMPLES -After the following call to -.Fn strrchr , -.Va p -will point to the string -.Qq obar : -.Bd -literal -offset indent -char *p; -char *s = "foobar"; - -p = strrchr(s, 'o'); -.Ed -.Sh SEE ALSO -.Xr memchr 3 , -.Xr strchr 3 , -.Xr strcspn 3 , -.Xr strpbrk 3 , -.Xr strsep 3 , -.Xr strspn 3 , -.Xr strstr 3 , -.Xr strtok 3 , -.Xr wcsrchr 3 -.Sh STANDARDS -The -.Fn strrchr -function conforms to -.St -ansiC . -.Pp -The -.Fn rindex -function is deprecated and shouldn't be used in new code. -.Sh HISTORY -The -.Fn rindex -function first appeared in -.At v7 . -The -.Fn strrchr -function first appeared in -.At III -and was reimplemented for -.Bx 4.3 Tahoe . diff --git a/src/lib/libc/string/strsep.3 b/src/lib/libc/string/strsep.3 deleted file mode 100644 index 77053f66d7..0000000000 --- a/src/lib/libc/string/strsep.3 +++ /dev/null @@ -1,110 +0,0 @@ -.\" $OpenBSD: strsep.3,v 1.14 2013/06/05 03:39:23 tedu Exp $ -.\" -.\" 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. 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 -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt STRSEP 3 -.Os -.Sh NAME -.Nm strsep -.Nd separate strings -.Sh SYNOPSIS -.In 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 -.Dv NULL , -if the end of the string was reached) is stored in -.Fa *stringp . -The original value of -.Fa *stringp -is returned. -.Pp -An -.Dq empty -field, i.e., one caused by two adjacent delimiter characters, -can be detected by comparing the location referenced by the pointer returned -by -.Fn strsep -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 whitespace, into an -argument vector: -.Bd -literal -offset indent -char **ap, *argv[10], *inputstring; - -for (ap = argv; ap < &argv[9] && - (*ap = strsep(&inputstring, " \et")) != NULL;) { - if (**ap != '\e0') - ap++; -} -*ap = NULL; -.Ed -.Sh HISTORY -The -.Fn strsep -function first appeared in -.Bx 4.3 Reno . -It is intended as a replacement for the -.Xr strtok 3 -function. -While the -.Xr strtok 3 -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. diff --git a/src/lib/libc/string/strsep.c b/src/lib/libc/string/strsep.c deleted file mode 100644 index 2ffc4b4c46..0000000000 --- a/src/lib/libc/string/strsep.c +++ /dev/null @@ -1,70 +0,0 @@ -/* $OpenBSD: strsep.c,v 1.7 2014/02/05 20:42:32 stsp Exp $ */ - -/*- - * 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. 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 - -/* - * 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(char **stringp, const char *delim) -{ - char *s; - const char *spanp; - 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/src/lib/libc/string/strsignal.3 b/src/lib/libc/string/strsignal.3 deleted file mode 100644 index 3261f699d8..0000000000 --- a/src/lib/libc/string/strsignal.3 +++ /dev/null @@ -1,68 +0,0 @@ -.\" Copyright (c) 1980, 1991 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. 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. -.\" -.\" $OpenBSD: strsignal.3,v 1.8 2013/06/05 03:39:23 tedu Exp $ -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt STRSIGNAL 3 -.Os -.Sh NAME -.Nm strsignal -.Nd get signal description string -.Sh SYNOPSIS -.In string.h -.Ft char * -.Fn strsignal "int sig" -.Sh DESCRIPTION -The -.Fn strsignal -function returns a pointer to the language-dependent string describing -a signal. -.Pp -The array pointed to is not to be modified by the program, but may be -overwritten by subsequent calls to -.Fn strsignal . -.Sh SEE ALSO -.Xr intro 2 , -.Xr psignal 3 , -.Xr setlocale 3 -.Sh STANDARDS -The -.Fn strsignal -function conforms to -.St -p1003.1-2008 . -.Sh HISTORY -The -.Fn strsignal -function first appeared in -.At V.4 -and was reimplemented for -.Nx 1.0 . diff --git a/src/lib/libc/string/strsignal.c b/src/lib/libc/string/strsignal.c deleted file mode 100644 index aa541cefed..0000000000 --- a/src/lib/libc/string/strsignal.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 1988 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. 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 -#include - -extern char *__strsignal(int, char *); - -char * -strsignal(int sig) -{ - static char buf[NL_TEXTMAX]; - - return __strsignal(sig, buf); -} diff --git a/src/lib/libc/string/strspn.3 b/src/lib/libc/string/strspn.3 deleted file mode 100644 index e339d9b6af..0000000000 --- a/src/lib/libc/string/strspn.3 +++ /dev/null @@ -1,92 +0,0 @@ -.\" $OpenBSD: strspn.3,v 1.11 2013/06/05 03:39:23 tedu Exp $ -.\" -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt STRSPN 3 -.Os -.Sh NAME -.Nm strspn -.Nd span a string -.Sh SYNOPSIS -.In 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 NUL-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 EXAMPLES -The following call to -.Fn strspn -will return 3, since the first three characters of string -.Fa s -are part of string -.Fa charset : -.Bd -literal -offset indent -char *s = "foobar"; -char *charset = "of"; -size_t span; - -span = strspn(s, charset); -.Ed -.Sh SEE ALSO -.Xr memchr 3 , -.Xr strchr 3 , -.Xr strcspn 3 , -.Xr strpbrk 3 , -.Xr strrchr 3 , -.Xr strsep 3 , -.Xr strstr 3 , -.Xr strtok 3 , -.Xr wcsspn 3 -.Sh STANDARDS -The -.Fn strspn -function conforms to -.St -ansiC . -.Sh HISTORY -The -.Fn strspn -function first appeared in -.At III -and was reimplemented for -.Bx 4.3 Tahoe . diff --git a/src/lib/libc/string/strspn.c b/src/lib/libc/string/strspn.c deleted file mode 100644 index 385649c041..0000000000 --- a/src/lib/libc/string/strspn.c +++ /dev/null @@ -1,51 +0,0 @@ -/* $OpenBSD: strspn.c,v 1.5 2005/08/08 08:05:37 espie Exp $ */ -/* - * Copyright (c) 1989 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. 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 - -/* - * Span the string s2 (skip characters that are in s2). - */ -size_t -strspn(const char *s1, const char *s2) -{ - const char *p = s1, *spanp; - 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/src/lib/libc/string/strstr.3 b/src/lib/libc/string/strstr.3 deleted file mode 100644 index 1f79d45590..0000000000 --- a/src/lib/libc/string/strstr.3 +++ /dev/null @@ -1,100 +0,0 @@ -.\" $OpenBSD: strstr.3,v 1.12 2013/06/05 03:39:23 tedu Exp $ -.\" -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt STRSTR 3 -.Os -.Sh NAME -.Nm strstr , strcasestr -.Nd locate a substring in a string -.Sh SYNOPSIS -.In string.h -.Ft char * -.Fn strstr "const char *big" "const char *little" -.Ft char * -.Fn strcasestr "const char *big" "const char *little" -.Sh DESCRIPTION -The -.Fn strstr -function locates the first occurrence of the NUL-terminated string -.Fa little -in the NUL-terminated string -.Fa big . -.Pp -The -.Fn strcasestr -function is similar to -.Fn strstr -but ignores the case of both strings. -.Pp -If -.Fa little -is an empty string, -.Fa big -is returned; -if -.Fa little -occurs nowhere in -.Fa big , -.Dv NULL -is returned; -otherwise a pointer to the first character of the first occurrence of -.Fa little -is returned. -.Sh SEE ALSO -.Xr memchr 3 , -.Xr strchr 3 , -.Xr strcspn 3 , -.Xr strpbrk 3 , -.Xr strrchr 3 , -.Xr strsep 3 , -.Xr strspn 3 , -.Xr strtok 3 , -.Xr wcsstr 3 -.Sh STANDARDS -The -.Fn strstr -function conforms to -.St -ansiC . -.Sh HISTORY -The -.Fn strstr -function first appeared in -.Bx 4.3 Reno . -The -.Fn strcasestr -function appeared in glibc 2.1, -was reimplemented for -.Fx 4.5 -and ported to -.Ox 3.8 . diff --git a/src/lib/libc/string/strstr.c b/src/lib/libc/string/strstr.c deleted file mode 100644 index 95a865bf79..0000000000 --- a/src/lib/libc/string/strstr.c +++ /dev/null @@ -1,56 +0,0 @@ -/* $OpenBSD: strstr.c,v 1.5 2005/08/08 08:05:37 espie Exp $ */ -/*- - * Copyright (c) 1990 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. 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 - -/* - * Find the first occurrence of find in s. - */ -char * -strstr(const char *s, const char *find) -{ - char c, sc; - 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/src/lib/libc/string/strtok.3 b/src/lib/libc/string/strtok.3 deleted file mode 100644 index 046a43b6b1..0000000000 --- a/src/lib/libc/string/strtok.3 +++ /dev/null @@ -1,166 +0,0 @@ -.\" $OpenBSD: strtok.3,v 1.21 2013/06/05 03:39:23 tedu Exp $ -.\" -.\" Copyright (c) 1988, 1991 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. 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. -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt STRTOK 3 -.Os -.Sh NAME -.Nm strtok , -.Nm strtok_r -.Nd string token operations -.Sh SYNOPSIS -.In 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 -.Xr strsep 3 . -.Ef -.Pp -The -.Fn strtok -function is used to isolate sequential tokens in a NUL-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 version of -.Fn strtok -that takes an explicit context argument and is reentrant. -.Pp -Since -.Fn strtok -and -.Fn strtok_r -modify the string, -.Fa str -should not point to an area in the initialized data segment. -.Sh RETURN VALUES -The -.Fn strtok -and -.Fn strtok_r -functions return a pointer to the beginning of each subsequent token -in the string, after replacing the separator character itself with an -.Tn ASCII NUL -character. -When no more tokens remain, a null pointer is returned. -.Sh EXAMPLES -The following will construct an array of pointers to each individual word in -the string -.Va s : -.Bd -literal -offset indent -#define MAXTOKENS 128 - -char s[512], *p, *tokens[MAXTOKENS]; -char *last; -int i = 0; - -snprintf(s, sizeof(s), "cat dog horse cow"); - -for ((p = strtok_r(s, " ", &last)); p; - (p = strtok_r(NULL, " ", &last))) { - if (i < MAXTOKENS - 1) - tokens[i++] = p; -} -tokens[i] = NULL; -.Ed -.Pp -That is, -.Li tokens[0] -will point to -.Qq cat , -.Li tokens[1] -will point to -.Qq dog , -.Li tokens[2] -will point to -.Qq horse , -and -.Li tokens[3] -will point to -.Qq cow . -.Sh SEE ALSO -.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 wcstok 3 -.Sh STANDARDS -The -.Fn strtok -function conforms to -.St -ansiC . -.Sh HISTORY -The -.Fn strtok -function first appeared in -.At III -and was reimplemented for -.Bx 4.3 Tahoe . -The -.Fn strtok_r -function first appeared in -.Nx 1.3 -and was reimplemented for -.Ox 2.7 . -.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 non-null value. -Since this implementation always alters the next starting point, -such a sequence of calls would always return -.Dv NULL . diff --git a/src/lib/libc/string/strtok.c b/src/lib/libc/string/strtok.c deleted file mode 100644 index 4e963a019e..0000000000 --- a/src/lib/libc/string/strtok.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 1988 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. 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 - -char * -strtok(char *s, const char *delim) -{ - static char *last; - - return strtok_r(s, delim, &last); -} - -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 - s[-1] = 0; - *last = s; - return (tok); - } - } while (sc != 0); - } - /* NOTREACHED */ -} diff --git a/src/lib/libc/string/strxfrm.3 b/src/lib/libc/string/strxfrm.3 deleted file mode 100644 index 481f741cb7..0000000000 --- a/src/lib/libc/string/strxfrm.3 +++ /dev/null @@ -1,79 +0,0 @@ -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.\" $OpenBSD: strxfrm.3,v 1.10 2013/06/05 03:39:23 tedu Exp $ -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt STRXFRM 3 -.Os -.Sh NAME -.Nm strxfrm -.Nd transform a string under locale -.Sh SYNOPSIS -.In string.h -.Ft size_t -.Fn strxfrm "char *dst" "const char *src" "size_t n" -.Sh DESCRIPTION -The idea of -.Fn strxfrm -is to -.Dq un-localize -a string: the function transforms -.Ar src , -storing the result in -.Ar dst , -such that -.Xr strcmp 3 -on transformed strings returns what -.Xr strcoll 3 -on the original untransformed strings would return. -.Sh SEE ALSO -.Xr bcmp 3 , -.Xr memcmp 3 , -.Xr setlocale 3 , -.Xr strcasecmp 3 , -.Xr strcmp 3 , -.Xr strcoll 3 -.Sh STANDARDS -The -.Fn strxfrm -function conforms to -.St -ansiC . -.Sh HISTORY -The -.Fn strxfrm -function first appeared in -.Bx 4.3 Reno . -.Sh BUGS -Since locales are not fully implemented on -.Ox , -.Fn strxfrm -just returns a copy of the original string. diff --git a/src/lib/libc/string/strxfrm.c b/src/lib/libc/string/strxfrm.c deleted file mode 100644 index 6f289c901e..0000000000 --- a/src/lib/libc/string/strxfrm.c +++ /dev/null @@ -1,51 +0,0 @@ -/* $OpenBSD: strxfrm.c,v 1.6 2005/08/08 08:05:37 espie Exp $ */ -/*- - * Copyright (c) 1990 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. 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 - -/* - * Transform src, storing the result in dst, such that - * strcmp() on transformed strings returns what strcoll() - * on the original untransformed strings would return. - */ -size_t -strxfrm(char *dst, const char *src, size_t n) -{ - - /* - * Since locales are unimplemented, this is just a copy. - */ - if (n == 0) - return (strlen(src)); - return (strlcpy(dst, src, n)); -} diff --git a/src/lib/libc/string/swab.3 b/src/lib/libc/string/swab.3 deleted file mode 100644 index 77e5a9ccbc..0000000000 --- a/src/lib/libc/string/swab.3 +++ /dev/null @@ -1,61 +0,0 @@ -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.\" $OpenBSD: swab.3,v 1.8 2013/06/05 03:39:23 tedu Exp $ -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt SWAB 3 -.Os -.Sh NAME -.Nm swab -.Nd swap adjacent bytes -.Sh SYNOPSIS -.In unistd.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 -The -.Fn swab -function first appeared in -.At v7 . diff --git a/src/lib/libc/string/swab.c b/src/lib/libc/string/swab.c deleted file mode 100644 index b74db7e62a..0000000000 --- a/src/lib/libc/string/swab.c +++ /dev/null @@ -1,61 +0,0 @@ -/* $OpenBSD: swab.c,v 1.8 2008/03/15 21:54:09 ray Exp $ */ -/* - * Copyright (c) 1988 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. 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 - -void -swab(const void *from, void *to, size_t len) -{ - size_t n; - char *fp, *tp; - char temp; - - n = (len / 2) + 1; - fp = (char *)from; - tp = (char *)to; -#define STEP do { \ - temp = *fp++; \ - *tp++ = *fp++; \ - *tp++ = temp; \ -} while (0) - /* round to multiple of 8 */ - while ((--n) & 07) - STEP; - n >>= 3; - if (n == 0) - return; - while (n-- != 0) { - STEP; STEP; STEP; STEP; - STEP; STEP; STEP; STEP; - } -} diff --git a/src/lib/libc/string/timingsafe_bcmp.c b/src/lib/libc/string/timingsafe_bcmp.c deleted file mode 100644 index 9c4287cf63..0000000000 --- a/src/lib/libc/string/timingsafe_bcmp.c +++ /dev/null @@ -1,33 +0,0 @@ -/* $OpenBSD: timingsafe_bcmp.c,v 1.1 2010/09/24 13:33:00 matthew Exp $ */ -/* - * Copyright (c) 2010 Damien Miller. All rights reserved. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#else -#include -#endif - -int -timingsafe_bcmp(const void *b1, const void *b2, size_t n) -{ - const unsigned char *p1 = b1, *p2 = b2; - int ret = 0; - - for (; n > 0; n--) - ret |= *p1++ ^ *p2++; - return (ret != 0); -} diff --git a/src/lib/libc/string/wcscasecmp.3 b/src/lib/libc/string/wcscasecmp.3 deleted file mode 100644 index daf397aece..0000000000 --- a/src/lib/libc/string/wcscasecmp.3 +++ /dev/null @@ -1,94 +0,0 @@ -.\" $OpenBSD: wcscasecmp.3,v 1.4 2013/07/16 15:21:11 schwarze Exp $ -.\" -.\" 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. 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 -.\" -.Dd $Mdocdate: July 16 2013 $ -.Dt WCSCASECMP 3 -.Os -.Sh NAME -.Nm wcscasecmp , -.Nm wcsncasecmp -.Nd compare wide strings, ignoring case -.Sh SYNOPSIS -.In wchar.h -.Ft int -.Fn wcscasecmp "const wchar_t *s1" "const wchar_t *s2" -.Ft int -.Fn wcsncasecmp "const wchar_t *s1" "const wchar_t *s2" "size_t len" -.Sh DESCRIPTION -The -.Fn wcscasecmp -and -.Fn wcsncasecmp -functions compare the wide strings -.Fa s1 -and -.Fa s2 -and return an integer greater than, equal to, or less than 0, -according to whether -.Fa s1 -is lexicographically greater than, equal to, or less than -.Fa s2 -after translation of each corresponding wide character to lower case. -The wide strings themselves are not modified. -.Pp -.Fn wcsncasecmp -compares at most -.Fa len -wide characters. -.Sh SEE ALSO -.Xr strcasecmp 3 , -.Xr wcscmp 3 , -.Xr wmemcmp 3 -.Sh STANDARDS -The -.Fn wcscasecmp -and -.Fn wcsncasecmp -functions conform to -.St -p1003.1-2008 . -.Sh HISTORY -The -.Fn wcscasecmp -and -.Fn wcsncasecmp -functions first appeared in -.Ox 5.0 . -.Sh AUTHORS -The -.Ox -versions of -.Fn wcscasecmp -and -.Fn wcsncasecmp -were implemented by -.An Marc Espie Aq Mt espie@openbsd.org . diff --git a/src/lib/libc/string/wcscasecmp.c b/src/lib/libc/string/wcscasecmp.c deleted file mode 100644 index b14997ee75..0000000000 --- a/src/lib/libc/string/wcscasecmp.c +++ /dev/null @@ -1,61 +0,0 @@ -/* $OpenBSD: wcscasecmp.c,v 1.2 2011/06/01 19:29:48 naddy Exp $ */ - -/* - * Copyright (c) 2011 Marc Espie - * - * 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 OPENBSD PROJECT 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 OPENBSD - * PROJECT 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 -#include -#include "locale/runetype.h" - -int -wcscasecmp(const wchar_t *s1, const wchar_t *s2) -{ - wchar_t l1, l2; - - while ((l1 = towlower(*s1++)) == (l2 = towlower(*s2++))) { - if (l1 == 0) - return (0); - } - /* XXX assumes wchar_t = int */ - return ((rune_t)l1 - (rune_t)l2); -} - -int -wcsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n) -{ - wchar_t l1, l2; - - if (n == 0) - return (0); - do { - if (((l1 = towlower(*s1++))) != (l2 = towlower(*s2++))) { - /* XXX assumes wchar_t = int */ - return ((rune_t)l1 - (rune_t)l2); - } - if (l1 == 0) - break; - } while (--n != 0); - return (0); -} diff --git a/src/lib/libc/string/wcscat.3 b/src/lib/libc/string/wcscat.3 deleted file mode 100644 index 9b7588cf9e..0000000000 --- a/src/lib/libc/string/wcscat.3 +++ /dev/null @@ -1,115 +0,0 @@ -.\" $OpenBSD: wcscat.3,v 1.3 2013/06/05 03:39:23 tedu Exp $ -.\" -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt WCSCAT 3 -.Os -.Sh NAME -.Nm wcscat , -.Nm wcsncat -.Nd concatenate wide strings -.Sh SYNOPSIS -.In wchar.h -.Ft wchar_t * -.Fn wcscat "wchar_t * restrict s" "const wchar_t * restrict append" -.Ft wchar_t * -.Fo wcsncat -.Fa "wchar_t * restrict s" -.Fa "const wchar_t * restrict append" -.Fa "size_t count" -.Fc -.Sh DESCRIPTION -The -.Fn wcscat -and -.Fn wcsncat -functions append a copy of the wide string -.Fa append -to the end of the wide string -.Fa s , -then add a terminating null wide character (L'\e0'). -The wide string -.Fa s -must have sufficient space to hold the result. -.Pp -The -.Fn wcsncat -function appends not more than -.Fa count -wide characters where space for the terminating null wide character -should not be included in -.Fa count . -.Sh RETURN VALUES -The -.Fn wcscat -and -.Fn wcsncat -functions return the pointer -.Fa s . -.Sh SEE ALSO -.Xr strcat 3 , -.Xr strlcpy 3 , -.Xr wcscpy 3 , -.Xr wcslcpy 3 , -.Xr wmemcpy 3 , -.Xr wmemmove 3 -.Sh STANDARDS -The -.Fn wcscat -and -.Fn wcsncat -functions conform to -.St -isoC-99 -and were first introduced in -.St -isoC-amd1 . -.Sh HISTORY -The -.Fn wcscat -and -.Fn wcsncat -functions were ported from -.Nx -and first appeared in -.Ox 3.8 . -.Sh CAVEATS -Using the functions -.Fn wcscat -and -.Fn wcsncat -is very error-prone with respect to buffer overflows; -see the EXAMPLES section in -.Xr strcat 3 -for correct usage. -Using -.Xr wcslcat 3 -is a better choice in most cases. diff --git a/src/lib/libc/string/wcscat.c b/src/lib/libc/string/wcscat.c deleted file mode 100644 index a4841a975a..0000000000 --- a/src/lib/libc/string/wcscat.c +++ /dev/null @@ -1,55 +0,0 @@ -/* $OpenBSD: wcscat.c,v 1.3 2005/08/08 08:05:37 espie Exp $ */ -/* $NetBSD: wcscat.c,v 1.2 2001/01/03 14:29:36 lukem Exp $ */ - -/*- - * Copyright (c)1999 Citrus Project, - * 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 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 AUTHOR 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. - * - * citrus Id: wcscat.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp - */ - -#include - -#if defined(APIWARN) -__warn_references(wcscat, - "warning: wcscat() is almost always misused, please use wcslcat()"); -#endif - -wchar_t * -wcscat(wchar_t *s1, const wchar_t *s2) -{ - wchar_t *p; - wchar_t *q; - const wchar_t *r; - - p = s1; - while (*p) - p++; - q = p; - r = s2; - while (*r) - *q++ = *r++; - *q = '\0'; - return s1; -} diff --git a/src/lib/libc/string/wcschr.3 b/src/lib/libc/string/wcschr.3 deleted file mode 100644 index bb714b2099..0000000000 --- a/src/lib/libc/string/wcschr.3 +++ /dev/null @@ -1,85 +0,0 @@ -.\" $OpenBSD: wcschr.3,v 1.4 2013/06/05 03:39:23 tedu Exp $ -.\" -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt WCSCHR 3 -.Os -.Sh NAME -.Nm wcschr -.Nd locate first occurrence of a wide character in a wide string -.Sh SYNOPSIS -.In wchar.h -.Ft wchar_t * -.Fn wcschr "const wchar_t *s" "wchar_t c" -.Sh DESCRIPTION -The -.Fn wcschr -function locates the first occurrence of the wide character -.Fa c -in the wide string -.Fa s . -The terminating null wide character is considered part of the wide string. -If -.Fa c -is the null wide character (L'\e0'), -.Fn wcschr -locates the terminating null wide character. -.Sh RETURN VALUES -The -.Fn wcschr -function returns a pointer to the located wide character or -.Dv NULL -if the wide character does not appear in the wide string. -.Sh SEE ALSO -.Xr strchr 3 , -.Xr wcscspn 3 , -.Xr wcspbrk 3 , -.Xr wcsrchr 3 , -.Xr wcsspn 3 , -.Xr wcsstr 3 , -.Xr wcstok 3 , -.Xr wmemchr 3 -.Sh STANDARDS -The -.Fn wcschr -function conforms to -.St -isoC-99 -and was first introduced in -.St -isoC-amd1 . -.Sh HISTORY -The -.Fn wcschr -function was ported from -.Nx -and first appeared in -.Ox 3.8 . diff --git a/src/lib/libc/string/wcschr.c b/src/lib/libc/string/wcschr.c deleted file mode 100644 index b84a2d32e3..0000000000 --- a/src/lib/libc/string/wcschr.c +++ /dev/null @@ -1,50 +0,0 @@ -/* $OpenBSD: wcschr.c,v 1.4 2008/08/23 05:34:36 djm Exp $ */ -/* $NetBSD: wcschr.c,v 1.2 2001/01/03 14:29:36 lukem Exp $ */ - -/*- - * Copyright (c)1999 Citrus Project, - * 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 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 AUTHOR 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. - * - * citrus Id: wcschr.c,v 1.2 2000/12/21 05:07:25 itojun Exp - */ - -#include - -wchar_t * -wcschr(const wchar_t *s, wchar_t c) -{ - const wchar_t *p; - - p = s; - for (;;) { - if (*p == c) { - /* LINTED interface specification */ - return (wchar_t *)p; - } - if (!*p) - return NULL; - p++; - } - /* NOTREACHED */ -} diff --git a/src/lib/libc/string/wcscmp.3 b/src/lib/libc/string/wcscmp.3 deleted file mode 100644 index 53cd15a1f0..0000000000 --- a/src/lib/libc/string/wcscmp.3 +++ /dev/null @@ -1,92 +0,0 @@ -.\" $OpenBSD: wcscmp.3,v 1.3 2013/06/05 03:39:23 tedu Exp $ -.\" -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt WCSCMP 3 -.Os -.Sh NAME -.Nm wcscmp , -.Nm wcsncmp -.Nd compare wide strings -.Sh SYNOPSIS -.In wchar.h -.Ft int -.Fn wcscmp "const wchar_t *s1" "const wchar_t *s2" -.Ft int -.Fn wcsncmp "const wchar_t *s1" "const wchar_t *s2" "size_t len" -.Sh DESCRIPTION -The -.Fn wcscmp -and -.Fn wcsncmp -functions lexicographically compare the wide strings -.Fa s1 -and -.Fa s2 . -The -.Fn wcsncmp -function compares at most -.Fa len -wide characters. -.Sh RETURN VALUES -The -.Fn wcscmp -and -.Fn wcsncmp -functions return an integer greater than, equal to, or less than 0, according -to whether the wide string -.Fa s1 -is greater than, equal to, or less than the wide string -.Fa s2 . -.Sh SEE ALSO -.Xr strcmp 3 , -.Xr wcscasecmp 3 , -.Xr wmemcmp 3 -.Sh STANDARDS -The -.Fn wcscmp -and -.Fn wcsncmp -functions conform to -.St -isoC-99 -and were first introduced in -.St -isoC-amd1 . -.Sh HISTORY -The -.Fn wcscmp -and -.Fn wcsncmp -functions were ported from -.Nx -and first appeared in -.Ox 3.8 . diff --git a/src/lib/libc/string/wcscmp.c b/src/lib/libc/string/wcscmp.c deleted file mode 100644 index 4a8f6ba3fb..0000000000 --- a/src/lib/libc/string/wcscmp.c +++ /dev/null @@ -1,51 +0,0 @@ -/* $OpenBSD: wcscmp.c,v 1.4 2005/08/08 08:05:37 espie Exp $ */ -/* $NetBSD: wcscmp.c,v 1.5 2003/08/07 16:43:54 agc Exp $ */ - -/*- - * 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. 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 -#include "locale/runetype.h" - -/* - * Compare strings. - */ -int -wcscmp(const wchar_t *s1, const wchar_t *s2) -{ - - while (*s1 == *s2++) - if (*s1++ == 0) - return (0); - /* XXX assumes wchar_t = int */ - return (*(const rune_t *)s1 - *(const rune_t *)--s2); -} diff --git a/src/lib/libc/string/wcscpy.3 b/src/lib/libc/string/wcscpy.3 deleted file mode 100644 index 2277eb419a..0000000000 --- a/src/lib/libc/string/wcscpy.3 +++ /dev/null @@ -1,129 +0,0 @@ -.\" $OpenBSD: wcscpy.3,v 1.4 2013/09/25 21:49:31 millert Exp $ -.\" -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.Dd $Mdocdate: September 25 2013 $ -.Dt WCSCPY 3 -.Os -.Sh NAME -.Nm wcscpy , -.Nm wcsncpy -.Nd copy wide strings -.Sh SYNOPSIS -.In wchar.h -.Ft wchar_t * -.Fn wcscpy "wchar_t * restrict dst" "const wchar_t * restrict src" -.Ft wchar_t * -.Fo wcsncpy -.Fa "wchar_t * restrict dst" -.Fa "const wchar_t * restrict src" -.Fa "size_t len" -.Fc -.Sh DESCRIPTION -The -.Fn wcscpy -and -.Fn wcsncpy -functions copy the wide string -.Fa src -to -.Fa dst -(including the terminating null wide character). -.Pp -The -.Fn wcsncpy -function copies not more than -.Fa len -wide characters to -.Fa dst , -appending null wide characters if the length of -.Fa src -is less than -.Fa len , -and -.Em not -terminating -.Fa dst -if the length of -.Fa src -is greater than or equal to -.Fa len . -.Pp -If the -.Fa src -and -.Fa dst -strings overlap, the behavior is undefined. -.Sh RETURN VALUES -The -.Fn wcscpy -and -.Fn wcsncpy -functions return -.Fa dst . -.Sh SEE ALSO -.Xr strcpy 3 , -.Xr strlcpy 3 , -.Xr wcscat 3 , -.Xr wcslcpy 3 , -.Xr wmemcpy 3 , -.Xr wmemmove 3 -.Sh STANDARDS -The -.Fn wcscpy -and -.Fn wcsncpy -functions conform to -.St -isoC-99 -and were first introduced in -.St -isoC-amd1 . -.Sh HISTORY -The -.Fn wcscpy -and -.Fn wcsncpy -functions were ported from -.Nx -and first appeared in -.Ox 3.8 . -.Sh CAVEATS -Using the functions -.Fn wcscpy -and -.Fn wcsncpy -is very error-prone with respect to buffer overflows; -see the EXAMPLES section in -.Xr strcpy 3 -for correct usage. -Using -.Xr wcslcpy 3 -is a better choice in most cases. diff --git a/src/lib/libc/string/wcscpy.c b/src/lib/libc/string/wcscpy.c deleted file mode 100644 index 75fdb75fe4..0000000000 --- a/src/lib/libc/string/wcscpy.c +++ /dev/null @@ -1,52 +0,0 @@ -/* $OpenBSD: wcscpy.c,v 1.4 2005/08/08 08:05:37 espie Exp $ */ -/* $NetBSD: wcscpy.c,v 1.2 2001/01/03 14:29:36 lukem Exp $ */ - -/*- - * Copyright (c)1999 Citrus Project, - * 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 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 AUTHOR 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. - * - * citrus Id: wcscpy.c,v 1.2 2000/12/21 04:51:09 itojun Exp - */ - -#include - -#if defined(APIWARN) -__warn_references(wcscpy, - "warning: wcscpy() is almost always misused, please use wcslcpy()"); -#endif - -wchar_t * -wcscpy(wchar_t *s1, const wchar_t *s2) -{ - wchar_t *p; - const wchar_t *q; - - p = s1; - q = s2; - while (*q) - *p++ = *q++; - *p = '\0'; - - return s1; -} diff --git a/src/lib/libc/string/wcscspn.3 b/src/lib/libc/string/wcscspn.3 deleted file mode 100644 index 520a739202..0000000000 --- a/src/lib/libc/string/wcscspn.3 +++ /dev/null @@ -1,83 +0,0 @@ -.\" $OpenBSD: wcscspn.3,v 1.3 2013/06/05 03:39:23 tedu Exp $ -.\" -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt WCSCSPN 3 -.Os -.Sh NAME -.Nm wcscspn -.Nd span the complement of a wide string -.Sh SYNOPSIS -.In wchar.h -.Ft size_t -.Fn wcscspn "const wchar_t *s" "const wchar_t *charset" -.Sh DESCRIPTION -The -.Fn wcscspn -function spans the initial part of the wide string -.Fa s -as long as the wide characters from -.Fa s -do not occur in string -.Fa charset -(it spans the -.Em complement -of -.Fa charset ) . -.Sh RETURN VALUES -The -.Fn wcscspn -function returns the number of wide characters spanned. -.Sh SEE ALSO -.Xr strcspn 3 , -.Xr wcschr 3 , -.Xr wcspbrk 3 , -.Xr wcsrchr 3 , -.Xr wcsspn 3 , -.Xr wcsstr 3 , -.Xr wcstok 3 , -.Xr wmemchr 3 -.Sh STANDARDS -The -.Fn wcscspn -function conforms to -.St -isoC-99 -and was first introduced in -.St -isoC-amd1 . -.Sh HISTORY -The -.Fn wcscspn -function was ported from -.Nx -and first appeared in -.Ox 3.8 . diff --git a/src/lib/libc/string/wcscspn.c b/src/lib/libc/string/wcscspn.c deleted file mode 100644 index cf40092465..0000000000 --- a/src/lib/libc/string/wcscspn.c +++ /dev/null @@ -1,53 +0,0 @@ -/* $OpenBSD: wcscspn.c,v 1.3 2005/08/08 08:05:37 espie Exp $ */ -/* $NetBSD: wcscspn.c,v 1.2 2001/01/03 14:29:36 lukem Exp $ */ - -/*- - * Copyright (c)1999 Citrus Project, - * 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 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 AUTHOR 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. - * - * citrus Id: wcscspn.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp - */ - -#include - -size_t -wcscspn(const wchar_t *s, const wchar_t *set) -{ - const wchar_t *p; - const wchar_t *q; - - p = s; - while (*p) { - q = set; - while (*q) { - if (*p == *q) - goto done; - q++; - } - p++; - } - -done: - return (p - s); -} diff --git a/src/lib/libc/string/wcsdup.3 b/src/lib/libc/string/wcsdup.3 deleted file mode 100644 index 588a2571db..0000000000 --- a/src/lib/libc/string/wcsdup.3 +++ /dev/null @@ -1,97 +0,0 @@ -.\" $OpenBSD: wcsdup.3,v 1.4 2011/07/25 00:38:53 schwarze Exp $ -.\" $NetBSD: wcsdup.3,v 1.3 2010/12/16 17:42:28 wiz Exp $ -.\" -.\" 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. 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 -.\" -.Dd $Mdocdate: July 25 2011 $ -.Dt WCSDUP 3 -.Os -.Sh NAME -.Nm wcsdup -.Nd save a copy of a wide string -.Sh SYNOPSIS -.In wchar.h -.Ft wchar_t * -.Fn wcsdup "const wchar_t *str" -.Sh DESCRIPTION -The -.Fn wcsdup -function -allocates sufficient memory for a copy -of the wide-character 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, -.Dv NULL -is returned. -.Sh EXAMPLES -The following will point -.Va p -to an allocated area of memory containing the nul-terminated string -.Qq foobar : -.Bd -literal -offset indent -const char *o = "foobar"; -wchar_t *p, b[32]; -size_t blen; - -blen = sizeof(b) / sizeof(b[0]); -if (mbstowcs(b, o, blen) == (size_t)-1) - err(1, NULL); -b[blen - 1] = 0; -if ((p = wcsdup(b)) == NULL) - err(1, NULL); -.Ed -.Sh ERRORS -The -.Fn wcsdup -function may fail and set the external variable -.Va errno -for any of the errors specified for the library function -.Xr malloc 3 . -.Sh SEE ALSO -.Xr free 3 , -.Xr malloc 3 , -.Xr strdup 3 -.Sh STANDARDS -The -.Fn wcsdup -function conforms to -.St -p1003.1-2008 . -.Sh HISTORY -The -.Fn wcsdup -function was ported from -.Nx -and first appeared in -.Ox 5.0 . diff --git a/src/lib/libc/string/wcsdup.c b/src/lib/libc/string/wcsdup.c deleted file mode 100644 index 57a328a8c2..0000000000 --- a/src/lib/libc/string/wcsdup.c +++ /dev/null @@ -1,31 +0,0 @@ -/* $OpenBSD: wcsdup.c,v 1.1 2011/07/04 04:37:34 nicm Exp $ */ -/* $NetBSD: wcsdup.c,v 1.3 2008/05/26 13:17:48 haad Exp $ */ - -/* - * Copyright (C) 2006 Aleksey Cheusov - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee. Permission to modify the code and to distribute modified - * code is also granted without any restrictions. - */ - -#include -#include - -wchar_t * -wcsdup(const wchar_t *str) -{ - wchar_t *copy; - size_t len; - - len = wcslen(str) + 1; - copy = malloc(len * sizeof (wchar_t)); - - if (!copy) - return (NULL); - - return (wmemcpy(copy, str, len)); -} diff --git a/src/lib/libc/string/wcslcat.c b/src/lib/libc/string/wcslcat.c deleted file mode 100644 index ee8ff3c343..0000000000 --- a/src/lib/libc/string/wcslcat.c +++ /dev/null @@ -1,56 +0,0 @@ -/* $OpenBSD: wcslcat.c,v 1.4 2011/07/24 15:21:28 millert Exp $ */ -/* $NetBSD: wcslcat.c,v 1.2 2001/01/03 14:33:02 lukem Exp $ */ - -/* - * Copyright (c) 1998 Todd C. Miller - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include - -/* - * Appends src to string dst of size siz (unlike wcsncat, siz is the - * full size of dst, not space left). At most siz-1 characters - * will be copied. Always NUL terminates (unless siz <= wcslen(dst)). - * Returns wcslen(src) + MIN(siz, wcslen(initial dst)). - * If retval >= siz, truncation occurred. - */ -size_t -wcslcat(wchar_t *dst, const wchar_t *src, size_t siz) -{ - wchar_t *d = dst; - const wchar_t *s = src; - size_t n = siz; - size_t dlen; - - /* Find the end of dst and adjust bytes left but don't go past end */ - while (n-- != 0 && *d != '\0') - d++; - dlen = d - dst; - n = siz - dlen; - - if (n == 0) - return(dlen + wcslen(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/src/lib/libc/string/wcslcpy.3 b/src/lib/libc/string/wcslcpy.3 deleted file mode 100644 index 7af6c74614..0000000000 --- a/src/lib/libc/string/wcslcpy.3 +++ /dev/null @@ -1,153 +0,0 @@ -.\" $OpenBSD: wcslcpy.3,v 1.6 2013/09/25 21:49:31 millert Exp $ -.\" -.\" Copyright (c) 1998, 2000 Todd C. Miller -.\" -.\" Permission to use, copy, modify, and distribute this software for any -.\" purpose with or without fee is hereby granted, provided that the above -.\" copyright notice and this permission notice appear in all copies. -.\" -.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -.\" -.Dd $Mdocdate: September 25 2013 $ -.Dt WCSLCPY 3 -.Os -.Sh NAME -.Nm wcslcpy , -.Nm wcslcat -.Nd size-bounded wide string copying and concatenation -.Sh SYNOPSIS -.In wchar.h -.Ft size_t -.Fn wcslcpy "wchar_t *dst" "const wchar_t *src" "size_t size" -.Ft size_t -.Fn wcslcat "wchar_t *dst" "const wchar_t *src" "size_t size" -.Sh DESCRIPTION -The -.Fn wcslcpy -and -.Fn wcslcat -functions copy and concatenate wide strings respectively. -They are designed to be safer, more consistent, and less error prone -replacements for -.Xr wcsncpy 3 -and -.Xr wcsncat 3 . -Unlike those functions, -.Fn wcslcpy -and -.Fn wcslcat -take the full size of the buffer (not just the length) and guarantee to -terminate the result with a null wide character (as long as -.Fa size -is larger than 0 or, in the case of -.Fn wcslcat , -as long as there is at least one wide character free in -.Fa dst ) . -Note that a wide character for the null wide character should be included in -.Fa size . -Also note that -.Fn wcslcpy -and -.Fn wcslcat -only operate on wide strings that are terminated with a null wide character -(L'\e0'). -This means that for -.Fn wcslcpy -.Fa src -must be terminated with a null wide character and for -.Fn wcslcat -both -.Fa src -and -.Fa dst -must be terminated with a null wide character. -.Pp -The -.Fn wcslcpy -function copies up to -.Fa size -\(mi 1 wide characters from the wide string -.Fa src -to -.Fa dst , -terminating the result with a null wide character. -.Pp -The -.Fn wcslcat -function appends the wide string -.Fa src -to the end of -.Fa dst . -It will append at most -.Fa size -\(mi wcslen(dst) \(mi 1 wide characters, terminating the result with a null -wide character. -.Pp -If the -.Fa src -and -.Fa dst -strings overlap, the behavior is undefined. -.Sh RETURN VALUES -The -.Fn wcslcpy -and -.Fn wcslcat -functions return the total length of the wide string they tried to create. -For -.Fn wcslcpy -that means the length of -.Fa src . -For -.Fn wcslcat -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. -.Pp -Note, however, that if -.Fn wcslcat -traverses -.Fa size -wide characters without finding a null wide character, the length of the -string is considered to be -.Fa size -and the destination wide string will not be terminated with a null wide -character (since there was no space for it). -This keeps -.Fn wcslcat -from running off the end of a wide string. -In practice this should not happen (as it means that either -.Fa size -is incorrect or that -.Fa dst -is not terminated with a null wide character). -The check exists to prevent potential security problems in incorrect code. -.Sh SEE ALSO -.Xr strlcpy 3 , -.Xr swprintf 3 , -.Xr wcsncat 3 , -.Xr wcsncpy 3 -.Sh HISTORY -The -.Fn wcslcpy -and -.Fn wcslcat -functions first appeared in -.Ox 3.8 . -.Sh AUTHORS -The -.Fn wcslcpy -and -.Fn wcslcat -functions are based on code by -.An Todd C. Miller Aq Mt Todd.Miller@courtesan.com . diff --git a/src/lib/libc/string/wcslcpy.c b/src/lib/libc/string/wcslcpy.c deleted file mode 100644 index f49936a885..0000000000 --- a/src/lib/libc/string/wcslcpy.c +++ /dev/null @@ -1,52 +0,0 @@ -/* $OpenBSD: wcslcpy.c,v 1.5 2011/07/24 15:21:28 millert Exp $ */ -/* $NetBSD: wcslcpy.c,v 1.2 2001/01/03 14:33:02 lukem Exp $ */ - -/* - * Copyright (c) 1998 Todd C. Miller - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include - -/* - * Copy src to string dst of size siz. At most siz-1 characters - * will be copied. Always NUL terminates (unless siz == 0). - * Returns wcslen(src); if retval >= siz, truncation occurred. - */ -size_t -wcslcpy(wchar_t *dst, const wchar_t *src, size_t siz) -{ - wchar_t *d = dst; - const wchar_t *s = src; - size_t n = siz; - - /* Copy as many bytes as will fit */ - if (n != 0) { - while (--n != 0) { - if ((*d++ = *s++) == '\0') - break; - } - } - - /* 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/src/lib/libc/string/wcslen.3 b/src/lib/libc/string/wcslen.3 deleted file mode 100644 index 12f81763ba..0000000000 --- a/src/lib/libc/string/wcslen.3 +++ /dev/null @@ -1,70 +0,0 @@ -.\" $OpenBSD: wcslen.3,v 1.3 2013/06/05 03:39:23 tedu Exp $ -.\" -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt WCSLEN 3 -.Os -.Sh NAME -.Nm wcslen -.Nd find length of a wide string -.Sh SYNOPSIS -.In wchar.h -.Ft size_t -.Fn wcslen "const wchar_t *s" -.Sh DESCRIPTION -The -.Fn wcslen -function computes the length of the wide string -.Fa s . -.Sh RETURN VALUES -The -.Fn wcslen -function returns the number of wide characters that precede the terminating -null wide character. -.Sh SEE ALSO -.Xr strlen 3 , -.Xr wcswidth 3 -.Sh STANDARDS -The -.Fn wcslen -function conforms to -.St -isoC-99 -and was first introduced in -.St -isoC-amd1 . -.Sh HISTORY -The -.Fn wcslen -function was ported from -.Nx -and first appeared in -.Ox 3.8 . diff --git a/src/lib/libc/string/wcslen.c b/src/lib/libc/string/wcslen.c deleted file mode 100644 index c1de4a271e..0000000000 --- a/src/lib/libc/string/wcslen.c +++ /dev/null @@ -1,44 +0,0 @@ -/* $OpenBSD: wcslen.c,v 1.3 2005/08/08 08:05:37 espie Exp $ */ -/* $NetBSD: wcslen.c,v 1.2 2001/01/03 14:29:36 lukem Exp $ */ - -/*- - * Copyright (c)1999 Citrus Project, - * 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 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 AUTHOR 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. - * - * citrus Id: wcslen.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp - */ - -#include - -size_t -wcslen(const wchar_t *s) -{ - const wchar_t *p; - - p = s; - while (*p) - p++; - - return p - s; -} diff --git a/src/lib/libc/string/wcsncat.c b/src/lib/libc/string/wcsncat.c deleted file mode 100644 index eb9a701514..0000000000 --- a/src/lib/libc/string/wcsncat.c +++ /dev/null @@ -1,52 +0,0 @@ -/* $OpenBSD: wcsncat.c,v 1.3 2005/08/08 08:05:37 espie Exp $ */ -/* $NetBSD: wcsncat.c,v 1.2 2001/01/03 14:29:36 lukem Exp $ */ - -/*- - * Copyright (c)1999 Citrus Project, - * 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 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 AUTHOR 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. - * - * citrus Id: wcsncat.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp - */ - -#include - -wchar_t * -wcsncat(wchar_t *s1, const wchar_t *s2, size_t n) -{ - wchar_t *p; - wchar_t *q; - const wchar_t *r; - - p = s1; - while (*p) - p++; - q = p; - r = s2; - while (*r && n) { - *q++ = *r++; - n--; - } - *q = '\0'; - return s1; -} diff --git a/src/lib/libc/string/wcsncmp.c b/src/lib/libc/string/wcsncmp.c deleted file mode 100644 index fb3c7057cf..0000000000 --- a/src/lib/libc/string/wcsncmp.c +++ /dev/null @@ -1,52 +0,0 @@ -/* $OpenBSD: wcsncmp.c,v 1.4 2005/08/08 08:05:37 espie Exp $ */ -/* $NetBSD: wcsncmp.c,v 1.5 2003/08/07 16:43:54 agc Exp $ */ - -/* - * 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. 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 -#include "locale/runetype.h" - -int -wcsncmp(const wchar_t *s1, const wchar_t *s2, size_t n) -{ - - if (n == 0) - return (0); - do { - if (*s1 != *s2++) { - /* XXX assumes wchar_t = int */ - return (*(const rune_t *)s1 - - *(const rune_t *)--s2); - } - if (*s1++ == 0) - break; - } while (--n != 0); - return (0); -} diff --git a/src/lib/libc/string/wcsncpy.c b/src/lib/libc/string/wcsncpy.c deleted file mode 100644 index 107696f1de..0000000000 --- a/src/lib/libc/string/wcsncpy.c +++ /dev/null @@ -1,50 +0,0 @@ -/* $OpenBSD: wcsncpy.c,v 1.4 2006/04/17 18:05:35 espie Exp $ */ -/* $NetBSD: wcsncpy.c,v 1.2 2001/01/03 14:29:37 lukem Exp $ */ - -/*- - * Copyright (c)1999 Citrus Project, - * 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 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 AUTHOR 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. - * - * citrus Id: wcsncpy.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp - */ - -#include - -wchar_t * -wcsncpy(wchar_t *s1, const wchar_t *s2, size_t n) -{ - wchar_t *p; - - p = s1; - while (n && *s2) { - *p++ = *s2++; - n--; - } - while (n) { - *p++ = L'\0'; - n--; - } - - return s1; -} diff --git a/src/lib/libc/string/wcspbrk.3 b/src/lib/libc/string/wcspbrk.3 deleted file mode 100644 index 602bfdc3d6..0000000000 --- a/src/lib/libc/string/wcspbrk.3 +++ /dev/null @@ -1,81 +0,0 @@ -.\" $OpenBSD: wcspbrk.3,v 1.3 2013/06/05 03:39:23 tedu Exp $ -.\" -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt WCSPBRK 3 -.Os -.Sh NAME -.Nm wcspbrk -.Nd locate multiple wide characters in a wide string -.Sh SYNOPSIS -.In wchar.h -.Ft wchar_t * -.Fn wcspbrk "const wchar_t *s" "const wchar_t *charset" -.Sh DESCRIPTION -The -.Fn wcspbrk -function locates in the wide string -.Fa s -the first occurrence of any wide character in the wide string -.Fa charset -and returns a pointer to this wide character. -If no wide characters from -.Fa charset -occur anywhere in -.Fa s , -.Fn wcspbrk -returns -.Dv NULL . -.Sh SEE ALSO -.Xr strpbrk 3 , -.Xr wcschr 3 , -.Xr wcscspn 3 , -.Xr wcsrchr 3 , -.Xr wcsspn 3 , -.Xr wcsstr 3 , -.Xr wcstok 3 , -.Xr wmemchr 3 -.Sh STANDARDS -The -.Fn wcspbrk -function conforms to -.St -isoC-99 -and was first introduced in -.St -isoC-amd1 . -.Sh HISTORY -The -.Fn wcspbrk -function was ported from -.Nx -and first appeared in -.Ox 3.8 . diff --git a/src/lib/libc/string/wcspbrk.c b/src/lib/libc/string/wcspbrk.c deleted file mode 100644 index 1923abfc89..0000000000 --- a/src/lib/libc/string/wcspbrk.c +++ /dev/null @@ -1,53 +0,0 @@ -/* $OpenBSD: wcspbrk.c,v 1.3 2005/08/08 08:05:37 espie Exp $ */ -/* $NetBSD: wcspbrk.c,v 1.2 2001/01/03 14:29:37 lukem Exp $ */ - -/*- - * Copyright (c)1999 Citrus Project, - * 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 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 AUTHOR 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. - * - * citrus Id: wcspbrk.c,v 1.2 2000/12/21 05:07:25 itojun Exp - */ - -#include - -wchar_t * -wcspbrk(const wchar_t *s, const wchar_t *set) -{ - const wchar_t *p; - const wchar_t *q; - - p = s; - while (*p) { - q = set; - while (*q) { - if (*p == *q) { - /* LINTED interface specification */ - return (wchar_t *)p; - } - q++; - } - p++; - } - return NULL; -} diff --git a/src/lib/libc/string/wcsrchr.3 b/src/lib/libc/string/wcsrchr.3 deleted file mode 100644 index d4a2e7cf78..0000000000 --- a/src/lib/libc/string/wcsrchr.3 +++ /dev/null @@ -1,85 +0,0 @@ -.\" $OpenBSD: wcsrchr.3,v 1.3 2013/06/05 03:39:23 tedu Exp $ -.\" -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt WCSRCHR 3 -.Os -.Sh NAME -.Nm wcsrchr -.Nd locate last occurrence of a wide character in a wide string -.Sh SYNOPSIS -.In wchar.h -.Ft wchar_t * -.Fn wcsrchr "const wchar_t *s" "wchar_t c" -.Sh DESCRIPTION -The -.Fn wcsrchr -function locates the last occurrence of the wide character -.Fa c -in the wide string -.Fa s . -The terminating null wide character is considered part of the wide string. -If -.Fa c -is the null wide character (L'\e0'), -.Fn wcsrchr -locates the terminating null wide character. -.Sh RETURN VALUES -The -.Fn wcsrchr -function returns a pointer to the located wide character or -.Dv NULL -if the wide character does not appear in the wide string. -.Sh SEE ALSO -.Xr strrchr 3 , -.Xr wcschr 3 , -.Xr wcscspn 3 , -.Xr wcspbrk 3 , -.Xr wcsspn 3 , -.Xr wcsstr 3 , -.Xr wcstok 3 , -.Xr wmemchr 3 -.Sh STANDARDS -The -.Fn wcsrchr -function conforms to -.St -isoC-99 -and was first introduced in -.St -isoC-amd1 . -.Sh HISTORY -The -.Fn wcsrchr -function was ported from -.Nx -and first appeared in -.Ox 3.8 . diff --git a/src/lib/libc/string/wcsrchr.c b/src/lib/libc/string/wcsrchr.c deleted file mode 100644 index 3433310c56..0000000000 --- a/src/lib/libc/string/wcsrchr.c +++ /dev/null @@ -1,50 +0,0 @@ -/* $OpenBSD: wcsrchr.c,v 1.3 2005/08/08 08:05:37 espie Exp $ */ -/* $NetBSD: wcsrchr.c,v 1.2 2001/01/03 14:29:37 lukem Exp $ */ - -/*- - * Copyright (c)1999 Citrus Project, - * 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 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 AUTHOR 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. - * - * citrus Id: wcsrchr.c,v 1.2 2000/12/21 05:07:25 itojun Exp - */ - -#include - -wchar_t * -wcsrchr(const wchar_t *s, wchar_t c) -{ - const wchar_t *p; - - p = s; - while (*p) - p++; - while (s <= p) { - if (*p == c) { - /* LINTED interface specification */ - return (wchar_t *)p; - } - p--; - } - return NULL; -} diff --git a/src/lib/libc/string/wcsspn.3 b/src/lib/libc/string/wcsspn.3 deleted file mode 100644 index 3be82344dd..0000000000 --- a/src/lib/libc/string/wcsspn.3 +++ /dev/null @@ -1,79 +0,0 @@ -.\" $OpenBSD: wcsspn.3,v 1.3 2013/06/05 03:39:23 tedu Exp $ -.\" -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt WCSSPN 3 -.Os -.Sh NAME -.Nm wcsspn -.Nd span a wide string -.Sh SYNOPSIS -.In wchar.h -.Ft size_t -.Fn wcsspn "const wchar_t *s" "const wchar_t *charset" -.Sh DESCRIPTION -The -.Fn wcsspn -function spans the initial part of the wide string -.Fa s -as long as the wide characters from -.Fa s -occur in the wide string -.Fa charset . -.Sh RETURN VALUES -The -.Fn wcsspn -function returns the number of wide characters spanned. -.Sh SEE ALSO -.Xr strspn 3 , -.Xr wcschr 3 , -.Xr wcscspn 3 , -.Xr wcspbrk 3 , -.Xr wcsrchr 3 , -.Xr wcsstr 3 , -.Xr wcstok 3 , -.Xr wmemchr 3 -.Sh STANDARDS -The -.Fn wcsspn -function conforms to -.St -isoC-99 -and was first introduced in -.St -isoC-amd1 . -.Sh HISTORY -The -.Fn wcsspn -function was ported from -.Nx -and first appeared in -.Ox 3.8 . diff --git a/src/lib/libc/string/wcsspn.c b/src/lib/libc/string/wcsspn.c deleted file mode 100644 index 5162fa0763..0000000000 --- a/src/lib/libc/string/wcsspn.c +++ /dev/null @@ -1,55 +0,0 @@ -/* $OpenBSD: wcsspn.c,v 1.3 2005/08/08 08:05:37 espie Exp $ */ -/* $NetBSD: wcsspn.c,v 1.3 2001/09/21 16:09:15 yamt Exp $ */ - -/*- - * Copyright (c)1999,2001 Citrus Project, - * 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 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 AUTHOR 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. - * - * $Citrus: xpg4dl/FreeBSD/lib/libc/string/wcsspn.c,v 1.3 2001/09/21 16:06:43 yamt Exp $ - */ - -#include - -size_t -wcsspn(const wchar_t *s, const wchar_t *set) -{ - const wchar_t *p; - const wchar_t *q; - - p = s; - while (*p) { - q = set; - while (*q) { - if (*p == *q) - break; - q++; - } - if (!*q) - goto done; - p++; - } - -done: - return (p - s); -} diff --git a/src/lib/libc/string/wcsstr.3 b/src/lib/libc/string/wcsstr.3 deleted file mode 100644 index 203a76ded3..0000000000 --- a/src/lib/libc/string/wcsstr.3 +++ /dev/null @@ -1,88 +0,0 @@ -.\" $OpenBSD: wcsstr.3,v 1.3 2013/06/05 03:39:23 tedu Exp $ -.\" -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt WCSSTR 3 -.Os -.Sh NAME -.Nm wcsstr -.Nd locate a wide substring in a wide string -.Sh SYNOPSIS -.In wchar.h -.Ft wchar_t * -.Fn wcsstr "const wchar_t *big" "const wchar_t *little" -.Sh DESCRIPTION -The -.Fn wcsstr -function locates the first occurrence of the wide string -.Fa little -in the wide string -.Fa big . -.Pp -If -.Fa little -is an empty wide string, -.Fa big -is returned; -if -.Fa little -occurs nowhere in -.Fa big , -.Dv NULL -is returned; -otherwise a pointer to the first wide character of the first occurrence of -.Fa little -is returned. -.Sh SEE ALSO -.Xr strstr 3 , -.Xr wcschr 3 , -.Xr wcscspn 3 , -.Xr wcspbrk 3 , -.Xr wcsrchr 3 , -.Xr wcsspn 3 , -.Xr wcstok 3 , -.Xr wmemchr 3 -.Sh STANDARDS -The -.Fn wcsstr -function conforms to -.St -isoC-99 -and was first introduced in -.St -isoC-amd1 . -.Sh HISTORY -The -.Fn wcsstr -function was ported from -.Nx -and first appeared in -.Ox 3.8 . diff --git a/src/lib/libc/string/wcsstr.c b/src/lib/libc/string/wcsstr.c deleted file mode 100644 index 669e340280..0000000000 --- a/src/lib/libc/string/wcsstr.c +++ /dev/null @@ -1,70 +0,0 @@ -/* $OpenBSD: wcsstr.c,v 1.3 2005/08/08 08:05:37 espie Exp $ */ -/* $NetBSD: wcsstr.c,v 1.3 2003/03/05 20:18:17 tshiozak Exp $ */ - -/*- - * Copyright (c)1999 Citrus Project, - * 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 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 AUTHOR 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. - * - * citrus Id: wcsstr.c,v 1.2 2000/12/21 05:07:25 itojun Exp - */ - -#include - -wchar_t * -#ifdef WCSWCS -wcswcs(const wchar_t *big, const wchar_t *little) -#else -wcsstr(const wchar_t *big, const wchar_t *little) -#endif -{ - const wchar_t *p; - const wchar_t *q; - const wchar_t *r; - - if (!*little) { - /* LINTED interface specification */ - return (wchar_t *)big; - } - if (wcslen(big) < wcslen(little)) - return NULL; - - p = big; - q = little; - while (*p) { - q = little; - r = p; - while (*q) { - if (*r != *q) - break; - q++; - r++; - } - if (!*q) { - /* LINTED interface specification */ - return (wchar_t *)p; - } - p++; - } - return NULL; -} diff --git a/src/lib/libc/string/wcstok.3 b/src/lib/libc/string/wcstok.3 deleted file mode 100644 index 33ba1318a1..0000000000 --- a/src/lib/libc/string/wcstok.3 +++ /dev/null @@ -1,151 +0,0 @@ -.\" $OpenBSD: wcstok.3,v 1.7 2011/07/25 00:38:53 schwarze Exp $ -.\" -.\" $NetBSD: wcstok.3,v 1.3 2003/09/08 17:54:33 wiz Exp $ -.\" -.\" Copyright (c) 1998 Softweyr LLC. All rights reserved. -.\" -.\" strtok_r, from Berkeley strtok -.\" Oct 13, 1998 by Wes Peters -.\" -.\" 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. -.\" -.\" Original version ID: -.\" FreeBSD: src/lib/libc/string/wcstok.3,v 1.4 2002/10/15 09:49:54 tjr Exp -.\" -.Dd $Mdocdate: July 25 2011 $ -.Dt WCSTOK 3 -.Os -.Sh NAME -.Nm wcstok -.Nd split wide-character string into tokens -.Sh SYNOPSIS -.In wchar.h -.Ft wchar_t * -.Fn wcstok "wchar_t * restrict str" "const wchar_t * restrict sep" "wchar_t ** restrict last" -.Sh DESCRIPTION -The -.Fn wcstok -function -is used to isolate sequential tokens in a NUL-terminated wide-character -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 wcstok -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. -The context pointer -.Fa last -must be provided on each call. -.Pp -The -.Fn wcstok -function is the wide-character counterpart of the -.Xr strtok_r 3 -function. -.Pp -Since -.Fn wcstok -modifies the string, -.Fa str -should not point to an area in the initialized data segment. -.Sh RETURN VALUES -The -.Fn wcstok -function -returns a pointer to the beginning of each subsequent token in the string, -after replacing the token itself with a NUL wide character (L'\e0'). -When no more tokens remain, a null pointer is returned. -.Sh EXAMPLES -The following code fragment splits a wide-character string on -.Tn ASCII -space, tab, and newline characters and writes the tokens to -standard output: -.Bd -literal -offset indent -const wchar_t *seps = L" \et\en"; -wchar_t *last, *tok, text[] = L" \enone\ettwo\et\etthree \en"; - -for (tok = wcstok(text, seps, &last); tok != NULL; - tok = wcstok(NULL, seps, &last)) - wprintf(L"%ls\en", tok); -.Ed -.Sh SEE ALSO -.Xr strtok 3 , -.Xr wcschr 3 , -.Xr wcscspn 3 , -.Xr wcspbrk 3 , -.Xr wcsrchr 3 , -.Xr wcsspn 3 , -.Xr wcsstr 3 , -.Xr wmemchr 3 -.Sh STANDARDS -The -.Fn wcstok -function -conforms to -.St -isoC-99 . -.Sh HISTORY -The -.Fn wcstok -function was ported from -.Nx -and first appeared in -.Ox 3.8 . -.Pp -Some early implementations of -.Fn wcstok -omit the -context pointer argument, -.Fa last , -and maintain state across calls in a static variable like -.Xr strtok 3 -does. diff --git a/src/lib/libc/string/wcstok.c b/src/lib/libc/string/wcstok.c deleted file mode 100644 index bc1ac3e8cb..0000000000 --- a/src/lib/libc/string/wcstok.c +++ /dev/null @@ -1,93 +0,0 @@ -/* $OpenBSD: wcstok.c,v 1.3 2005/08/08 08:05:37 espie Exp $ */ -/* $NetBSD: wcstok.c,v 1.3 2003/07/10 08:50:48 tshiozak Exp $ */ - -/*- - * Copyright (c) 1998 Softweyr LLC. All rights reserved. - * - * strtok_r, from Berkeley strtok - * Oct 13, 1998 by Wes Peters - * - * 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. - * - * Original version ID: - * FreeBSD: src/lib/libc/string/wcstok.c,v 1.1 2002/09/07 08:16:57 tjr Exp - */ - -#include - -wchar_t * -wcstok(wchar_t * __restrict s, const wchar_t * __restrict delim, - wchar_t ** __restrict last) -{ - const wchar_t *spanp; - wchar_t c, sc; - wchar_t *tok; - - if (s == NULL && (s = *last) == NULL) - return (NULL); - - /* - * Skip (span) leading delimiters (s += wcsspn(s, delim), sort of). - */ -cont: - c = *s++; - for (spanp = delim; (sc = *spanp++) != L'\0';) { - if (c == sc) - goto cont; - } - - if (c == L'\0') { /* no non-delimiter characters */ - *last = NULL; - return (NULL); - } - tok = s - 1; - - /* - * Scan token (scan for delimiters: s += wcscspn(s, delim), sort of). - * Note that delim must have one NUL; we stop if we see that, too. - */ - for (;;) { - c = *s++; - spanp = delim; - do { - if ((sc = *spanp++) == c) { - if (c == L'\0') - s = NULL; - else - s[-1] = L'\0'; - *last = s; - return (tok); - } - } while (sc != L'\0'); - } - /* NOTREACHED */ -} diff --git a/src/lib/libc/string/wcswcs.c b/src/lib/libc/string/wcswcs.c deleted file mode 100644 index bd35605547..0000000000 --- a/src/lib/libc/string/wcswcs.c +++ /dev/null @@ -1,5 +0,0 @@ -/* $OpenBSD: wcswcs.c,v 1.1 2005/04/13 16:35:58 espie Exp $ */ -/* $NetBSD: wcswcs.c,v 1.1 2003/03/05 20:18:17 tshiozak Exp $ */ - -#define WCSWCS -#include "wcsstr.c" diff --git a/src/lib/libc/string/wcswidth.3 b/src/lib/libc/string/wcswidth.3 deleted file mode 100644 index a2a5b2df86..0000000000 --- a/src/lib/libc/string/wcswidth.3 +++ /dev/null @@ -1,69 +0,0 @@ -.\" $OpenBSD: wcswidth.3,v 1.2 2011/07/25 00:38:53 schwarze Exp $ -.\" -.\" Copyright (c) 2002 Tim J. Robbins -.\" 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 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 AUTHOR 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. -.\" -.Dd $Mdocdate: July 25 2011 $ -.Dt WCSWIDTH 3 -.Os -.Sh NAME -.Nm wcswidth -.Nd number of column positions in wide-character string -.Sh SYNOPSIS -.In wchar.h -.Ft int -.Fn wcswidth "const wchar_t *pwcs" "size_t n" -.Sh DESCRIPTION -The -.Fn wcswidth -function determines the number of column positions required for the first -.Fa n -characters of -.Fa pwcs , -or until a null wide character (L'\e0') is encountered. -.Sh RETURN VALUES -The -.Fn wcswidth -function returns 0 if -.Fa pwcs -is an empty string (L""), -\-1 if a non-printing wide character is encountered, -otherwise it returns the number of column positions occupied. -.Sh SEE ALSO -.Xr iswprint 3 , -.Xr strlen 3 , -.Xr wcslen 3 , -.Xr wcwidth 3 -.Sh STANDARDS -The -.Fn wcswidth -function conforms to -.St -p1003.1-2001 . -.Sh HISTORY -The -.Fn wcswidth -function was ported from -.Nx -and first appeared in -.Ox 3.8 . diff --git a/src/lib/libc/string/wcswidth.c b/src/lib/libc/string/wcswidth.c deleted file mode 100644 index 8ea1bdf6e6..0000000000 --- a/src/lib/libc/string/wcswidth.c +++ /dev/null @@ -1,50 +0,0 @@ -/* $OpenBSD: wcswidth.c,v 1.4 2011/04/04 18:16:24 stsp Exp $ */ -/* $NetBSD: wcswidth.c,v 1.2 2001/01/03 14:29:37 lukem Exp $ */ - -/*- - * Copyright (c)1999 Citrus Project, - * 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 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 AUTHOR 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. - * - * citrus Id: wcswidth.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp - */ - -#include - -int -wcswidth(const wchar_t *s, size_t n) -{ - int w, q; - - w = 0; - while (n && *s) { - q = wcwidth(*s); - if (q == -1) - return (-1); - w += q; - s++; - n--; - } - - return w; -} diff --git a/src/lib/libc/string/wmemchr.3 b/src/lib/libc/string/wmemchr.3 deleted file mode 100644 index 17fbc9dbc5..0000000000 --- a/src/lib/libc/string/wmemchr.3 +++ /dev/null @@ -1,81 +0,0 @@ -.\" $OpenBSD: wmemchr.3,v 1.10 2013/06/05 03:39:23 tedu Exp $ -.\" -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt WMEMCHR 3 -.Os -.Sh NAME -.Nm wmemchr -.Nd locate wide character in wide string -.Sh SYNOPSIS -.In wchar.h -.Ft wchar_t * -.Fn wmemchr "const wchar_t *b" "wchar_t c" "size_t len" -.Sh DESCRIPTION -The -.Fn wmemchr -function locates the first occurrence of -.Fa c -in wide string -.Fa b . -.Sh RETURN VALUES -The -.Fn wmemchr -function returns a pointer to the wide character located, or -.Dv NULL -if no such wide character exists within -.Fa len -wide characters. -.Sh SEE ALSO -.Xr memchr 3 , -.Xr wcschr 3 , -.Xr wcscspn 3 , -.Xr wcspbrk 3 , -.Xr wcsrchr 3 , -.Xr wcsspn 3 , -.Xr wcsstr 3 , -.Xr wcstok 3 -.Sh STANDARDS -The -.Fn wmemchr -function conforms to -.St -isoC-99 -and was first introduced in -.St -isoC-amd1 . -.Sh HISTORY -The -.Fn wmemchr -function was ported from -.Nx -and first appeared in -.Ox 3.8 . diff --git a/src/lib/libc/string/wmemchr.c b/src/lib/libc/string/wmemchr.c deleted file mode 100644 index 8c9517861b..0000000000 --- a/src/lib/libc/string/wmemchr.c +++ /dev/null @@ -1,47 +0,0 @@ -/* $OpenBSD: wmemchr.c,v 1.3 2005/08/08 08:05:37 espie Exp $ */ -/* $NetBSD: wmemchr.c,v 1.2 2001/01/03 14:29:37 lukem Exp $ */ - -/*- - * Copyright (c)1999 Citrus Project, - * 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 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 AUTHOR 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. - * - * citrus Id: wmemchr.c,v 1.2 2000/12/20 14:08:31 itojun Exp - */ - -#include - -wchar_t * -wmemchr(const wchar_t *s, wchar_t c, size_t n) -{ - size_t i; - - for (i = 0; i < n; i++) { - if (*s == c) { - /* LINTED const castaway */ - return (wchar_t *)s; - } - s++; - } - return NULL; -} diff --git a/src/lib/libc/string/wmemcmp.3 b/src/lib/libc/string/wmemcmp.3 deleted file mode 100644 index bd8ddfd120..0000000000 --- a/src/lib/libc/string/wmemcmp.3 +++ /dev/null @@ -1,78 +0,0 @@ -.\" $OpenBSD: wmemcmp.3,v 1.3 2013/06/05 03:39:23 tedu Exp $ -.\" -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt WMEMCMP 3 -.Os -.Sh NAME -.Nm wmemcmp -.Nd compare wide strings -.Sh SYNOPSIS -.In wchar.h -.Ft int -.Fn wmemcmp "const wchar_t *s1" "const wchar_t *s2" "size_t len" -.Sh DESCRIPTION -The -.Fn wmemcmp -function compares the wide string -.Fa s1 -against the wide string -.Fa s2 . -Both wide strings are assumed to be -.Fa len -wide characters long. -.Sh RETURN VALUES -The -.Fn wmemcmp -function returns zero if the two wide strings are identical, -otherwise the difference between the first two differing wide characters is -returned. -Zero-length wide strings are always identical. -.Sh SEE ALSO -.Xr memcmp 3 , -.Xr wcscasecmp 3 , -.Xr wcscmp 3 -.Sh STANDARDS -The -.Fn wmemcmp -function conforms to -.St -isoC-99 -and was first introduced in -.St -isoC-amd1 . -.Sh HISTORY -The -.Fn wmemcmp -function was ported from -.Nx -and first appeared in -.Ox 3.8 . diff --git a/src/lib/libc/string/wmemcmp.c b/src/lib/libc/string/wmemcmp.c deleted file mode 100644 index 39419aeddc..0000000000 --- a/src/lib/libc/string/wmemcmp.c +++ /dev/null @@ -1,50 +0,0 @@ -/* $OpenBSD: wmemcmp.c,v 1.4 2005/08/08 08:05:37 espie Exp $ */ -/* $NetBSD: wmemcmp.c,v 1.3 2003/04/06 18:33:23 tshiozak Exp $ */ - -/*- - * Copyright (c)1999 Citrus Project, - * 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 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 AUTHOR 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. - * - * citrus Id: wmemcmp.c,v 1.2 2000/12/20 14:08:31 itojun Exp - */ - -#include -#include "locale/runetype.h" - -int -wmemcmp(const wchar_t *s1, const wchar_t *s2, size_t n) -{ - size_t i; - - for (i = 0; i < n; i++) { - if (*s1 != *s2) { - /* wchar might be unsigned */ - return *(const rune_t *)s1 > - *(const rune_t *)s2 ? 1 : -1; - } - s1++; - s2++; - } - return 0; -} diff --git a/src/lib/libc/string/wmemcpy.3 b/src/lib/libc/string/wmemcpy.3 deleted file mode 100644 index 2a6d528a1a..0000000000 --- a/src/lib/libc/string/wmemcpy.3 +++ /dev/null @@ -1,79 +0,0 @@ -.\" $OpenBSD: wmemcpy.3,v 1.5 2013/06/05 03:39:23 tedu Exp $ -.\" -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt WMEMCPY 3 -.Os -.Sh NAME -.Nm wmemcpy -.Nd copy wide characters -.Sh SYNOPSIS -.In wchar.h -.Ft wchar_t * -.Fn wmemcpy "wchar_t * restrict dst" "const wchar_t * restrict src" "size_t len" -.Sh DESCRIPTION -The -.Fn wmemcpy -function copies -.Fa len -wide characters from buffer -.Fa src -to buffer -.Fa dst . -If the two buffers may overlap, -.Xr wmemmove 3 -must be used instead. -.Sh RETURN VALUES -The -.Fn wmemcpy -function returns the original value of -.Fa dst . -.Sh SEE ALSO -.Xr memcpy 3 , -.Xr wcscpy 3 , -.Xr wcslcpy 3 , -.Xr wmemmove 3 -.Sh STANDARDS -The -.Fn wmemcpy -function conforms to -.St -isoC-99 -and was first introduced in -.St -isoC-amd1 . -.Sh HISTORY -The -.Fn wmemcpy -function was ported from -.Nx -and first appeared in -.Ox 3.8 . diff --git a/src/lib/libc/string/wmemcpy.c b/src/lib/libc/string/wmemcpy.c deleted file mode 100644 index 9bbd83648e..0000000000 --- a/src/lib/libc/string/wmemcpy.c +++ /dev/null @@ -1,40 +0,0 @@ -/* $OpenBSD: wmemcpy.c,v 1.3 2005/08/08 08:05:37 espie Exp $ */ -/* $NetBSD: wmemcpy.c,v 1.2 2001/01/03 14:29:37 lukem Exp $ */ - -/*- - * Copyright (c)1999 Citrus Project, - * 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 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 AUTHOR 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. - * - * citrus Id: wmemcpy.c,v 1.2 2000/12/20 14:08:31 itojun Exp - */ - -#include -#include - -wchar_t * -wmemcpy(wchar_t *d, const wchar_t *s, size_t n) -{ - - return (wchar_t *)memcpy(d, s, n * sizeof(wchar_t)); -} diff --git a/src/lib/libc/string/wmemmove.3 b/src/lib/libc/string/wmemmove.3 deleted file mode 100644 index 46942e7928..0000000000 --- a/src/lib/libc/string/wmemmove.3 +++ /dev/null @@ -1,78 +0,0 @@ -.\" $OpenBSD: wmemmove.3,v 1.3 2013/06/05 03:39:23 tedu Exp $ -.\" -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt WMEMMOVE 3 -.Os -.Sh NAME -.Nm wmemmove -.Nd copy wide characters -.Sh SYNOPSIS -.In wchar.h -.Ft wchar_t * -.Fn wmemmove "wchar_t *dst" "const wchar_t *src" "size_t len" -.Sh DESCRIPTION -The -.Fn wmemmove -function copies -.Fa len -wide characters from buffer -.Fa src -to buffer -.Fa dst . -The two buffers may overlap; -the copy is always done in a non-destructive manner. -.Sh RETURN VALUES -The -.Fn wmemmove -function returns the original value of -.Fa dst . -.Sh SEE ALSO -.Xr memmove 3 , -.Xr wcscpy 3 , -.Xr wcslcpy 3 , -.Xr wmemcpy 3 -.Sh STANDARDS -The -.Fn wmemmove -function conforms to -.St -isoC-99 -and was first introduced in -.St -isoC-amd1 . -.Sh HISTORY -The -.Fn wmemmove -function was ported from -.Nx -and first appeared in -.Ox 3.8 . diff --git a/src/lib/libc/string/wmemmove.c b/src/lib/libc/string/wmemmove.c deleted file mode 100644 index 21bbabcd0c..0000000000 --- a/src/lib/libc/string/wmemmove.c +++ /dev/null @@ -1,40 +0,0 @@ -/* $OpenBSD: wmemmove.c,v 1.3 2005/08/08 08:05:37 espie Exp $ */ -/* $NetBSD: wmemmove.c,v 1.2 2001/01/03 14:29:37 lukem Exp $ */ - -/*- - * Copyright (c)1999 Citrus Project, - * 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 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 AUTHOR 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. - * - * citrus Id: wmemmove.c,v 1.2 2000/12/20 14:08:31 itojun Exp - */ - -#include -#include - -wchar_t * -wmemmove(wchar_t *d, const wchar_t *s, size_t n) -{ - - return (wchar_t *)memmove(d, s, n * sizeof(wchar_t)); -} diff --git a/src/lib/libc/string/wmemset.3 b/src/lib/libc/string/wmemset.3 deleted file mode 100644 index 2655d68bcb..0000000000 --- a/src/lib/libc/string/wmemset.3 +++ /dev/null @@ -1,73 +0,0 @@ -.\" $OpenBSD: wmemset.3,v 1.4 2013/06/05 03:39:23 tedu Exp $ -.\" -.\" Copyright (c) 1990, 1991 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. 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. -.\" -.Dd $Mdocdate: June 5 2013 $ -.Dt WMEMSET 3 -.Os -.Sh NAME -.Nm wmemset -.Nd write a wide string -.Sh SYNOPSIS -.In wchar.h -.Ft wchar_t * -.Fn wmemset "wchar_t *s" "wchar_t c" "size_t len" -.Sh DESCRIPTION -The -.Fn wmemset -function writes -.Fa len -wide characters of value -.Fa c -to the wide string -.Fa s . -.Sh RETURN VALUES -The -.Fn wmemset -function returns the original value of -.Fa s . -.Sh SEE ALSO -.Xr memset 3 -.Sh STANDARDS -The -.Fn wmemset -function conforms to -.St -isoC-99 -and was first introduced in -.St -isoC-amd1 . -.Sh HISTORY -The -.Fn wmemset -function was ported from -.Nx -and first appeared in -.Ox 3.8 . diff --git a/src/lib/libc/string/wmemset.c b/src/lib/libc/string/wmemset.c deleted file mode 100644 index ac476dba6a..0000000000 --- a/src/lib/libc/string/wmemset.c +++ /dev/null @@ -1,46 +0,0 @@ -/* $OpenBSD: wmemset.c,v 1.3 2005/08/08 08:05:37 espie Exp $ */ -/* $NetBSD: wmemset.c,v 1.2 2001/01/03 14:29:37 lukem Exp $ */ - -/*- - * Copyright (c)1999 Citrus Project, - * 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 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 AUTHOR 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. - * - * citrus Id: wmemset.c,v 1.2 2000/12/20 14:08:31 itojun Exp - */ - -#include - -wchar_t * -wmemset(wchar_t *s, wchar_t c, size_t n) -{ - size_t i; - wchar_t *p; - - p = s; - for (i = 0; i < n; i++) { - *p = c; - p++; - } - return s; -} -- cgit v1.2.3-55-g6feb