From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2003 invoked from network); 8 Mar 1999 13:47:35 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 8 Mar 1999 13:47:35 -0000 Received: (qmail 18141 invoked by alias); 8 Mar 1999 13:47:13 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5683 Received: (qmail 18134 invoked from network); 8 Mar 1999 13:47:11 -0000 Message-Id: <9903081331.AA25790@ibmth.df.unipi.it> To: zsh-workers@sunsite.auc.dk (Zsh hackers list) Subject: PATCH: more _long_options Date: Mon, 08 Mar 1999 14:31:14 +0100 From: Peter Stephenson A few fixes I needed to get _long_options to work with _tar. --- /temp/pws/zsh-3.1.5/Completion/User/_long_options.bak Mon Mar 8 14:29:04 1999 +++ /temp/pws/zsh-3.1.5/Completion/User/_long_options Mon Mar 8 14:29:08 1999 @@ -42,14 +42,16 @@ group=() expl=() -while getopts "J:V:X:t" opt; do - case "$opt" in - [JV]) group=("-$opt" "$OPTARG");; - X) expl=(-X "$OPTARG");; - t) test=yes;; - esac -done -shift OPTIND-1 +if [[ $1 = -*~--* ]]; then + while getopts "J:V:X:t" opt; do + case "$opt" in + [JV]) group=("-$opt" "$OPTARG");; + X) expl=(-X "$OPTARG");; + t) test=yes;; + esac + done + shift OPTIND-1 +fi # Test if we are completing after `--' if we were asked to do so. @@ -92,7 +94,7 @@ # use the positional parameters we were given and a few standard # ones. Then we loop through this table. - set "$@" '*=FILE*' '_files' '*=(DIR|PATH)*' '_files -/' '*' '' + set -- "$@" '*=FILE*' '_files' '*=(DIR|PATH)*' '_files -/' '*' '' while [[ $# -gt 1 ]]; do @@ -107,8 +109,8 @@ # list we have built. If no option matches the pattern, we # continue with the next. - tmp=("${(@M)opts:#$~pattern}") - opts=("${(@)opts:#$~pattern}") + tmp=("${(@M)opts:##$~pattern}") + opts=("${(@)opts:##$~pattern}") (( $#tmp )) || continue -- Peter Stephenson Tel: +39 050 844536 WWW: http://www.ifh.de/~pws/ Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy