fgrep alias for grep

Denys Vlasenko vda.linux at googlemail.com
Sat Jun 7 05:17:41 UTC 2008


On Friday 06 June 2008 22:39, beck0778 at umn.edu wrote:
> I'm trying to extend busybox to include aliases for dnsdomainname and 
> domainname in the hostname applet. It seems fairly straightforward, and I'm 
> not having trouble with it, but I stumbled upon something odd in the source 
> for the grep applet, specifically its treatment of the fgrep alias for 
> grep.
> 
> In the file busybox-1.10.1/findutils/grep.c, starting at line 457:
> 
> if (option_mask32 & OPT_f)
>         load_regexes_from_file(fopt);
> 
> if (ENABLE_FEATURE_GREP_FGREP_ALIAS && applet_name[0] == 'f')
>         option_mask32 |= OPT_F;
> 
> Since this code is not in a loop, it seems that the fgrep alias detection 
> (the second chunk of code here), which sets the OPT_F flag in 
> option_mask32, comes after the code that detects the presence of that flag. 

You confused OPT_f and OPT_F.

But there indeed was a small bug nearby: -f - ("read regexps from stdin")
wasn't working.
--
vda



More information about the busybox mailing list