- case "$after_dash_dash$1" in
- --d* | --rec*) echo >&2 "$0: $1: option not supported"; exit 2;;
- --h*) echo "$usage" || exit 2; exit;;
- --files-with-*) files_with_matches=1;;
- --files-witho*) files_without_matches=1;;
- --no-f*) no_filename=1;;
- --v*) echo "$version" || exit 2; exit;;
- --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
+ (-[0123456789abcdhHiIKLlnoqrRsTuUvVwxyzZ]?*)
+ arg2=-\'$(expr "X${option}X" : 'X-.[0-9]*\(.*\)' | sed "$escape")
+ eval "set -- $arg2 "'${1+"$@"}'
+ option=$(expr "X$option" : 'X\(-.[0-9]*\)');;
+ (--binary-*=* | --[lm]a*=* | --reg*=*)
+ ;;
+ (-[ABCDefm] | --binary-* | --file | --[lm]a* | --reg*)
+ case ${1?"$option option requires an argument"} in
+ (*\'*)
+ optarg=" '"$(printf '%sX\n' "$1" | sed "$escape");;
+ (*)
+ optarg=" '$1'";;
+ esac
+ shift;;
+ (--)
+ break;;
+ (-?*)
+ ;;
+ (*)
+ case $option in
+ (*\'*)
+ operands="$operands '"$(printf '%sX\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;;
+ (-[ef]* | --file | --file=* | --reg*)
+ # 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).
+ # So find a free fd and change the argument to then use this
+ # file descriptor for the pattern.
+ case $optarg in
+ (" '-'" | " '/dev/stdin'" | " '/dev/fd/0'")
+ pat_on_stdin=1
+ eval 'test -e .' 2>/dev/null \
+ && eval 'exists(){ test -e "$@"; }' \
+ || eval 'exists(){ test -r "$@" || test -w "$@"; }'
+ # Start search from 6 since the script already uses 3 and 5
+ fd=6
+ pat_fd=
+ while : ; do
+ if ! exists /proc/$$/fd/$fd; then
+ pat_fd=$fd
+ break;
+ fi
+ fd=$(expr $fd + 1)
+ if test $fd = 255; then
+ printf >&2 '%s: no free file descriptor\n' "$0"
+ exit 2
+ fi
+ done
+ optarg=/dev/fd/$pat_fd;
+ 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;;
+ (--no-f*)
+ no_filename=1;;
+ (-V | --v | --ve | --ver | --vers | --versi | --versio | --version)
+ echo "$version" || exit 2
+ exit;;