- case "$after_dash_dash$1" in
- -[ef]) opt="$opt $1"; shift; pat="$1"
- if test "$grep" = grep; then # grep is buggy with -e on SVR4
- grep=egrep
- fi;;
- -[ABCdm])opt="$opt $1 $2"; shift;;
- --) opt="$opt $1"; after_dash_dash=1;;
- -*) opt="$opt $1";;
- *) if test -z "$pat"; then
- pat="$1"
- else
- break;
- fi;;
+
+ case $option in
+ (-[drRzZ] | --di* | --exc* | --inc* | --rec* | --nu*)
+ printf >&2 '%s: %s: option not supported\n' "$0" "$option"
+ exit 2;;
+ (-e* | --reg*)
+ have_pat=1;;
+ (-f | --file)
+ # The pattern is coming from a file rather than the command-line.
+ # If the file is actually stdin then we need to do a little
+ # magic, since we use stdin to pass the gzip output to grep.
+ # Turn the -f option into an -e option by copying the file's
+ # contents into OPTARG.
+ case $optarg in
+ (" '-'" | " '/dev/stdin'" | " '/dev/fd/0'")
+ option=-e
+ optarg=" '"$(sed "$escape") || exit 2;;
+ esac
+ have_pat=1;;
+ (--h | --he | --hel | --help)
+ echo "$usage" || exit 2
+ exit;;
+ (-H | --wi | --wit | --with | --with- | --with-f | --with-fi \
+ | --with-fil | --with-file | --with-filen | --with-filena | --with-filenam \
+ | --with-filename)
+ with_filename=1
+ continue;;
+ (-l | --files-with-*)
+ files_with_matches=1;;
+ (-L | --files-witho*)
+ files_without_matches=1;;
+ (-h | --no-f*)
+ no_filename=1;;
+ (-V | --v | --ve | --ver | --vers | --versi | --versio | --version)
+ echo "$version" || exit 2
+ exit;;