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