patch by srowe in Bug 359 to fix fgrep aliasing

This commit is contained in:
Mike Frysinger 2005-07-31 22:41:05 +00:00
parent 66c37d1390
commit 15ca58648a
2 changed files with 8 additions and 3 deletions

View File

@ -73,13 +73,13 @@ config CONFIG_FEATURE_GREP_EGREP_ALIAS
and various repetition operators. and various repetition operators.
config CONFIG_FEATURE_GREP_FGREP_ALIAS config CONFIG_FEATURE_GREP_FGREP_ALIAS
bool " Alias fgrep to grep -f" bool " Alias fgrep to grep -F"
default y default y
depends on CONFIG_GREP depends on CONFIG_GREP
help help
fgrep sees the search pattern as a normal string rather than fgrep sees the search pattern as a normal string rather than
regular expressions. regular expressions.
grep -f is always builtin, this just creates the fgrep alias. grep -F is always builtin, this just creates the fgrep alias.
config CONFIG_FEATURE_GREP_CONTEXT config CONFIG_FEATURE_GREP_CONTEXT
bool " Enable before and after context flags (-A, -B and -C)" bool " Enable before and after context flags (-A, -B and -C)"

View File

@ -326,6 +326,11 @@ extern int grep_main(int argc, char **argv)
if(opt & GREP_OPT_f) if(opt & GREP_OPT_f)
load_regexes_from_file(fopt); load_regexes_from_file(fopt);
#ifdef CONFIG_FEATURE_GREP_FGREP_ALIAS
if(bb_applet_name[0] == 'f')
fgrep_flag = 1;
#endif
#ifdef CONFIG_FEATURE_GREP_EGREP_ALIAS #ifdef CONFIG_FEATURE_GREP_EGREP_ALIAS
if(bb_applet_name[0] == 'e' || (opt & GREP_OPT_E)) if(bb_applet_name[0] == 'e' || (opt & GREP_OPT_E))
reflags = REG_EXTENDED | REG_NOSUB; reflags = REG_EXTENDED | REG_NOSUB;