memmove.c 533 B

123456789101112131415161718192021222324252627
  1. /* Wrapper to implement ANSI C's memmove using BSD's bcopy. */
  2. /* This function is in the public domain. --Per Bothner. */
  3. /*
  4. @deftypefn Supplemental void* memmove (void *@var{from}, const void *@var{to}, @
  5. size_t @var{count})
  6. Copies @var{count} bytes from memory area @var{from} to memory area
  7. @var{to}, returning a pointer to @var{to}.
  8. @end deftypefn
  9. */
  10. #include <ansidecl.h>
  11. #include <stddef.h>
  12. void bcopy (const void*, void*, size_t);
  13. PTR
  14. memmove (PTR s1, const PTR s2, size_t n)
  15. {
  16. bcopy (s2, s1, n);
  17. return s1;
  18. }