missing/memmove.c


DEFINITIONS

This source file includes following functions.
  1. memmove


   1  /* public domain rewrite of memcmp(3) */
   2  
   3  char *
   4  memmove (dst, src, n)
   5      char *dst, *src;
   6      int n;
   7  {
   8      char *ret = dst;
   9  
  10      if (src < dst) {
  11          src += n;
  12          dst += n;
  13          while (n--)
  14              *--dst = *--src;
  15      }
  16      else if (dst < src)
  17          while (n--)
  18              *dst++ = *src++;
  19      return ret;
  20  }