2007-07-21 James Youngman
Version banners now comply with the GNU coding standard.
* find/parser.c (parse_version): Use display_findutils_version()
instead of printing the information manually. Don't include
gnulib-version.h since we no longer directly use that header.
* lib/findutils-version.c: Added
* lib/findutils-version.h: Added
* import-gnulib.config (modules): Added version-etc and
version-etc-fsf.
* lib/Makefile.am (libfind_a_SOURCES): added findutils-version.c.
* find/version.c: Removed
* find/Makefile.am: Remove version.c
* locate/Makefile.am: Don't link ../find/version.o
* xargs/Makefile.am: Ditto
* xargs/xargs.c (main): Use display_findutils_version()
* locate/code.c (main): Ditto
* locate/frcode.c (main): Ditto
* locate/locate.c (dolocate): Ditto
* locate/updatedb.sh (version): Display copyright information in
the right format. Also ensure that we exit with a nonzero status
if there was an output error for --help and --version.
* find/testsuite/config/unix.exp (find_version): Adjust for
--version format change
* locate/testsuite/config/unix.exp (locate_version): Ditto
* xargs/testsuite/config/unix.exp (xargs_version): Ditto
* NEWS: Mention the change
Index: NEWS
===================================================================
RCS file: /sources/findutils/findutils/NEWS,v
retrieving revision 1.195
diff -u -p -r1.195 NEWS
--- NEWS 18 Jul 2007 03:40:46 -0000 1.195
+++ NEWS 22 Jul 2007 12:57:03 -0000
@@ -22,6 +22,10 @@ example, with the -E option), and stdin
correctly restores the file position, even on platforms where exit()
does not follow the POSIX rules of doing likewise.
+#20547: The version information printed by find, xargs, locate,
+updatedb, frcode and code now complies with the GNU Project's coding
+standards.
+
** Documentation Fixes
Point out more explicitly that the subsecond timestamp support
Index: import-gnulib.config
===================================================================
RCS file: /sources/findutils/findutils/import-gnulib.config,v
retrieving revision 1.22
diff -u -p -r1.22 import-gnulib.config
--- import-gnulib.config 14 Jul 2007 13:35:39 -0000 1.22
+++ import-gnulib.config 22 Jul 2007 12:57:03 -0000
@@ -79,6 +79,8 @@ strtoumax
sys_stat
timespec
verify
+version-etc
+version-etc-fsf
wcwidth
xalloc
xalloc-die
Index: find/Makefile.am
===================================================================
RCS file: /sources/findutils/findutils/find/Makefile.am,v
retrieving revision 1.14
diff -u -p -r1.14 Makefile.am
--- find/Makefile.am 28 Jun 2007 17:20:39 -0000 1.14
+++ find/Makefile.am 22 Jul 2007 12:57:03 -0000
@@ -4,7 +4,7 @@ localedir = $(datadir)/locale
# regexprops_SOURCES = regexprops.c
noinst_LIBRARIES = libfindtools.a
-libfindtools_a_SOURCES = finddata.c fstype.c parser.c pred.c tree.c util.c version.c
+libfindtools_a_SOURCES = finddata.c fstype.c parser.c pred.c tree.c util.c
# We always build two versions of find, one with fts, one without.
Index: find/parser.c
===================================================================
RCS file: /sources/findutils/findutils/find/parser.c,v
retrieving revision 1.129
diff -u -p -r1.129 parser.c
--- find/parser.c 2 Jul 2007 08:57:59 -0000 1.129
+++ find/parser.c 22 Jul 2007 12:57:04 -0000
@@ -41,7 +41,7 @@
#include "fts_.h"
#include "getdate.h"
#include "error.h"
-#include "gnulib-version.h"
+#include "findutils-version.h"
#include
@@ -2356,9 +2356,7 @@ parse_version (const struct parser_table
(void) arg_ptr;
(void) entry;
- fflush (stderr);
- printf (_("GNU find version %s\n"), version_string);
- printf (_("Built using GNU gnulib version %s\n"), gnulib_version);
+ display_findutils_version("find");
printf (_("Features enabled: "));
#if CACHE_IDS
Index: find/testsuite/config/unix.exp
===================================================================
RCS file: /sources/findutils/findutils/find/testsuite/config/unix.exp,v
retrieving revision 1.25
diff -u -p -r1.25 unix.exp
--- find/testsuite/config/unix.exp 2 Jul 2007 08:25:43 -0000 1.25
+++ find/testsuite/config/unix.exp 22 Jul 2007 12:57:04 -0000
@@ -75,13 +75,8 @@ proc find_version {} {
global FINDFLAGS
if {[which $FTSFIND] != 0} then {
- set tmp [ eval exec $FTSFIND $FINDFLAGS --version .
+*/
+
+#include
+#include "stdio-safer.h"
+#include "version-etc.h"
+#include "gnulib-version.h"
+
+
+
+#if ENABLE_NLS
+# include
+# define _(Text) gettext (Text)
+#else
+# define _(Text) Text
+#endif
+#ifdef gettext_noop
+# define N_(String) gettext_noop (String)
+#else
+/* See locate.c for explanation as to why not use (String) */
+# define N_(String) String
+#endif
+
+
+
+#ifdef _LIBC
+/* In the GNU C library, there is a predefined variable for this. */
+# define program_name program_invocation_name
+#endif
+
+
+extern char *program_name;
+char *version_string = VERSION;
+
+
+void
+display_findutils_version(const char *official_name)
+{
+ /* We use official_name rather than program name in the version
+ * information. This is deliberate, it is specified by the
+ * GNU coding standard.
+ */
+ fflush (stderr);
+ version_etc(stdout,
+ official_name, PACKAGE_NAME, version_string,
+ _("Eric B. Decker"),
+ _("James Youngman"),
+ _("Kevin Dalley"),
+ (const char*) NULL);
+ printf (_("Built using GNU gnulib version %s\n"), gnulib_version);
+}
Index: lib/findutils-version.h
===================================================================
RCS file: lib/findutils-version.h
diff -N lib/findutils-version.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lib/findutils-version.h 22 Jul 2007 12:57:04 -0000
@@ -0,0 +1,28 @@
+/* findutils-version.h -- show version information for findutils
+ Copyright (C) 2007 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 3 of the License, 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, see .
+*/
+
+/*
+ * display_findutils_version displays GNU coding standard compliant
+ * version information.
+ *
+ * official_name Official name of the program, for example
+ * "find" or "xargs" (as opposed to "/bin/find"
+ * or gfind).
+ *
+ */
+void display_findutils_version(const char *official_name);
+
Index: locate/Makefile.am
===================================================================
RCS file: /sources/findutils/findutils/locate/Makefile.am,v
retrieving revision 1.22
diff -u -p -r1.22 Makefile.am
--- locate/Makefile.am 18 Jul 2007 03:40:47 -0000 1.22
+++ locate/Makefile.am 22 Jul 2007 12:57:04 -0000
@@ -19,9 +19,9 @@ code_SOURCES = code.c word_io.c
INCLUDES = -I$(top_srcdir)/lib -I../gnulib/lib -I$(top_srcdir)/gnulib/lib -I../intl -DLOCATE_DB=\"$(LOCATE_DB)\" -DLOCALEDIR=\"$(localedir)\"
-LDADD = ../find/version.o ../lib/libfind.a ../gnulib/lib/libgnulib.a @INTLLIBS@
+LDADD = ../lib/libfind.a ../gnulib/lib/libgnulib.a @INTLLIBS@
-$(PROGRAMS) $(LIBPROGRAMS): ../find/version.o ../lib/libfind.a ../gnulib/lib/libgnulib.a
+$(PROGRAMS) $(LIBPROGRAMS): ../lib/libfind.a ../gnulib/lib/libgnulib.a
updatedb: updatedb.sh
rm -f $@
@@ -34,6 +34,7 @@ updatedb: updatedb.sh
-e "s,@""libexecdir""@,$(libexecdir)," \
-e "s,@""LOCATE_DB""@,$(LOCATE_DB)," \
-e "s,@""VERSION""@,@VERSION@," \
+ -e "s,@""PACKAGE_NAME""@,@PACKAGE_NAME@," \
-e "s,@""find""@,$${find}," \
-e "s,@""frcode""@,$${frcode}," \
-e "s,@""bigram""@,$${bigram}," \
Index: locate/code.c
===================================================================
RCS file: /sources/findutils/findutils/locate/code.c,v
retrieving revision 1.23
diff -u -p -r1.23 code.c
--- locate/code.c 2 Jul 2007 08:25:44 -0000 1.23
+++ locate/code.c 22 Jul 2007 12:57:04 -0000
@@ -185,8 +185,7 @@ main (int argc, char **argv)
}
else if (0 == strcmp(argv[1], "--version"))
{
- printf (_("GNU findutils version %s\n"), version_string);
- printf (_("Built using GNU gnulib version %s\n"), gnulib_version);
+ display_findutils_version("code");
return 0;
}
Index: locate/frcode.c
===================================================================
RCS file: /sources/findutils/findutils/locate/frcode.c,v
retrieving revision 1.22
diff -u -p -r1.22 frcode.c
--- locate/frcode.c 2 Jul 2007 08:25:44 -0000 1.22
+++ locate/frcode.c 22 Jul 2007 12:57:04 -0000
@@ -109,6 +109,7 @@
#include
#include "error.h"
#include "closeout.h"
+#include "findutils-version.h"
char *xmalloc PARAMS((size_t));
@@ -265,7 +266,7 @@ main (int argc, char **argv)
return 0;
case 'v':
- printf (_("GNU locate version %s\n"), version_string);
+ display_findutils_version("frcode");
return 0;
default:
Index: locate/locate.c
===================================================================
RCS file: /sources/findutils/findutils/locate/locate.c,v
retrieving revision 1.87
diff -u -p -r1.87 locate.c
--- locate/locate.c 2 Jul 2007 08:57:59 -0000 1.87
+++ locate/locate.c 22 Jul 2007 12:57:05 -0000
@@ -130,7 +130,7 @@
#include "quotearg.h"
#include "printquoted.h"
#include "regextype.h"
-#include "gnulib-version.h"
+#include "findutils-version.h"
/* Note that this evaluates Ch many times. */
#ifdef _LIBC
@@ -1659,8 +1659,7 @@ dolocate (int argc, char **argv, int sec
break;
case 'v':
- printf (_("GNU locate version %s\n"), version_string);
- printf (_("Built using GNU gnulib version %s\n"), gnulib_version);
+ display_findutils_version("locate");
return 0;
case 'w':
Index: locate/updatedb.sh
===================================================================
RCS file: /sources/findutils/findutils/locate/updatedb.sh,v
retrieving revision 1.40
diff -u -p -r1.40 updatedb.sh
--- locate/updatedb.sh 2 Jul 2007 08:25:44 -0000 1.40
+++ locate/updatedb.sh 22 Jul 2007 12:57:05 -0000
@@ -21,6 +21,17 @@
#exec 2> /tmp/updatedb-trace.txt
#set -x
+version='
+updatedb (@PACKAGE_NAME@) @VERSION@
+Copyright (C) 2007 Free Software Foundation, Inc.
+License GPLv3+: GNU GPL version 3 or later
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law.
+
+Written by Eric B. Decker, James Youngman, and Kevin Dalley.
+'
+
+
usage="\
Usage: $0 [--findoptions='-option1 -option2...']
[--localpaths='dir1 dir2...'] [--netpaths='dir1 dir2...']
@@ -51,8 +62,8 @@ do
--old-format) old=yes ;;
--changecwd) changeto="$val" ;;
--dbformat) dbformat="$val" ;;
- --version) echo "GNU updatedb version @VERSION@"; exit 0 ;;
- --help) echo "$usage"; exit 0 ;;
+ --version) fail=0; echo "$version" || fail=1; exit $fail ;;
+ --help) fail=0; echo "$usage" || fail=1; exit $fail ;;
*) echo "updatedb: invalid option $opt
$usage" >&2
exit 1 ;;
Index: locate/testsuite/config/unix.exp
===================================================================
RCS file: /sources/findutils/findutils/locate/testsuite/config/unix.exp,v
retrieving revision 1.23
diff -u -p -r1.23 unix.exp
--- locate/testsuite/config/unix.exp 2 Jul 2007 08:25:44 -0000 1.23
+++ locate/testsuite/config/unix.exp 22 Jul 2007 12:57:05 -0000
@@ -88,13 +88,8 @@ proc locate_version {} {
global LOCATEFLAGS
if {[which $LOCATE] != 0} then {
- set tmp [ eval exec $LOCATE $LOCATEFLAGS --version