X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/9fc310dafe2f6b49f21479ce9dc61634da0e6226..7b3d425783f68e3784ac25af60ed9407a2ae9a18:/lib/compat.c diff --git a/lib/compat.c b/lib/compat.c index 3e66cc91..f47275f5 100644 --- a/lib/compat.c +++ b/lib/compat.c @@ -54,7 +54,41 @@ 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 + +#ifndef HAVE_STRPBRK +/* Find the first ocurrence in S of any character in ACCEPT. + derived from glibc +*/ +char *strpbrk(const char *s, const char *accept) +{ + while (*s != '\0') { + const char *a = accept; + while (*a != '\0') { + if (*a++ == *s) return (char *)s; + } + ++s; + } + + 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