* configure.ac (PACKAGE_BUGREPORT_URL): Define this macro to point to the findutils bug-reporting web page. * lib/bugreports.c: New file, defining the function explain_how_to_report_bugs which explains how to report bugs. Use the new PACKAGE_BUGREPORT_URL macro. * lib/bugreports.h: New file, providing a declaration of explain_how_to_report_bugs. * lib/Makefile.am (libfind_a_SOURCES): Add bugreports.c and bugreports.h. * find/parser.c (parse_help): Call explain_how_to_report_bugs instead of printing an explanation here. * xargs/xargs.c (usage): Likewise. * locate/locate.c (usage): Likewise. * locate/code.c (usage): Likewise. * locate/frcode.c (usage): Likewise. * locate/updatedb.sh (usage): Produce a similar message by including it in the usage text itself. --- configure.ac | 7 +++++++ find/parser.c | 7 +++---- lib/Makefile.am | 4 +++- lib/bugreports.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ lib/bugreports.h | 29 +++++++++++++++++++++++++++++ locate/code.c | 3 ++- locate/frcode.c | 3 ++- locate/locate.c | 3 ++- locate/updatedb.sh | 10 ++++++++-- xargs/xargs.c | 6 +++--- 10 files changed, 103 insertions(+), 13 deletions(-) create mode 100644 lib/bugreports.c create mode 100644 lib/bugreports.h
diff --git a/configure.ac b/configure.ac index 6c80d3a..0a60a26 100644 --- a/configure.ac +++ b/configure.ac @@ -20,6 +20,13 @@ dnl Written by James Youngman. dnl Process this file with autoconf to produce a configure script. AC_INIT([GNU findutils], 4.7.0-git, [bug-findutils@gnu.org]) +dnl The call to AC_INIT causes AC_PACKAGE_BUGREPORT to be defined +dnl and we've used an email address. However, we would also like to +dnl specify at URL at which to report bugs (and in fact we prefer +dnl people to use that). Se we define that here, too. +AC_DEFINE([PACKAGE_BUGREPORT_URL], + ["https://savannah.gnu.org/bugs/?group=findutils"], + [URL at which bugs should be reported]) AC_CONFIG_AUX_DIR(build-aux) AM_INIT_AUTOMAKE diff --git a/find/parser.c b/find/parser.c index 4c1a2ed..54fee03 100644 --- a/find/parser.c +++ b/find/parser.c @@ -41,6 +41,7 @@ #include "mountlist.h" #include "parse-datetime.h" #include "print.h" +#include "progname.h" #include "quotearg.h" #include "regextype.h" #include "safe-atoi.h" @@ -64,11 +65,11 @@ #include "buildcmd.h" #include "defs.h" #include "fdleak.h" +#include "bugreports.h" #include "findutils-version.h" - #if ENABLE_NLS # include <libintl.h> # define _(Text) gettext (Text) @@ -1263,9 +1264,7 @@ actions: -delete -print0 -printf FORMAT -fprintf FILE FORMAT -print \n\ -exec COMMAND ; -exec COMMAND {} + -ok COMMAND ;\n\ -execdir COMMAND ; -execdir COMMAND {} + -okdir COMMAND ;\n\ ")); - puts (_("Report (and track progress on fixing) bugs via the findutils bug-reporting\n\ -page at http://savannah.gnu.org/ or, if you have no web access, by sending\n\ -email to <bug-findutils@gnu.org>.")); + explain_how_to_report_bugs (stdout, program_name); exit (EXIT_SUCCESS); } diff --git a/lib/Makefile.am b/lib/Makefile.am index 0863bec..a1d67b2 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -39,7 +39,9 @@ libfind_a_SOURCES = \ safe-atoi.c \ safe-atoi.h \ splitstring.c \ - splitstring.h + splitstring.h \ + bugreports.c \ + bugreports.h EXTRA_DIST = unused-result.h check-regexprops.sh SUFFIXES = diff --git a/lib/bugreports.c b/lib/bugreports.c new file mode 100644 index 0000000..e9f0136 --- /dev/null +++ b/lib/bugreports.c @@ -0,0 +1,44 @@ +/* bugreports.h -- explain how to report bugs + Copyright (C) 2016 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 <http://www.gnu.org/licenses/>. +*/ +/* Written by James Youngman <j...@gnu.org>. + */ +#include <config.h> +#include <stdio.h> +#include "bugreports.h" + +#if ENABLE_NLS +# include <libintl.h> +# define _(Text) gettext (Text) +#else +# define _(Text) Text +#endif + +int +explain_how_to_report_bugs (FILE *f, const char *program_name) +{ + return fprintf (f,_("\ +Please see also the documentation at %s.\n\ +You can report (and track progress on fixing) bugs in the \"%s\"\n\ +program via the %s bug-reporting page at\n\ +%s or, if\n\ +you have no web access, by sending email to <%s>.\n"), + PACKAGE_URL, + program_name, + PACKAGE_NAME, + PACKAGE_BUGREPORT_URL, + PACKAGE_BUGREPORT); +} diff --git a/lib/bugreports.h b/lib/bugreports.h new file mode 100644 index 0000000..bec1544 --- /dev/null +++ b/lib/bugreports.h @@ -0,0 +1,29 @@ +/* bugreports.h -- explain how to report bugs + Copyright (C) 2016 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 <http://www.gnu.org/licenses/>. +*/ +/* Written by James Youngman <j...@gnu.org>. + */ +#if !defined BUGREPORTS_H +# define BUGREPORTS_H +#include <stdio.h> + +/* Interpreetation of the return code is as for fprintf. */ +int explain_how_to_report_bugs (FILE *f, const char *program_name); + + +#endif + + diff --git a/locate/code.c b/locate/code.c index 92f267c..7eb695f 100644 --- a/locate/code.c +++ b/locate/code.c @@ -64,6 +64,7 @@ /* find headers. */ #include "findutils-version.h" +#include "bugreports.h" #include "locatedb.h" #if ENABLE_NLS @@ -126,7 +127,7 @@ usage (FILE *stream) Usage: %s [--version | --help]\n\ or %s most_common_bigrams < file-list > locate-database\n"), program_name, program_name); - fputs (_("\nReport bugs to <bug-findutils@gnu.org>.\n"), stream); + explain_how_to_report_bugs (stream, program_name); } diff --git a/locate/frcode.c b/locate/frcode.c index a8aa769..d0fb03f 100644 --- a/locate/frcode.c +++ b/locate/frcode.c @@ -86,6 +86,7 @@ /* find headers. */ #include "findutils-version.h" +#include "bugreports.h" #include "locatedb.h" #if ENABLE_NLS @@ -147,7 +148,7 @@ usage (FILE *stream) fprintf (stream, _("Usage: %s [-0 | --null] [--version] [--help]\n"), program_name); - fputs (_("\nReport bugs to <bug-findutils@gnu.org>.\n"), stream); + explain_how_to_report_bugs (stream, program_name); } static long diff --git a/locate/locate.c b/locate/locate.c index 55f08b2..a50c2b1 100644 --- a/locate/locate.c +++ b/locate/locate.c @@ -98,6 +98,7 @@ #include "findutils-version.h" #include "locatedb.h" #include "printquoted.h" +#include "bugreports.h" #include "splitstring.h" @@ -1393,7 +1394,7 @@ Usage: %s [-d path | --database=path] [-e | -E | --[non-]existing]\n\ [--max-database-age D] [--version] [--help]\n\ pattern...\n"), program_name); - fputs (_("\nReport bugs to <bug-findutils@gnu.org>.\n"), stream); + explain_how_to_report_bugs (stdout, program_name); } enum { diff --git a/locate/updatedb.sh b/locate/updatedb.sh index 3fa01ae..20feb01 100644 --- a/locate/updatedb.sh +++ b/locate/updatedb.sh @@ -44,7 +44,9 @@ Written by Eric B. Decker, James Youngman, and Kevin Dalley. LC_ALL=C export LC_ALL - +# We can't use substitution on PACKAGE_URL below because it +# (correctly) points to http://www.gnu.org/software/findutils/ instead +# of the bug reporting page. usage="\ Usage: $0 [--findoptions='-option1 -option2...'] [--localpaths='dir1 dir2...'] [--netpaths='dir1 dir2...'] @@ -52,7 +54,11 @@ Usage: $0 [--findoptions='-option1 -option2...'] [--output=dbfile] [--netuser=user] [--localuser=user] [--old-format] [--dbformat] [--version] [--help] -Report bugs to <bug-findutils@gnu.org>." +Report (and track progress on fixing) bugs in the updatedb +program via the @PACKAGE_NAME@ bug-reporting page at +http://savannah.gnu.org/bugs/?group=findutils or, if +you have no web access, by sending email to @PACKAGE_BUGREPORT@. +" changeto=/ old=no for arg diff --git a/xargs/xargs.c b/xargs/xargs.c index 18393cd..7862d80 100644 --- a/xargs/xargs.c +++ b/xargs/xargs.c @@ -65,6 +65,7 @@ /* find headers. */ #include "buildcmd.h" #include "fdleak.h" +#include "bugreports.h" #include "findutils-version.h" #if ENABLE_NLS @@ -1692,7 +1693,6 @@ usage (FILE *stream) HTL (_(" -x, --exit exit if the size (see -s) is exceeded\n")); HTL (_(" --help display this help and exit\n")); - HTL (_(" --version output version information and exit\n")); - HTL (_("\n" - "Report bugs to <bug-findutils@gnu.org>.\n")); + HTL (_(" --version output version information and exit\n\n")); + explain_how_to_report_bugs (stream, program_name); } -- 2.1.4