This commit was generated by cvs2svn to compensate for changes in r1815,
[bootcd.git] / syslinux / com32 / lib / strncpy.c
diff --git a/syslinux/com32/lib/strncpy.c b/syslinux/com32/lib/strncpy.c
new file mode 100644 (file)
index 0000000..a8fe45f
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * strncpy.c
+ *
+ * strncpy()
+ */
+
+#include <string.h>
+
+char *strncpy(char *dst, const char *src, size_t n)
+{
+  char *q = dst;
+  const char *p = src;
+  char ch;
+
+  while ( n-- ) {
+    *q++ = ch = *p++;
+    if ( !ch )
+      break;
+  }
+
+  return dst;
+}