* modules/string (Makefile.am): Add new hooks.
* modules/strverscmp (Files): Remove strverscmp.h.
(Depends-on): Add string.
(configure.ac): Add indicator.
(Include): Mention new header.
* m4/string_h.m4 (gl_HEADER_STRING_H_DEFAULTS): Provide new
defaults.
* m4/strverscmp.m4 (gl_FUNC_STRVERSCMP): Inform string module of
results.
* lib/strverscmp.h: Delete.
* lib/string.in.h (strverscmp): Provide declaration, when needed.
* tests/test-strverscmp.c (includes): Adjust client.
* lib/check-version.c (includes): Likewise.
* NEWS: Document the change.
Signed-off-by: Eric Blake <ebb9@byu.net>
2008-08-19 Eric Blake <ebb9@byu.net>
+ strverscmp: migrate from "strverscmp.h" to <string.h>
+ * modules/string (Makefile.am): Add new hooks.
+ * modules/strverscmp (Files): Remove strverscmp.h.
+ (Depends-on): Add string.
+ (configure.ac): Add indicator.
+ (Include): Mention new header.
+ * m4/string_h.m4 (gl_HEADER_STRING_H_DEFAULTS): Provide new
+ defaults.
+ * m4/strverscmp.m4 (gl_FUNC_STRVERSCMP): Inform string module of
+ results.
+ * lib/strverscmp.h: Delete.
+ * lib/string.in.h (strverscmp): Provide declaration, when needed.
+ * tests/test-strverscmp.c (includes): Adjust client.
+ * lib/check-version.c (includes): Likewise.
+ * NEWS: Document the change.
+
strverscmp: add unit test
* modules/strverscmp-tests: New file.
* tests/test-strverscmp.c: Likewise.
Date Modules Changes
+2008-08-19 strverscmp The include file is changed from "strverscmp.h"
+ to <string.h>.
+
2008-08-14 lock The include file is changed from "lock.h"
to "glthread/lock.h".
tls The include file is changed from "tls.h"
/* check-version.h --- Check version string compatibility.
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free
- Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2008 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include <config.h>
#include <stddef.h>
-#include <strverscmp.h>
+#include <string.h>
/* Get specification. */
#include "check-version.h"
strsignal (a))
#endif
+#if @GNULIB_STRVERSCMP@
+# if !@HAVE_STRVERSCMP@
+extern int strverscmp (const char *, const char *);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strverscmp
+# define strverscmp(a, b) \
+ (GL_LINK_WARNING ("strverscmp is unportable - " \
+ "use gnulib module strverscmp for portability"), \
+ strverscmp (a, b))
+#endif
+
#ifdef __cplusplus
}
+++ /dev/null
-/* Compare strings while treating digits characters numerically.
-
- Copyright (C) 1997, 2003 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef STRVERSCMP_H_
-# define STRVERSCMP_H_
-
-int strverscmp (const char *, const char *);
-
-#endif /* not STRVERSCMP_H_ */
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 4
+# serial 5
# Written by Paul Eggert.
GNULIB_MBSTOK_R=0; AC_SUBST([GNULIB_MBSTOK_R])
GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR])
GNULIB_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL])
+ GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM])
HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY])
HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R])
HAVE_DECL_STRERROR=1; AC_SUBST([HAVE_DECL_STRERROR])
HAVE_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL])
+ HAVE_STRVERSCMP=1; AC_SUBST([HAVE_STRVERSCMP])
REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR])
REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL])
REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM])
-# strverscmp.m4 serial 5
-dnl Copyright (C) 2002, 2005, 2006, 2007 Free Software Foundation, Inc.
+# strverscmp.m4 serial 6
+dnl Copyright (C) 2002, 2005, 2006, 2007, 2008 Free Software
+dnl Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl Persuade glibc <string.h> to declare strverscmp().
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+ AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
AC_REPLACE_FUNCS(strverscmp)
if test $ac_cv_func_strverscmp = no; then
gl_PREREQ_STRVERSCMP
+ HAVE_STRVERSCMP=0
fi
])
-e 's|@''GNULIB_STRTOK_R''@|$(GNULIB_STRTOK_R)|g' \
-e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \
-e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \
+ -e 's|@''GNULIB_STRVERSCMP''@|$(GNULIB_STRVERSCMP)|g' \
-e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
-e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
-e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
-e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \
-e 's|@''HAVE_DECL_STRERROR''@|$(HAVE_DECL_STRERROR)|g' \
-e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \
+ -e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \
-e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \
-e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \
-e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \
Compare strings holding version numbers.
Files:
-lib/strverscmp.h
lib/strverscmp.c
m4/strverscmp.m4
Depends-on:
extensions
+string
configure.ac:
gl_FUNC_STRVERSCMP
+gl_STRING_MODULE_INDICATOR([strverscmp])
Makefile.am:
Include:
-"strverscmp.h"
+<string.h>
License:
LGPLv2+
#include <config.h>
-#include "strverscmp.h"
+#include <string.h>
#include <stdio.h>
#include <stdlib.h>