aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Kraai <kraai@debian.org>2001-10-29 15:49:03 +0000
committerMatt Kraai <kraai@debian.org>2001-10-29 15:49:03 +0000
commit999623e9736d21177d1f437679b334e0347a6e0f (patch)
treef49f55887c6de8c9ced3458ac1a2d981a5e3f374
parentb5f2516e3fc2398462a136a69a5f6120cf23b5f4 (diff)
downloadbusybox-999623e9736d21177d1f437679b334e0347a6e0f.tar.gz
Use extended regular expressions when invoked as egrep (noted and initial
patch by Charles Steinkuehler).
-rw-r--r--findutils/config.in3
-rw-r--r--findutils/grep.c5
-rw-r--r--include/applets.h2
3 files changed, 9 insertions, 1 deletions
diff --git a/findutils/config.in b/findutils/config.in
index 8e41bd50c..21e368047 100644
--- a/findutils/config.in
+++ b/findutils/config.in
@@ -8,6 +8,9 @@ comment 'Finding Utilities'
bool 'find' CONFIG_FIND
bool 'grep' CONFIG_GREP
+if [ "$CONFIG_GREP" = "y" ] ; then
+ bool ' egrep alias' CONFIG_FEATURE_GREP_EGREP_ALIAS
+fi
bool 'which' CONFIG_WHICH
bool 'xargs' CONFIG_XARGS
endmenu
diff --git a/findutils/grep.c b/findutils/grep.c
index a97a8bbb7..7cd8196fd 100644
--- a/findutils/grep.c
+++ b/findutils/grep.c
@@ -243,6 +243,11 @@ extern int grep_main(int argc, char **argv)
perror_msg_and_die("atexit");
#endif
+#ifdef CONFIG_FEATURE_GREP_EGREP_ALIAS
+ if (strcmp (basename (argv[0]), "egrep") == 0)
+ reflags |= REG_ICASE;
+#endif
+
/* do normal option parsing */
while ((opt = getopt(argc, argv, "iHhlnqvsce:f:"
#ifdef CONFIG_FEATURE_GREP_CONTEXT
diff --git a/include/applets.h b/include/applets.h
index 9a7e394b6..effbb5233 100644
--- a/include/applets.h
+++ b/include/applets.h
@@ -149,7 +149,7 @@
#ifdef CONFIG_ECHO
APPLET(echo, echo_main, _BB_DIR_BIN)
#endif
-#if defined(CONFIG_FEATURE_GREP_EGREP_ALIAS) && defined(CONFIG_GREP)
+#if defined(CONFIG_FEATURE_GREP_EGREP_ALIAS)
APPLET_NOUSAGE("egrep", grep_main, _BB_DIR_BIN)
#endif
#ifdef CONFIG_ENV