Hey, On 5 January 2016 at 14:01, Roberto E. Vargas Caballero <k...@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 "$@" 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. cls