summaryrefslogtreecommitdiff
path: root/missing/memmove.c
diff options
context:
space:
mode:
Diffstat (limited to 'missing/memmove.c')
-rw-r--r--missing/memmove.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/missing/memmove.c b/missing/memmove.c
new file mode 100644
index 0000000..09e6470
--- /dev/null
+++ b/missing/memmove.c
@@ -0,0 +1,24 @@
+/*
+ * memmove --- move memories.
+ *
+ * We supply this routine for those systems that aren't standard yet.
+ */
+
+char *
+memmove (dst, src, n)
+ char *dst, *src;
+ int n;
+{
+ char *ret = dst;
+
+ if (src < dst) {
+ src += n;
+ dst += n;
+ while (n--)
+ *--dst = *--src;
+ }
+ else if (dst < src)
+ while (n--)
+ *dst++ = *src++;
+ return ret;
+}