From: cpickett Date: Sun, 28 Dec 2008 23:38:12 +0000 (+0000) Subject: * add strdup.c to lib/ (there are problems on mingw with strdup) X-Git-Tag: 0.10.0~687 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=eec5c36ee9dda03538c7c2aef9580fea526fe330;p=check * add strdup.c to lib/ (there are problems on mingw with strdup) git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@475 64e312b2-a51f-0410-8e61-82d0ca0eb02a --- diff --git a/configure.ac b/configure.ac index 6aca9b0..b61fa56 100644 --- a/configure.ac +++ b/configure.ac @@ -120,8 +120,8 @@ AC_FUNC_MALLOC AC_FUNC_REALLOC AC_FUNC_STRFTIME AC_FUNC_VPRINTF -AC_CHECK_FUNCS([alarm gettimeofday localtime_r memmove memset putenv setenv strdup strerror strrchr strstr]) -AC_REPLACE_FUNCS([sleep strsignal]) +AC_CHECK_FUNCS([alarm gettimeofday localtime_r memmove memset putenv setenv strerror strrchr strstr]) +AC_REPLACE_FUNCS([sleep strdup strsignal]) # Output files AC_CONFIG_HEADERS([config.h]) diff --git a/lib/libcompat.h b/lib/libcompat.h index 10eb9b4..f57dfa0 100644 --- a/lib/libcompat.h +++ b/lib/libcompat.h @@ -19,6 +19,10 @@ void *rpl_realloc (void *p, size_t n) unsigned int sleep (unsigned int seconds); #endif /* !HAVE_SLEEP */ +#if !HAVE_STRDUP +char *strdup (const char *str) +#endif /* !HAVE_STRDUP */ + #if !HAVE_STRSIGNAL const char *strsignal(int sig); #endif /* !HAVE_STRSIGNAL */ diff --git a/lib/strdup.c b/lib/strdup.c new file mode 100644 index 0000000..3db2cda --- /dev/null +++ b/lib/strdup.c @@ -0,0 +1,13 @@ +/* This file gets included if AC_REPLACE_FUNCS([strdup]) cannot + find the function. */ + +#include "libcompat.h" +#include + +/* Note that Gnulib has a much more advanced version of strdup */ +char * +strdup (const char *str) +{ + /* FIXME: obviously this is broken */ + return NULL; +}