From: Jim Meyering Date: Fri, 27 Jan 1995 19:32:16 +0000 (+0000) Subject: . X-Git-Tag: textutils-1_12_1~321 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=19765460626c97d68cf9f7399891c453d91249b0;p=platform%2Fupstream%2Fcoreutils.git . --- diff --git a/lib/memmove.c b/lib/memmove.c new file mode 100644 index 0000000..d9d9e07 --- /dev/null +++ b/lib/memmove.c @@ -0,0 +1,19 @@ +/* memmove.c -- copy memory. + Copy LENGTH bytes from SOURCE to DEST. Does not null-terminate. + In the public domain. + By David MacKenzie . */ + +void +memmove (dest, source, length) + char *dest, *source; + unsigned length; +{ + 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++; +}