+ # 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