This commit was manufactured by cvs2svn to create branch 'captive'.
[reactos.git] / lib / string / memccpy.c
diff --git a/lib/string/memccpy.c b/lib/string/memccpy.c
new file mode 100644 (file)
index 0000000..c760b85
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * $Id$
+ */
+
+#include <string.h>
+
+
+void *
+_memccpy (void *to, const void *from,int c,size_t count)
+{
+  char t;
+  size_t i;
+  char *dst=(char*)to;
+  const char *src=(const char*)from;
+
+  for ( i = 0; i < count; i++ )
+  {
+    dst[i] = t = src[i];
+    if ( t == '\0' )
+      break;
+    if ( t == c )
+      return &dst[i+1];
+  }
+  return NULL; /* didn't copy c */
+}