check for a broken inet_ntoa() on IRIX
[rsync/rsync.git] / lib / compat.c
index c0cf63b..f47275f 100644 (file)
@@ -54,7 +54,7 @@ pid_t waitpid(pid_t pid, int *statptr, int options)
 #ifndef HAVE_MEMMOVE
 void *memmove(void *dest, const void *src, size_t n)
 {
-       bcopy(src, dest, n);
+       memcpy(dest, src, n);
        return dest;
 }
 #endif
@@ -76,3 +76,19 @@ char *strpbrk(const char *s, const char *accept)
        return NULL;
 }
 #endif
+
+#ifdef REPLACE_INET_NTOA
+char *rep_inet_ntoa(struct in_addr ip)
+{
+       unsigned char *p = (unsigned char *)&ip.s_addr;
+       static char buf[18];
+#if WORDS_BIGENDIAN
+       slprintf(buf, 17, "%d.%d.%d.%d", 
+                (int)p[0], (int)p[1], (int)p[2], (int)p[3]);
+#else
+       slprintf(buf, 17, "%d.%d.%d.%d", 
+                (int)p[3], (int)p[2], (int)p[1], (int)p[0]);
+#endif
+       return buf;
+}
+#endif