summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2009-11-29 15:47:59 +0100
committerJim Meyering <meyering@redhat.com>2009-11-30 16:55:04 +0100
commit8fadfb0b0e99adc7252244760426548b4a7e30e9 (patch)
treea2ade399bb88fdeffdf42c0c6829790c237c5b4e
parentf6bebd34b62a1b1bd8e2f98bae3c491bd519c1ac (diff)
downloadgrep-8fadfb0b0e99adc7252244760426548b4a7e30e9.tar.gz
maint: use gnulib's progname module; enable set_program_name check
* bootstrap.conf (gnulib_modules): Add progname. * src/grep.c: Include "progname.h". (program_name): Remove declaration. (main): Call set_program_name. * cfg.mk (local-checks-to-skip): Add sc_program_name.
-rw-r--r--bootstrap.conf1
-rw-r--r--cfg.mk1
-rw-r--r--lib/.gitignore2
-rw-r--r--src/grep.c15
4 files changed, 11 insertions, 8 deletions
diff --git a/bootstrap.conf b/bootstrap.conf
index a4b10c09..41d126eb 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -48,6 +48,7 @@ memchr
memmove
mempcpy
obstack
+progname
quotearg
realloc
ssize_t
diff --git a/cfg.mk b/cfg.mk
index eb69c688..4bfa49c3 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -32,7 +32,6 @@ local-checks-to-skip = \
sc_makefile_check \
sc_makefile_path_separator_check \
sc_po_check \
- sc_program_name \
sc_prohibit_have_config_h \
sc_prohibit_magic_number_exit \
sc_prohibit_strcmp \
diff --git a/lib/.gitignore b/lib/.gitignore
index 31262044..59a5ee64 100644
--- a/lib/.gitignore
+++ b/lib/.gitignore
@@ -104,6 +104,8 @@ openat.c
openat.h
opendir-safer.c
pipe-safer.c
+progname.c
+progname.h
quotearg.c
quotearg.h
realloc.c
diff --git a/src/grep.c b/src/grep.c
index 1c777ce8..2919147a 100644
--- a/src/grep.c
+++ b/src/grep.c
@@ -47,6 +47,7 @@
#include "exclude.h"
#include "exitfail.h"
#include "closeout.h"
+#include "progname.h"
#undef MAX
#define MAX(A,B) ((A) > (B) ? (A) : (B))
@@ -351,7 +352,6 @@ unsigned char eolbyte;
/* For error messages. */
/* The name the program was run with, stripped of any leading path. */
-char *program_name;
static char const *filename;
static int errseen;
@@ -1341,7 +1341,7 @@ grepdir (char const *dir, struct stats const *stats)
if ( excluded_directory_patterns &&
excluded_file_name (excluded_directory_patterns, dir) ) {
return 1;
- }
+ }
/* Mingw32 does not support st_ino. No known working hosts use zero
@@ -1511,7 +1511,7 @@ if any error occurs and -q was not given, the exit status is 2.\n"));
"http://www.gnu.org/software/grep/");
fputs (_("General help using GNU software: <http://www.gnu.org/gethelp/>\n"),
stdout);
-
+
}
exit (status);
}
@@ -1834,6 +1834,7 @@ main (int argc, char **argv)
extern int optind;
initialize_main (&argc, &argv);
+ set_program_name (argv[0]);
program_name = argv[0];
keys = NULL;
@@ -2130,15 +2131,15 @@ main (int argc, char **argv)
if (!excluded_directory_patterns)
excluded_directory_patterns = new_exclude ();
add_exclude (excluded_directory_patterns, optarg, EXCLUDE_WILDCARDS);
- break;
-
+ break;
+
case INCLUDE_OPTION:
if (!included_patterns)
included_patterns = new_exclude ();
add_exclude (included_patterns, optarg, EXCLUDE_INCLUDE);
break;
-
-
+
+
case LINE_BUFFERED_OPTION:
line_buffered = 1;