diff options
-rw-r--r-- | cpukit/shttpd/defs.h | 11 | ||||
-rw-r--r-- | cpukit/shttpd/string.c | 4 |
2 files changed, 15 insertions, 0 deletions
diff --git a/cpukit/shttpd/defs.h b/cpukit/shttpd/defs.h index cca0057809..1f0c81b743 100644 --- a/cpukit/shttpd/defs.h +++ b/cpukit/shttpd/defs.h @@ -377,8 +377,19 @@ extern void log_access(FILE *fp, const struct conn *c); extern void my_strlcpy(register char *, register const char *, size_t); extern int my_strncasecmp(register const char *, register const char *, size_t); +#ifndef HAVE_STRNDUP extern char *my_strndup(const char *ptr, size_t len); +#else +#include <string.h> +#define my_strndup(x,l) strndup((x),(l)) +#endif + +#ifndef HAVE_STRDUP extern char *my_strdup(const char *str); +#else +#include <string.h> +#define my_strdup(x) strdup(x) +#endif extern int my_snprintf(char *buf, size_t buflen, const char *fmt, ...); /* diff --git a/cpukit/shttpd/string.c b/cpukit/shttpd/string.c index f1b3645bac..8e9023cf31 100644 --- a/cpukit/shttpd/string.c +++ b/cpukit/shttpd/string.c @@ -32,6 +32,7 @@ my_strncasecmp(const char *str1, const char *str2, size_t len) return (ret); } +#ifndef HAVE_STRNDUP char * my_strndup(const char *ptr, size_t len) { @@ -43,12 +44,15 @@ my_strndup(const char *ptr, size_t len) return (p); } +#endif +#ifndef HAVE_STRDUP char * my_strdup(const char *str) { return (my_strndup(str, strlen(str))); } +#endif /* * Sane snprintf(). Acts like snprintf(), but never return -1 or the |