summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog16
-rw-r--r--NEWS2
-rw-r--r--lib/rpmatch.c7
-rw-r--r--lib/stdlib.in.h15
-rw-r--r--m4/rpmatch.m47
-rw-r--r--m4/stdlib_h.m44
-rw-r--r--modules/rpmatch4
-rw-r--r--modules/stdlib2
8 files changed, 51 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 719eaea37d..6ff3a3a69d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,21 @@
2008-04-28 Bruno Haible <bruno@clisp.org>
+ Declare rpmatch.
+ * lib/stdlib.in.h (rpmatch): New declaration.
+ * lib/rpmatch.c: Include <stdlib.h> first.
+ * m4/rpmatch.m4 (gl_FUNC_RPMATCH): Require AC_USE_SYSTEM_EXTENSIONS and
+ gl_STDLIB_H_DEFAULTS. Set HAVE_RPMATCH.
+ * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize GNULIB_RPMATCH,
+ HAVE_RPMATCH.
+ * modules/rpmatch (Depends-on): Add stdlib, extensions.
+ (configure.ac): Invoke gl_STDLIB_MODULE_INDICATOR.
+ (Include): Set to <stdlib.h>.
+ * modules/stdlib (Makefile.am): Substitute GNULIB_RPMATCH and
+ HAVE_RPMATCH.
+ * NEWS: Document the change.
+
+2008-04-28 Bruno Haible <bruno@clisp.org>
+
Change rpmatch to use nl_langinfo when appropriate.
* lib/rpmatch.c: Include stdbool.h, string.h, langinfo.h.
(N_): New macro.
diff --git a/NEWS b/NEWS
index 95ca64ac91..4a9b5dcfd6 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,8 @@ User visible incompatible changes
Date Modules Changes
+2008-04-28 rpmatch The include file is now <stdlib.h>.
+
2008-03-06 freadahead The return value's computation has changed. It
now increases by 1 after ungetc.
diff --git a/lib/rpmatch.c b/lib/rpmatch.c
index 68c7442979..217e1710a2 100644
--- a/lib/rpmatch.c
+++ b/lib/rpmatch.c
@@ -19,9 +19,11 @@
#include <config.h>
+/* Specification. */
+#include <stdlib.h>
+
#include <stdbool.h>
#include <stddef.h>
-#include <stdlib.h>
#if ENABLE_NLS
# include <sys/types.h>
@@ -118,9 +120,6 @@ try (const char *response, const char *pattern, char **lastp, regex_t *re)
#endif
-/* Test a user response to a question.
- Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */
-
int
rpmatch (const char *response)
{
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index 0181dd2376..b0fb12fcbc 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -176,6 +176,21 @@ extern int putenv (char *string);
#endif
+#if @GNULIB_RPMATCH@
+# if !@HAVE_RPMATCH@
+/* Test a user response to a question.
+ Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */
+extern int rpmatch (const char *response);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef rpmatch
+# define rpmatch(r) \
+ (GL_LINK_WARNING ("rpmatch is unportable - " \
+ "use gnulib module rpmatch for portability"), \
+ rpmatch (r))
+#endif
+
+
#if @GNULIB_SETENV@
# if !@HAVE_SETENV@
/* Set NAME to VALUE in the environment.
diff --git a/m4/rpmatch.m4 b/m4/rpmatch.m4
index e0f36a3d40..e4c986d8ec 100644
--- a/m4/rpmatch.m4
+++ b/m4/rpmatch.m4
@@ -1,4 +1,4 @@
-# rpmatch.m4 serial 6
+# rpmatch.m4 serial 7
dnl Copyright (C) 2002-2003, 2007-2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -6,8 +6,13 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_RPMATCH],
[
+ dnl Persuade glibc <stdlib.h> to declare rpmatch().
+ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+ AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
AC_REPLACE_FUNCS(rpmatch)
if test $ac_cv_func_rpmatch = no; then
+ HAVE_RPMATCH=0
gl_PREREQ_RPMATCH
fi
])
diff --git a/m4/stdlib_h.m4 b/m4/stdlib_h.m4
index d9240b46a0..95e679f797 100644
--- a/m4/stdlib_h.m4
+++ b/m4/stdlib_h.m4
@@ -1,4 +1,4 @@
-# stdlib_h.m4 serial 6
+# stdlib_h.m4 serial 7
dnl Copyright (C) 2007, 2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -26,6 +26,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP])
GNULIB_MKSTEMP=0; AC_SUBST([GNULIB_MKSTEMP])
GNULIB_PUTENV=0; AC_SUBST([GNULIB_PUTENV])
+ GNULIB_RPMATCH=0; AC_SUBST([GNULIB_RPMATCH])
GNULIB_SETENV=0; AC_SUBST([GNULIB_SETENV])
GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD])
GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV])
@@ -35,6 +36,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
HAVE_MALLOC_POSIX=1; AC_SUBST([HAVE_MALLOC_POSIX])
HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP])
HAVE_REALLOC_POSIX=1; AC_SUBST([HAVE_REALLOC_POSIX])
+ HAVE_RPMATCH=1; AC_SUBST([HAVE_RPMATCH])
HAVE_SETENV=1; AC_SUBST([HAVE_SETENV])
HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD])
HAVE_UNSETENV=1; AC_SUBST([HAVE_UNSETENV])
diff --git a/modules/rpmatch b/modules/rpmatch
index 5b226b0379..e11f92cd09 100644
--- a/modules/rpmatch
+++ b/modules/rpmatch
@@ -6,16 +6,20 @@ lib/rpmatch.c
m4/rpmatch.m4
Depends-on:
+stdlib
+extensions
stdbool
gettext-h
regex
configure.ac:
gl_FUNC_RPMATCH
+gl_STDLIB_MODULE_INDICATOR([rpmatch])
Makefile.am:
Include:
+<stdlib.h>
License:
GPL
diff --git a/modules/stdlib b/modules/stdlib
index b1195301ce..f7643cedf1 100644
--- a/modules/stdlib
+++ b/modules/stdlib
@@ -30,6 +30,7 @@ stdlib.h: stdlib.in.h
-e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \
-e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \
-e 's|@''GNULIB_PUTENV''@|$(GNULIB_PUTENV)|g' \
+ -e 's|@''GNULIB_RPMATCH''@|$(GNULIB_RPMATCH)|g' \
-e 's|@''GNULIB_SETENV''@|$(GNULIB_SETENV)|g' \
-e 's|@''GNULIB_STRTOD''@|$(GNULIB_STRTOD)|g' \
-e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \
@@ -38,6 +39,7 @@ stdlib.h: stdlib.in.h
-e 's|@''HAVE_MALLOC_POSIX''@|$(HAVE_MALLOC_POSIX)|g' \
-e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \
-e 's|@''HAVE_REALLOC_POSIX''@|$(HAVE_REALLOC_POSIX)|g' \
+ -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \
-e 's|@''HAVE_SETENV''@|$(HAVE_SETENV)|g' \
-e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \
-e 's|@''HAVE_UNSETENV''@|$(HAVE_UNSETENV)|g' \