aboutsummaryrefslogtreecommitdiff
path: root/lib/strequal.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2001-02-05 23:35:44 +0000
committerDaniel Stenberg <daniel@haxx.se>2001-02-05 23:35:44 +0000
commitdb70cd28b34e73fc38617176cd8b1306a129abe5 (patch)
tree0bbbc996ce2313f59165318072e008d2e95a67a0 /lib/strequal.c
parentf6e2bfd464a7ffd7ec24194da2a9a1e285387560 (diff)
adjusted the IPv6 stuff to compile and build on Linux as well
Diffstat (limited to 'lib/strequal.c')
-rw-r--r--lib/strequal.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/strequal.c b/lib/strequal.c
index 82e991cda..97d1f9199 100644
--- a/lib/strequal.c
+++ b/lib/strequal.c
@@ -66,3 +66,29 @@ int Curl_strnequal(const char *first, const char *second, size_t max)
#endif
}
+#ifndef HAVE_STRLCAT
+/*
+ * The strlcat() function appends the NUL-terminated string src to the end
+ * of dst. It will append at most size - strlen(dst) - 1 bytes, NUL-termi-
+ * nating the result.
+ *
+ * The strlcpy() and strlcat() functions return the total length of the
+ * string they tried to create. For strlcpy() that means the length of src.
+ * For strlcat() that means the initial length of dst plus the length of
+ * src. While this may seem somewhat confusing it was done to make trunca-
+ * tion detection simple.
+ */
+size_t strlcat(char *dst, const char *src, size_t size)
+{
+ size_t len = strlen(dst);
+ size_t orglen = len;
+ int index=0;
+
+ while(src[index] && (len < (size-1)) ) {
+ dst[len++] = src[index++];
+ }
+ dst[len]=0;
+
+ return orglen + strlen(src);
+}
+#endif