]> sjero.net Git - wget/blobdiff - src/cmpt.c
[svn] Check for memmove and implement one if it's missing.
[wget] / src / cmpt.c
index 6fb7fc0413442c82a406ee53f304fdc781b5902b..81502d779d689988dd3f05640031ea306ff43bf1 100644 (file)
@@ -1226,3 +1226,23 @@ usleep (unsigned long usec)
 
 #endif /* not WINDOWS */
 #endif /* not HAVE_USLEEP */
+
+
+#ifndef HAVE_MEMMOVE
+void *
+memmove (char *dest, const char *source, unsigned length)
+{
+  char *d0 = dest;
+  if (source < dest)
+    /* Moving from low mem to hi mem; start at end.  */
+    for (source += length, dest += length; length; --length)
+      *--dest = *--source;
+  else if (source != dest)
+    {
+      /* Moving from hi mem to low mem; start at beginning.  */
+      for (; length; --length)
+       *dest++ = *source++;
+    }
+  return (void *) d0;
+}
+#endif /* not HAVE_MEMMOVE */