- case "$after_dash_dash$1" in
- --d* | --rec*) echo >&2 "$0: $1: option not supported"; exit 2;;
- --files-with-*) files_with_matches=1;;
- --files-witho*) files_without_matches=1;;
- --no-f*) no_filename=1;;
- --wi*) with_filename=1;;
- --*) ;;
- -*)
- case "$1" in
- -*[dr]*) echo >&2 "$0: $1: option not supported"; exit 2;;
- esac
- case "$1" in
- -*H*) with_filename=1;;
- esac
- case "$1" in
- -*h*) no_filename=1;;
- esac
- case "$1" in
- -*L*) files_without_matches=1;;
- esac
- case "$1" in
- -*l*) files_with_matches=1;;
- esac;;
+ option=$1
+ shift
+ optarg=
+
+ case $option in
+ (-[0123456789EFGHIKLPRTUVZabchilnoqrsuvwxyz]*[!0123456789]*)
+ arg2=-\'$(expr "X$option" : 'X-.[0-9]*\(.*\)' | sed "$escape")
+ eval "set -- $arg2 "'${1+"$@"}'
+ option=$(expr "X$option" : 'X\(-.[0-9]*\)');;
+ (--binary-*=* | --[lm]a*=* | --reg*=*)
+ ;;
+ (-[ABCDXdefm] | binary-* | --file | --[lm]a* | --reg*)
+ case ${1?"$option option requires an argument"} in
+ (*\'*)
+ optarg=" '"$(printf '%s\n' "$1" | sed "$escape");;
+ (*)
+ optarg=" '$1'";;
+ esac
+ shift;;
+ (-f?*\'*)
+ optarg=" '"$(expr "X$option" : 'X-f\(.*\)' | sed "$escape")
+ option=-f;;
+ (-f?*)
+ optarg=" '"$(expr "X$option" : 'X-f\(.*\)')\'
+ option=-f;;
+ (--file=*\'*)
+ optarg=" '"$(expr "X$option" : 'X--file=\(.*\)' | sed "$escape")
+ option=--file;;
+ (--file=*)
+ optarg=" '"$(expr "X$option" : 'X--file=\(.*\)')\'
+ option=--file;;
+ (--)
+ break;;
+ (-?*)
+ ;;
+ (*)
+ case $option in
+ (*\'*)
+ operands="$operands '"$(printf '%s\n' "$option" | sed "$escape");;
+ (*)
+ operands="$operands '$option'";;
+ esac
+ ${POSIXLY_CORRECT+break}
+ continue;;
+ esac
+
+ 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.
+ # Similarly if it is not a regular file, since it might be read repeatedly.
+ # In either of these two cases, copy the pattern into a temporary file,
+ # and use that file instead. The pattern might contain null bytes,
+ # so we cannot simply switch to -e here.
+ if case $optarg in
+ (" '-'" | " '/dev/stdin'" | " '/dev/fd/0'")
+ :;;
+ (*)
+ eval "test ! -f$optarg";;
+ esac
+ then
+ if test -n "$pattmp"; then
+ eval "cat --$optarg" >>"$pattmp" || exit 2
+ continue
+ fi
+ trap '
+ test -n "$pattmp" && rm -f "$pattmp"
+ (exit 2); exit 2
+ ' HUP INT PIPE TERM 0
+ case $TMPDIR in
+ / | /*/) ;;
+ /*) TMPDIR=$TMPDIR/;;
+ *) TMPDIR=/tmp/;;
+ esac
+ if type mktemp >/dev/null 2>&1; then
+ pattmp=$(mktemp "${TMPDIR}zgrepXXXXXXXXX") || exit 2
+ else
+ set -C
+ pattmp=${TMPDIR}zgrep$$
+ fi
+ eval "cat --$optarg" >"$pattmp" || exit 2
+ optarg=' "$pattmp"'
+ fi
+ have_pat=1;;
+ (--h | --he | --hel | --help)
+ printf '%s\n' "$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)
+ printf '%s\n' "$version" || exit 2
+ exit;;