summaryrefslogtreecommitdiffstats
path: root/contrib/syslinux-4.02/com32/lib/strlcat.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/syslinux-4.02/com32/lib/strlcat.c')
-rw-r--r--contrib/syslinux-4.02/com32/lib/strlcat.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/contrib/syslinux-4.02/com32/lib/strlcat.c b/contrib/syslinux-4.02/com32/lib/strlcat.c
new file mode 100644
index 0000000..75f69ed
--- /dev/null
+++ b/contrib/syslinux-4.02/com32/lib/strlcat.c
@@ -0,0 +1,29 @@
+/*
+ * strlcat.c
+ */
+
+#include <string.h>
+#include <klibc/compiler.h>
+
+size_t strlcat(char *dst, const char *src, size_t size)
+{
+ size_t bytes = 0;
+ char *q = dst;
+ const char *p = src;
+ char ch;
+
+ while (bytes < size && *q) {
+ q++;
+ bytes++;
+ }
+
+ while ((ch = *p++)) {
+ if (bytes < size)
+ *q++ = ch;
+
+ bytes++;
+ }
+
+ *q = '\0';
+ return bytes;
+}