Subject: Re: bin/16279: rc.d/isdnd should not use fgrep
To: NetBSD GNATS submissions and followups <gnats-bugs@gnats.netbsd.org>
From: Greg A. Woods <woods@weird.com>
List: netbsd-bugs
Date: 04/10/2002 14:01:13
[ On Wednesday, April 10, 2002 at 05:43:26 (GMT), Charles M. Hannum wrote: ]
> Subject: bin/16279: rc.d/isdnd should not use fgrep
>
> >Description:
> rc.d/isdnd tries to use fgrep. If /usr is separate, this fails,
> because isdnd is considered part of network startup, and is run
> before /usr is mounted.
>
> >How-To-Repeat:
> Boot with separate /usr. Note `fgrep: command not found' on the
> console.
>
> >Fix:
> Don't use fgrep.
FYI I have been using a nice, very small, quite fast, and mostly
complete, implementation of fgrep on my machines that I do put in /bin.
$ file obj/fgrep
obj/fgrep: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, not stripped
$ size obj/fgrep obj/fgrep.o
text data bss dec hex filename
47627 3736 22036 73399 11eb7 obj/fgrep
3727 4 0 3731 e93 obj/fgrep.o
/* Copyright (c) 1991 by Bert Gijsbers. All rights reserved.
* Permission to use and redistribute this software is hereby granted provided
* that this copyright notice remains intact and that any modifications are
* clearly marked as such.
*
* Bert G˙sbers (Gijsbers) <bert@xpilot.org> http://www.xpilot.org/~bert/
*
* Original version is available in the Minix-2.0.2 source distribution:
*
* ftp://ftp.cs.vu.nl/pub/minix/2.0.2/src/CMD.TAZ
* http://www.cs.vu.nl/pub/minix/2.0.2/src/CMD.TAZ
*
* See also:
* http://www.cs.vu.nl/~ast/minix.html
* and:
* http://www.minix.org/
*
* NetBSD port and new options added by Greg A. Woods <woods@planix.com>
*
* syntax:
*
* fgrep [-c|-l|-q] [-x|-S] [-bhinsvwy] -e string ... [file ...]
*
* fgrep [-c|-l|-q] [-x|-S] [-bhinsvwy] -f string_file ... [file ...]
*
* fgrep [-c|-l|-q] [-x|-S] [-bhinsvwy] string [file ...]
*
* options:
*
* -c : print the number of matching lines
*
* -l : print only the file names of the files containing a match
*
* -b : print the block number (V7)
* -h : don't print filename prefixes if more than one file
* -i : ignore case (sysV/posix)
* -n : print line numbers
* -q : no output; return exit status only
* -s : don't print error messages (return status only in V7)
* -v : reverse, lines not containing one of the strings match
* -w : (Exact) only words that match in their entirety are printed (GNU)
* (not yet implemented)
* -x : (Exact) only lines that match in their entirety are printed (V7)
* -y : lower case letters in the pattern will also match upper case
* letters in the input, but upper case pattern letters match only
* upper case input letters (V7 addenda tape)
* -S : (Anchor-start) only lines that match the pattern from the
* start of the line to the end of the string are printed
*
* -e string : search for this string
*
* -f file : file contains strings to search for
*
* notes:
* Options are processed by getopt(3).
* Multiple strings per command line are supported, eg.
* fgrep -e str1 -e str2 *.c
* Instead of a filename - is allowed, meaning standard input.
*
* todo:
*
* try to eliminate MAX_STR_LEN
*
* finish '-w' for GNU compatability.
*
* '-L' (inverse of '-l') (V10)
*
* think about adding "-A num" and "-B num" and "-C" (context) (GNU only)
*/
If there's any desire to do the same in NetBSD I can send-pr this
implementation. (and anyone else who would like a copy need only ask! ;-)
(I also use a non-GNU grep, but it's in /usr/bin as statically linked
it's over 150KB on i386, even stripped)
(oh, and ATT awk, static-linked in /bin, is well under 190KB even
without being stripped, and well worth every byte in /bin too!)
--
Greg A. Woods
+1 416 218-0098; <gwoods@acm.org>; <g.a.woods@ieee.org>; <woods@robohack.ca>
Planix, Inc. <woods@planix.com>; VE3TCP; Secrets of the Weird <woods@weird.com>