Use extended regular expressions when invoked as egrep (noted and initial
authorMatt Kraai <kraai@debian.org>
Mon, 29 Oct 2001 15:49:03 +0000 (15:49 -0000)
committerMatt Kraai <kraai@debian.org>
Mon, 29 Oct 2001 15:49:03 +0000 (15:49 -0000)
patch by Charles Steinkuehler).

findutils/config.in
findutils/grep.c
include/applets.h

index 8e41bd50cb6374fa7fe8d5032096d9c55d8e7688..21e368047b6df0c6fefa2c1262ec25d998b962cf 100644 (file)
@@ -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
index a97a8bbb7e2925bc43e1f7ee8a18cde87b320267..7cd8196fd42b9600c4a8c3d4fcafbb871bf11988 100644 (file)
@@ -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
index 9a7e394b685d2334fb41f8a5508a5583ad043642..effbb5233d2e96cfb46b57e75442ae587b9cae8c 100644 (file)
 #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