diff options
author | wosch <wosch@FreeBSD.org> | 1997-04-19 20:06:57 +0000 |
---|---|---|
committer | wosch <wosch@FreeBSD.org> | 1997-04-19 20:06:57 +0000 |
commit | 2e387c492335352c39a96fb1d2486f4e8fbdb6b5 (patch) | |
tree | 10e34e8af13752470bafaa06b66b401a43e9734b /gnu/usr.bin/gzip | |
parent | e5e3bb8d08310c479b2393b930e86293cfd3adaa (diff) | |
download | FreeBSD-src-2e387c492335352c39a96fb1d2486f4e8fbdb6b5.zip FreeBSD-src-2e387c492335352c39a96fb1d2486f4e8fbdb6b5.tar.gz |
Understand `--' to end processing of command options.
This means one search for a string starting with a dash.
Fix also filenames starting with a dash. Close PR #3349
Diffstat (limited to 'gnu/usr.bin/gzip')
-rw-r--r-- | gnu/usr.bin/gzip/zgrep.getopt | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/gnu/usr.bin/gzip/zgrep.getopt b/gnu/usr.bin/gzip/zgrep.getopt index 63f053d..1c138f4 100644 --- a/gnu/usr.bin/gzip/zgrep.getopt +++ b/gnu/usr.bin/gzip/zgrep.getopt @@ -26,7 +26,7 @@ # # zgrep - search possibly compressed files for a regular expression # -# $Id$ +# $Id: zgrep.getopt,v 1.4 1997/02/22 15:46:11 peter Exp $ PATH=/bin:/usr/bin:$PATH; export PATH @@ -67,7 +67,7 @@ files="$@" # no shell loop neccessary for option -q or -h # and a single file or reading from stdin case "$header"X"$#" in - -h*|-q*|X0|X1) $gzip $gzipopt $files | $grep $grepopt $pattern + -h*|-q*|X0|X1) $gzip $gzipopt -- $files | $grep $grepopt -- $pattern exit $?;; esac @@ -76,13 +76,13 @@ exit=1 for f in $files do case "$line" in - -l|-L) if $gzip $gzipopt $f | - $grep $grepopt $pattern >/dev/null + -l|-L) if $gzip $gzipopt -- $f | + $grep $grepopt -- $pattern >/dev/null then echo $f fi ;; - *) $gzip $gzipopt $f | $grep $grepopt $pattern | + *) $gzip $gzipopt -- $f | $grep $grepopt -- $pattern | sed "s%^%${f}:%";; esac |