Better and more consistent guidance on how to report bugs.

* 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.
This commit is contained in:
James Youngman 2016-01-24 22:27:44 +00:00
parent b182bf64db
commit f535461241
9 changed files with 101 additions and 12 deletions

View File

@ -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

View File

@ -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);
}

View File

@ -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 =

44
lib/bugreports.c Normal file
View File

@ -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 <jay@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);
}

29
lib/bugreports.h Normal file
View File

@ -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 <jay@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

View File

@ -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

View File

@ -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
{

View File

@ -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]
[--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=/
for arg

View File

@ -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);
}