386BSD 0.1 development
authorWilliam F. Jolitz <wjolitz@soda.berkeley.edu>
Wed, 31 Jul 1991 20:42:15 +0000 (12:42 -0800)
committerWilliam F. Jolitz <wjolitz@soda.berkeley.edu>
Wed, 31 Jul 1991 20:42:15 +0000 (12:42 -0800)
Work on file usr/othersrc/public/textutils-1.3/textutils-1.3/lib/bcopy.c

Co-Authored-By: Lynne Greer Jolitz <ljolitz@cardio.ucsf.edu>
Synthesized-from: 386BSD-0.1

usr/othersrc/public/textutils-1.3/textutils-1.3/lib/bcopy.c [new file with mode: 0644]

diff --git a/usr/othersrc/public/textutils-1.3/textutils-1.3/lib/bcopy.c b/usr/othersrc/public/textutils-1.3/textutils-1.3/lib/bcopy.c
new file mode 100644 (file)
index 0000000..e153f06
--- /dev/null
@@ -0,0 +1,19 @@
+/* bcopy.c -- copy memory.
+   Copy LENGTH bytes from SOURCE to DEST.  Does not null-terminate.
+   In the public domain.
+   By David MacKenzie <djm@ai.mit.edu>. */
+
+void
+bcopy (source, dest, length)
+     char *source, *dest;
+     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++;
+}