mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-27 16:50:58 +01:00
zsh-3.1.6
This commit is contained in:
parent
14810d6df1
commit
61e68d70da
29 changed files with 710 additions and 240 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
emulate -L zsh
|
||||
|
||||
local opt optlist once
|
||||
local opt optlist once dir
|
||||
|
||||
while [[ $1 = -* ]]; do
|
||||
if [[ $1 = - || $1 = -- ]]; then
|
||||
|
|
@ -61,10 +61,20 @@ if [[ -z $EMAIL_ADDR ]]; then
|
|||
print "Using $EMAIL_ADDR as anonymous FTP password."
|
||||
fi
|
||||
|
||||
if [[ $1 = */* ]]; then
|
||||
1=${1##ftp://}
|
||||
dir=${1#*/}
|
||||
1=${1%%/*}
|
||||
fi
|
||||
|
||||
if [[ $once = 1 ]]; then
|
||||
zftp open $1 anonymous $EMAIL_ADDR
|
||||
zftp open $1 anonymous $EMAIL_ADDR || return 1
|
||||
else
|
||||
zftp params $1 anonymous $EMAIL_ADDR
|
||||
zftp open
|
||||
zftp open || return 1
|
||||
fi
|
||||
|
||||
if [[ -n $dir ]]; then
|
||||
zfcd $dir
|
||||
fi
|
||||
# }
|
||||
|
|
|
|||
|
|
@ -1,10 +1,16 @@
|
|||
# function zfget {
|
||||
# Get files from remote server. Options:
|
||||
# -c cat: dump files to stdout.
|
||||
# alias zfcat="zfget -c"
|
||||
# zfpage() { zfget -c "$@" | eval $PAGER }
|
||||
# are sensible things to do, but aren't done for you. Note the
|
||||
# second doesn't work on all OS's.
|
||||
# -G don't to remote globbing, else do
|
||||
# -t update the local file times to the same time as the remote.
|
||||
# Currently this only works if you have the `perl' command,
|
||||
# and that perl is version 5 with the standard library.
|
||||
# See the function zfrtime for more gory details.
|
||||
# See the function zfrtime for more gory details. This has
|
||||
# no effect with the -c option.
|
||||
#
|
||||
# If the connection is not currently open, try to open it with the current
|
||||
# parameters (set by a previous zfopen or zfparams), then close it after
|
||||
|
|
@ -13,7 +19,7 @@
|
|||
|
||||
emulate -L zsh
|
||||
|
||||
local loc rem optlist opt nglob remlist time
|
||||
local loc rem optlist opt nglob remlist time cat
|
||||
integer stat do_close
|
||||
|
||||
while [[ $1 == -* ]]; do
|
||||
|
|
@ -29,6 +35,8 @@ while [[ $1 == -* ]]; do
|
|||
;;
|
||||
t) time=1
|
||||
;;
|
||||
c) cat=1
|
||||
;;
|
||||
*) print option $opt not recognised >&2
|
||||
;;
|
||||
esac
|
||||
|
|
@ -48,11 +56,16 @@ for remlist in $*; do
|
|||
fi
|
||||
if (( $#remlist )); then
|
||||
for rem in $remlist; do
|
||||
loc=${rem:t}
|
||||
if zftp get $rem >$loc; then
|
||||
[[ $time = 1 ]] && zfrtime $rem $loc
|
||||
if [[ -n $cat ]]; then
|
||||
zftp get $rem
|
||||
stat=$?
|
||||
else
|
||||
stat=1
|
||||
loc=${rem:t}
|
||||
if zftp get $rem >$loc; then
|
||||
[[ $time = 1 ]] && zfrtime $rem $loc
|
||||
else
|
||||
stat=1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
emulate -L zsh
|
||||
|
||||
local optlist opt once
|
||||
local optlist opt once dir
|
||||
|
||||
while [[ $1 = -* ]]; do
|
||||
if [[ $1 = - || $1 = -- ]]; then
|
||||
|
|
@ -31,12 +31,22 @@ done
|
|||
# both .netrc and .ncftp/bookmarks . We could even try saving
|
||||
# the info in their for new hosts, like ncftp does.
|
||||
|
||||
if [[ $1 = */* ]]; then
|
||||
1=${1##ftp://}
|
||||
dir=${1#*/}
|
||||
1=${1%%/*}
|
||||
fi
|
||||
|
||||
if [[ $once = 1 ]]; then
|
||||
zftp open $*
|
||||
zftp open $* || return 1
|
||||
else
|
||||
# set parameters, but only if there was at least a host
|
||||
(( $# > 0 )) && zfparams $*
|
||||
# now call with no parameters
|
||||
zftp open
|
||||
zftp open || return 1
|
||||
fi
|
||||
|
||||
if [[ -n $dir ]]; then
|
||||
zfcd $dir
|
||||
fi
|
||||
# }
|
||||
|
|
|
|||
|
|
@ -1,13 +1,16 @@
|
|||
# function zftp_chpwd {
|
||||
# You may want to alter chpwd to call this when $ZFTP_USER is set.
|
||||
|
||||
# Cancel the filename cache for the current directory.
|
||||
zftp_fcache=()
|
||||
# ...and also empty the stored directory listing cache.
|
||||
# As this function is called when we close the connection, this
|
||||
# is the only place we need to do these two things.
|
||||
[[ -n $zfcurdir && -f $zfcurdir ]] && rm -f $zfcurdir
|
||||
zfotherargs=
|
||||
# If the directory really changed...
|
||||
if [[ $ZFTP_PWD != $zflastdir ]]; then
|
||||
# Cancel the filename cache for the current directory.
|
||||
zftp_fcache=()
|
||||
# ...and also empty the stored directory listing cache.
|
||||
# As this function is called when we close the connection, this
|
||||
# is the only place we need to do these two things.
|
||||
[[ -n $zfcurdir && -f $zfcurdir ]] && rm -f $zfcurdir
|
||||
zfotherargs=
|
||||
fi
|
||||
|
||||
if [[ -z $ZFTP_USER ]]; then
|
||||
# last call, after an FTP logout
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue