summaryrefslogtreecommitdiff
path: root/missing/memmove.c
diff options
context:
space:
mode:
Diffstat (limited to 'missing/memmove.c')
-rw-r--r--missing/memmove.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/missing/memmove.c b/missing/memmove.c
index 09e6470..7961c5c 100644
--- a/missing/memmove.c
+++ b/missing/memmove.c
@@ -1,24 +1,20 @@
-/*
- * memmove --- move memories.
- *
- * We supply this routine for those systems that aren't standard yet.
- */
+/* public domain rewrite of memcmp(3) */
char *
memmove (dst, src, n)
- char *dst, *src;
- int n;
+ char *dst, *src;
+ int n;
{
- char *ret = dst;
+ char *ret = dst;
- if (src < dst) {
- src += n;
- dst += n;
- while (n--)
- *--dst = *--src;
- }
- else if (dst < src)
- while (n--)
- *dst++ = *src++;
- return ret;
+ if (src < dst) {
+ src += n;
+ dst += n;
+ while (n--)
+ *--dst = *--src;
+ }
+ else if (dst < src)
+ while (n--)
+ *dst++ = *src++;
+ return ret;
}