diff options
author | Jim Meyering <meyering@fb.com> | 2016-09-05 09:27:28 -0700 |
---|---|---|
committer | Jim Meyering <meyering@fb.com> | 2016-09-05 21:49:17 -0700 |
commit | 6c96214b4d75de6bf6cf95514e39c494fdcc8c4f (patch) | |
tree | e9ba6f08a7b657c8e6a0771db7859592eaeca173 | |
parent | ceac7eff585e024ee7b3ba812b0117b1fab7ed63 (diff) | |
download | grep-6c96214b4d75de6bf6cf95514e39c494fdcc8c4f.tar.gz |
maint: switch from gnulib's progname to getprogname module
* gnulib: Update to latest, for its new getprogname module.
* bootstrap.conf (avoided_gnulib_modules): Include the getprogname
module rather than the now-obsolescent progname.
* src/grep.c: Include "getprogname.h" rather than "progname.h"
and remove any use of set_program_name.
* tests/dfa-match-aux.c (main): Likewise.
* tests/get-mb-cur-max.c (main): Likewise.
* src/grep.c (usage, main): Use getprogname() in place of program_name.
-rw-r--r-- | bootstrap.conf | 2 | ||||
m--------- | gnulib | 0 | ||||
-rw-r--r-- | src/grep.c | 14 | ||||
-rw-r--r-- | tests/dfa-match-aux.c | 3 | ||||
-rw-r--r-- | tests/get-mb-cur-max.c | 3 |
5 files changed, 9 insertions, 13 deletions
diff --git a/bootstrap.conf b/bootstrap.conf index 9e761314..841937e7 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -39,6 +39,7 @@ fstatat fts getopt-gnu getpagesize +getprogname gettext-h git-version-gen gitlog-to-changelog @@ -65,7 +66,6 @@ minmax obstack openat-safer perl -progname propername quote readme-release diff --git a/gnulib b/gnulib -Subproject cffe9acc622fe5aa274c5c78ea860c9c17f8664 +Subproject 7a10276e59a05f4176464e0fbadc3f743c8ed24 @@ -38,9 +38,9 @@ #include "fcntl-safer.h" #include "fts_.h" #include "getopt.h" +#include "getprogname.h" #include "grep.h" #include "intprops.h" -#include "progname.h" #include "propername.h" #include "quote.h" #include "safe-read.h" @@ -1897,19 +1897,19 @@ usage (int status) if (status != 0) { fprintf (stderr, _("Usage: %s [OPTION]... PATTERN [FILE]...\n"), - program_name); + getprogname()); fprintf (stderr, _("Try '%s --help' for more information.\n"), - program_name); + getprogname()); } else { - printf (_("Usage: %s [OPTION]... PATTERN [FILE]...\n"), program_name); + printf (_("Usage: %s [OPTION]... PATTERN [FILE]...\n"), getprogname()); printf (_("Search for PATTERN in each FILE or standard input.\n")); printf (_("PATTERN is, by default, a basic regular expression (BRE).\n")); printf (_("\ Example: %s -i 'hello world' menu.h main.c\n\ \n\ -Regexp selection and interpretation:\n"), program_name); +Regexp selection and interpretation:\n"), getprogname()); printf (_("\ -E, --extended-regexp PATTERN is an extended regular expression (ERE)\n\ -F, --fixed-strings PATTERN is a set of newline-separated strings\n\ @@ -2358,8 +2358,6 @@ main (int argc, char **argv) FILE *fp; exit_failure = EXIT_TROUBLE; initialize_main (&argc, &argv); - set_program_name (argv[0]); - program_name = argv[0]; keys = NULL; keycc = 0; @@ -2689,7 +2687,7 @@ main (int argc, char **argv) if (show_version) { - version_etc (stdout, program_name, PACKAGE_NAME, VERSION, AUTHORS, + version_etc (stdout, getprogname(), PACKAGE_NAME, VERSION, AUTHORS, (char *) NULL); return EXIT_SUCCESS; } diff --git a/tests/dfa-match-aux.c b/tests/dfa-match-aux.c index 070089c0..af806289 100644 --- a/tests/dfa-match-aux.c +++ b/tests/dfa-match-aux.c @@ -26,7 +26,7 @@ #include <dfa.h> #include <localeinfo.h> -#include "progname.h" +#include "getprogname.h" _Noreturn void dfaerror (char const *mesg) @@ -50,7 +50,6 @@ main (int argc, char **argv) int allow_nl; struct localeinfo localeinfo; - set_program_name (argv[0]); if (argc < 3) exit (EXIT_FAILURE); diff --git a/tests/get-mb-cur-max.c b/tests/get-mb-cur-max.c index 403beb42..6e927963 100644 --- a/tests/get-mb-cur-max.c +++ b/tests/get-mb-cur-max.c @@ -21,12 +21,11 @@ #include <stdio.h> #include <stdlib.h> -#include "progname.h" +#include "getprogname.h" int main (int argc, char **argv) { - set_program_name (argv[0]); if (1 < argc && setlocale (LC_ALL, argv[1])) { printf ("%d\n", (int) MB_CUR_MAX); |