Re: [hackers] [sbase][PATCH] Add egrep and fgrep

From: Dimitris Papastamos <sin_AT_2f30.org>
Date: Tue, 5 Jan 2016 13:39:24 +0000

On Tue, Jan 05, 2016 at 02:35:18PM +0100, Connor Lane Smith wrote:
> Hey,
>
> On 5 January 2016 at 14:01, Roberto E. Vargas Caballero <k0ga_AT_shike2.com> wrote:
> > These tools are not part of POSIX, but they were part of the original
> > UNIX and even today they are still wide used. The work done by this
> > tools can be done by grep, so this implementation is only masking the
> > code with different names to get the work done.
>
> I do think egrep & fgrep are worth having, but I'm not sure if
> strcmp(argv[0], ...) is the way to go about it. For one thing it means
> (unless I'm mistaken) that executing /bin/egrep would actually call
> grep, not egrep. This could be fixed by comparing only the basename,
> but in my opinion a more reliable approach would be to add two short
> shell scripts to add the appropriate flag, e.g.
>
> #!/bin/sh
> exec grep -E "$_AT_"
>
> There is the drawback here that the first grep in $PATH may not be
> sbase grep, but all in all I think a shell script is better than
> checking argv[0] within the binary itself. Alternatively anyone who
> wants egrep & fgrep could just add shell aliases... Still, it's up to
> the maintainers.

Yes, I like the shell script approach, however, what happens when someone
uses the sbase-box target?
Received on Tue Jan 05 2016 - 14:39:24 CET

This archive was generated by hypermail 2.3.0 : Tue Jan 05 2016 - 14:48:14 CET