* modules/memmem-tests (configure.ac): Check for alarm.
* tests/test-memmem.c (main): Avoid alarm on platforms that lack
it.
* doc/functions/memmem.texi: New file.
* doc/gnulib.texi (Function Substitutes): Add memmem.
Reported by Bruno Haible.
Signed-off-by: Eric Blake <ebb9@byu.net>
+2008-01-05 Eric Blake <ebb9@byu.net>
+
+ Fix memmem test for mingw.
+ * modules/memmem-tests (configure.ac): Check for alarm.
+ * tests/test-memmem.c (main): Avoid alarm on platforms that lack
+ it.
+ * doc/functions/memmem.texi: New file.
+ * doc/gnulib.texi (Function Substitutes): Add memmem.
+ Reported by Bruno Haible.
+
2008-01-04 Bruno Haible <bruno@clisp.org>
* m4/strcase.m4 (gl_FUNC_STRCASECMP, gl_FUNC_STRNCASECMP):
--- /dev/null
+@node memmem
+@section @code{memmem}
+@findex memmem
+
+Unspecified by POSIX, but comparable to @code{strstr}.
+
+Gnulib module: memmem
+
+Portability problems fixed by Gnulib:
+@itemize
+@item
+This function fails to return the start of the haystack for an empty
+needle on some platforms:
+Cygwin 1.5.x
+
+@item
+This function has quadratic instead of linear complexity on some
+platforms:
+glibc <= 2.6.1
+
+@item
+This function is missing on some platforms:
+Mingw, OpenBSD 4.0
+@end itemize
+
+Portability problems not fixed by Gnulib:
+@itemize
+@end itemize
which is a library of common routines intended to be shared at the
source level.
-Copyright @copyright{} 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+Copyright @copyright{} 2004, 2005, 2006, 2007, 2008 Free Software
+Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1 or
* memchr::
* memcmp::
* memcpy::
+* memmem::
* memmove::
* memset::
* mkdir::
Depends-on:
configure.ac:
+AC_CHECK_DECLS_ONCE([alarm])
Makefile.am:
TESTS += test-memmem
int
main (int argc, char *argv[])
{
+#if HAVE_DECL_ALARM
/* Declare failure if test takes too long, by using default abort
- caused by SIGALRM. */
+ caused by SIGALRM. All known platforms that lack alarm also lack
+ memmem, and the replacement memmem is known to not take too
+ long. */
alarm (10);
+#endif
+
{
const char input[] = "foo";
const char *result = memmem (input, strlen (input), "", 0);