/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
+/* Define to 1 if you have the `memrchr' function. */
+#undef HAVE_MEMRCHR
+
/* Define to 1 if you have the `mkdirat' function. */
#undef HAVE_MKDIRAT
int strcasecmp(char *s1, char *s2);
#endif
+#ifndef HAVE_MEMRCHR
+void *memrchr(const void *s, int c, size_t n);
+#endif
+
#ifndef HAVE_STRSEP
char *strsep(char **stringp, char const *delim);
#endif
}
#endif
+
+#ifndef HAVE_MEMRCHR
+/** GNU libc extension on some platforms
+ *
+ */
+void *memrchr(void const *s, int c, size_t n)
+{
+ uint8_t *p;
+
+ if (n == 0) return NULL;
+
+ memcpy(&p, &s, sizeof(p)); /* defeat const */
+ for (p += (n - 1); p >= (uint8_t const *)s; p--) if (*p == (uint8_t)c) return (void *)p;
+
+ return NULL;
+}
+#endif
+
#ifndef HAVE_INET_ATON
int inet_aton(char const *cp, struct in_addr *inp)
{
return NULL; /* don't support IPv6 */
}
#endif
-