+2011-04-16 Bruno Haible <bruno@clisp.org>
+
+ strchrnul: Tweak last commit.
+ * doc/glibc-functions/strchrnul.texi: Add more details about Cygwin
+ bug.
+ * lib/string.in.h (strchrnul): Use same arguments in _GL_FUNCDECL_RPL
+ as in _GL_FUNCDECL_SYS.
+ * m4/strchrnul.m4 (gl_FUNC_STRCHRNUL): Invoke gl_PREREQ_STRCHRNUL after
+ AC_LIBOBJ. When cross-compiling, say "guessing yes" not "yes".
+
2011-04-15 Eric Blake <eblake@redhat.com>
strchrnul: work around cygwin bug
IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.7.8, mingw, Interix 3.5,
BeOS.
@item
-This function is broken on some platforms:
+This function crashes when no occurrence is found on some platforms:
Cygwin 1.7.9.
@end itemize
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define strchrnul rpl_strchrnul
# endif
-_GL_FUNCDECL_RPL (strchrnul, char *,
- (const char *str, int ch)
- _GL_ATTRIBUTE_PURE
- _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_RPL (strchrnul, char *, (const char *__s, int __c_in)
+ _GL_ATTRIBUTE_PURE
+ _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (strchrnul, char *,
(const char *str, int ch));
# else
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
- AC_REPLACE_FUNCS([strchrnul])
+ AC_CHECK_FUNCS([strchrnul])
if test $ac_cv_func_strchrnul = no; then
HAVE_STRCHRNUL=0
- gl_PREREQ_STRCHRNUL
else
AC_CACHE_CHECK([whether strchrnul works],
[gl_cv_func_strchrnul_works],
[AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <string.h> /* for strchrnul */
]], [[const char *buf = "a";
- return strchrnul(buf, 'b') != buf + 1;
+ return strchrnul (buf, 'b') != buf + 1;
]])],
[gl_cv_func_strchrnul_works=yes],
[gl_cv_func_strchrnul_works=no],
Lucky user
#endif
],
- [gl_cv_func_strchrnul_works=yes],
+ [gl_cv_func_strchrnul_works="guessing yes"],
[gl_cv_func_strchrnul_works="guessing no"])
])
])
- if test "$gl_cv_func_strchrnul_works" != yes; then
- REPLACE_STRCHRNUL=1
- AC_LIBOBJ([strchrnul])
- fi
+ case "$gl_cv_func_strchrnul_works" in
+ *yes) ;;
+ *) REPLACE_STRCHRNUL=1 ;;
+ esac
+ fi
+ if test $HAVE_STRCHRNUL = 0 || test $REPLACE_STRCHRNUL = 1; then
+ AC_LIBOBJ([strchrnul])
+ gl_PREREQ_STRCHRNUL
fi
])