summaryrefslogtreecommitdiff
path: root/Functions/Zftp/zfcget
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2000-05-08 10:45:02 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2000-05-08 10:45:02 +0000
commit17d342160ae1c59687b61332bd4dee5e62bd509a (patch)
tree7ca5430438165cd96abb44d1d201819438625f11 /Functions/Zftp/zfcget
parentcfcb3202ef71040a7019609da6cb21de57f16ad6 (diff)
downloadzsh-17d342160ae1c59687b61332bd4dee5e62bd509a.tar.gz
zsh-17d342160ae1c59687b61332bd4dee5e62bd509a.zip
11252: no colon at the end of zftp function contexts
Diffstat (limited to 'Functions/Zftp/zfcget')
-rw-r--r--Functions/Zftp/zfcget31
1 files changed, 9 insertions, 22 deletions
diff --git a/Functions/Zftp/zfcget b/Functions/Zftp/zfcget
index fd6accfed..476a730a6 100644
--- a/Functions/Zftp/zfcget
+++ b/Functions/Zftp/zfcget
@@ -12,35 +12,22 @@
emulate -L zsh
-local loc rem stat=0 optlist opt nglob remlist locst remst
-local tmpfile=${TMPPREFIX}zfcget$$ rstat tsize time
+[[ $curcontext = :zf* ]] || local curcontext=:zfcget
+local loc rem stat=0 opt opt_G opt_t remlist locst remst
+local tmpfile=${TMPPREFIX}zfcget$$ rstat tsize
-while [[ $1 = -* ]]; do
- if [[ $1 = - || $1 = -- ]]; then
- shift;
- break;
- fi
- optlist=${1#-}
- for (( i = 1; i <= $#optlist; i++)); do
- opt=$optlist[$i]
- case $optlist[$i] in
- G) nglob=1
- ;;
- t) time=1
- ;;
- *) print option $opt not recognised >&2
- ;;
- esac
- done
- shift
+while getopts :Gt opt; do
+ [[ $opt = '?' ]] && print "zfcget: bad option: -$OPTARG" && return 1
+ eval "opt_$opt=1"
done
+(( OPTIND > 1 )) && shift $(( OPTIND - 1 ))
for remlist in $*; do
# zfcd directory hack to put the front back to ~
if [[ $remlist = $HOME || $remlist = $HOME/* ]]; then
remlist="~${remlist#$HOME}"
fi
- if [[ $nglob != 1 ]]; then
+ if [[ $opt_G != 1 ]]; then
zfrglob remlist
fi
if (( $#remlist )); then
@@ -73,7 +60,7 @@ for remlist in $*; do
continue
else
if zftp getat $rem $locst[1] >>$loc; then
- [[ $time = 1 ]] && zfrtime $loc $rem $remst[2]
+ [[ $opt_t = 1 ]] && zfrtime $loc $rem $remst[2]
else
stat=1
fi