build: rely on gnulib's progname module

* bootstrap.conf (gnulib_modules): Add progname.
* cfg.mk (local-checks-to-skip): Add sc_program_name.
* src/cmp.c: Include progname.h.
(program_name): Remove declaration.
(main): Call set_program_name.
* src/diff.c (main): Likewise.
* src/diff3.c (main): Likewise.
* src/sdiff.c (main): Likewise.
* src/diff.h (program_name): Remove extern declaration.
This commit is contained in:
Jim Meyering 2009-11-11 21:28:53 +01:00
parent 8cbaebf353
commit 08d9ddae59
7 changed files with 10 additions and 21 deletions

View File

@ -47,6 +47,7 @@ inttypes
maintainer-makefile
mbrtowc
mkstemp
progname
regex
sh-quote
stat-macros

3
cfg.mk
View File

@ -34,8 +34,7 @@ gpg_key_ID = B9AB9A16
local-checks-to-skip = \
sc_error_message_period \
sc_error_message_uppercase \
sc_m4_quote_check \
sc_program_name
sc_m4_quote_check
# Tools used to bootstrap this package, used for "announcement".
bootstrap-tools = autoconf,automake,gnulib

View File

@ -29,6 +29,7 @@
#include <getopt.h>
#include <hard-locale.h>
#include <inttostr.h>
#include <progname.h>
#include <unlocked-io.h>
#include <version-etc.h>
#include <xalloc.h>
@ -46,9 +47,6 @@ static size_t block_compare (word const *, word const *);
static size_t block_compare_and_count (word const *, word const *, off_t *);
static void sprintc (char *, unsigned char);
/* Name under which this program was invoked. */
char *program_name;
/* Filenames of the compared files. */
static char const *file[2];
@ -192,7 +190,7 @@ main (int argc, char **argv)
exit_failure = EXIT_TROUBLE;
initialize_main (&argc, &argv);
program_name = argv[0];
set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);

View File

@ -31,6 +31,7 @@
#include <getopt.h>
#include <hard-locale.h>
#include <prepargs.h>
#include <progname.h>
#include <sh-quote.h>
#include <stat-time.h>
#include <timespec.h>
@ -202,11 +203,6 @@ static struct option const longopts[] =
{0, 0, 0, 0}
};
/* Program name. */
char *program_name;
/* Return a string containing the command options with which diff was invoked.
Spaces appear between what were separate ARGV-elements.
There is a space at the beginning but none at the end.
@ -266,7 +262,7 @@ main (int argc, char **argv)
/* Do our initializations. */
exit_failure = 2;
initialize_main (&argc, &argv);
program_name = argv[0];
set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);

View File

@ -199,9 +199,6 @@ XTERN struct exclude *excluded;
slower) but will find a guaranteed minimal set of changes. */
XTERN bool minimal;
/* Name of program the user invoked (for error messages). */
XTERN char *program_name;
/* The strftime format to use for time strings. */
XTERN char const *time_format;

View File

@ -29,6 +29,7 @@
#include <file-type.h>
#include <getopt.h>
#include <inttostr.h>
#include <progname.h>
#include <sh-quote.h>
#include <version-etc.h>
#include <xalloc.h>
@ -158,8 +159,6 @@ static bool finalwrite;
/* If nonzero, output a merged file. */
static bool merge;
char *program_name;
static char *read_diff (char const *, char const *, char **);
static char *scan_diff_line (char *, char **, size_t *, char *, char);
static enum diff_type process_diff_control (char **, struct diff_block *);
@ -226,7 +225,7 @@ main (int argc, char **argv)
exit_failure = 2;
initialize_main (&argc, &argv);
program_name = argv[0];
set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);

View File

@ -30,6 +30,7 @@
#include <exitfail.h>
#include <file-type.h>
#include <getopt.h>
#include <progname.h>
#include <sh-quote.h>
#include <version-etc.h>
#include <xalloc.h>
@ -37,8 +38,6 @@
/* Size of chunks read from files which must be parsed into lines. */
#define SDIFF_BUFSIZE ((size_t) 65536)
char *program_name;
static char const *editor_program = DEFAULT_EDITOR_PROGRAM;
static char const **diffargv;
@ -459,7 +458,7 @@ main (int argc, char *argv[])
exit_failure = EXIT_TROUBLE;
initialize_main (&argc, &argv);
program_name = argv[0];
set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);