summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bind/lib/isc/string.c
diff options
context:
space:
mode:
authorflorian <florian@openbsd.org>2020-01-09 13:47:12 +0000
committerflorian <florian@openbsd.org>2020-01-09 13:47:12 +0000
commitad3b53661d6e8c6ff17607778560ff02c209fc9d (patch)
treead116f7232545d5c82adc4e17de67db281f9e7d6 /usr.sbin/bind/lib/isc/string.c
parentunifdef network defines: (diff)
downloadwireguard-openbsd-ad3b53661d6e8c6ff17607778560ff02c209fc9d.tar.xz
wireguard-openbsd-ad3b53661d6e8c6ff17607778560ff02c209fc9d.zip
unifdef printf and string functions:
#undef ISC_PLATFORM_NEEDVSNPRINTF #undef ISC_PLATFORM_NEEDSPRINTF #undef ISC_PLATFORM_NEEDPRINTF #undef ISC_PLATFORM_NEEDFPRINTF #define ISC_PLATFORM_QUADFORMAT "ll" #undef ISC_PLATFORM_NEEDSTRSEP #undef ISC_PLATFORM_NEEDSTRLCPY #undef ISC_PLATFORM_NEEDSTRLCAT #undef ISC_PLATFORM_NEEDSTRTOUL #undef ISC_PLATFORM_NEEDMEMMOVE #undef ISC_PLATFORM_NEEDSTRCASESTR
Diffstat (limited to 'usr.sbin/bind/lib/isc/string.c')
-rw-r--r--usr.sbin/bind/lib/isc/string.c98
1 files changed, 1 insertions, 97 deletions
diff --git a/usr.sbin/bind/lib/isc/string.c b/usr.sbin/bind/lib/isc/string.c
index 7d498cbe514..9f649922ea3 100644
--- a/usr.sbin/bind/lib/isc/string.c
+++ b/usr.sbin/bind/lib/isc/string.c
@@ -50,7 +50,7 @@
#include <ctype.h>
#include <isc/mem.h>
-#include <isc/print.h>
+
#include <isc/region.h>
#include <isc/string.h>
#include <isc/util.h>
@@ -220,99 +220,3 @@ isc_string_regiondup(isc_mem_t *mctx, const isc_region_t *source) {
return (target);
}
-
-char *
-isc_string_separate(char **stringp, const char *delim) {
- char *string = *stringp;
- char *s;
- const char *d;
- char sc, dc;
-
- if (string == NULL)
- return (NULL);
-
- for (s = string; (sc = *s) != '\0'; s++)
- for (d = delim; (dc = *d) != '\0'; d++)
- if (sc == dc) {
- *s++ = '\0';
- *stringp = s;
- return (string);
- }
- *stringp = NULL;
- return (string);
-}
-
-size_t
-isc_string_strlcpy(char *dst, const char *src, size_t size)
-{
- char *d = dst;
- const char *s = src;
- size_t n = size;
-
- /* Copy as many bytes as will fit */
- if (n != 0U && --n != 0U) {
- do {
- if ((*d++ = *s++) == 0)
- break;
- } while (--n != 0U);
- }
-
- /* Not enough room in dst, add NUL and traverse rest of src */
- if (n == 0U) {
- if (size != 0U)
- *d = '\0'; /* NUL-terminate dst */
- while (*s++)
- ;
- }
-
- return(s - src - 1); /* count does not include NUL */
-}
-
-size_t
-isc_string_strlcat(char *dst, const char *src, size_t size)
-{
- char *d = dst;
- const char *s = src;
- size_t n = size;
- size_t dlen;
-
- /* Find the end of dst and adjust bytes left but don't go past end */
- while (n-- != 0U && *d != '\0')
- d++;
- dlen = d - dst;
- n = size - dlen;
-
- if (n == 0U)
- return(dlen + strlen(s));
- while (*s != '\0') {
- if (n != 1U) {
- *d++ = *s;
- n--;
- }
- s++;
- }
- *d = '\0';
-
- return(dlen + (s - src)); /* count does not include NUL */
-}
-
-char *
-isc_string_strcasestr(const char *str, const char *search) {
- char c, sc, *s;
- size_t len;
-
- if ((c = *search++) != 0) {
- c = tolower((unsigned char) c);
- len = strlen(search);
- do {
- do {
- if ((sc = *str++) == 0)
- return (NULL);
- } while ((char) tolower((unsigned char) sc) != c);
- } while (strncasecmp(str, search, len) != 0);
- str--;
- }
- DE_CONST(str, s);
- return (s);
-
-}