2000-04-05 13:28:08 +02:00
|
|
|
#compdef rlogin rsh remsh rcp
|
|
|
|
|
|
|
|
_rlogin () {
|
|
|
|
case "${words[1]:t}" in
|
|
|
|
rlogin)
|
|
|
|
_arguments -s \
|
|
|
|
'-8[allow 8-Bit data]' \
|
|
|
|
'-e-[specify escape character]:escape character:' \
|
|
|
|
'-l[specify login user name]:login as:_rlogin_users' \
|
|
|
|
':remote host name:_rlogin_hosts'
|
|
|
|
;;
|
|
|
|
rsh|remsh)
|
|
|
|
local context state line ret=1
|
|
|
|
typeset -A opt_args
|
|
|
|
|
|
|
|
_arguments -s \
|
|
|
|
'-n[ignore stdin]' \
|
|
|
|
'-l[specify login user name]:login as:_rlogin_users' \
|
|
|
|
':remote host name:_rlogin_hosts' \
|
2000-05-03 16:44:01 +02:00
|
|
|
'(-):command: _command_names -e' \
|
2000-04-05 13:28:08 +02:00
|
|
|
'*::command:->command' && ret=0
|
|
|
|
|
|
|
|
if [[ -n "$state" ]]; then
|
|
|
|
shift 1 words
|
|
|
|
(( CURRENT-- ))
|
|
|
|
_normal && ret=0
|
|
|
|
fi
|
|
|
|
return ret
|
|
|
|
;;
|
|
|
|
rcp)
|
2000-04-11 09:57:56 +02:00
|
|
|
local curcontext="$curcontext" state line ret=1 expl
|
2000-04-05 13:28:08 +02:00
|
|
|
typeset -A opt_args
|
|
|
|
|
|
|
|
_arguments -C -s \
|
|
|
|
'-p[preserve modification times]' \
|
|
|
|
'-r[recursively copy directories]' \
|
|
|
|
'*:files:->files' && ret=0
|
|
|
|
|
|
|
|
if [[ -n "$state" ]]; then
|
|
|
|
if compset -P '*:'; then
|
|
|
|
_files && ret=0
|
|
|
|
elif compset -P '*@'; then
|
2000-04-11 09:57:56 +02:00
|
|
|
_wanted hosts expl host _rlogin_hosts -S: -q && ret=0
|
2000-04-05 13:28:08 +02:00
|
|
|
else
|
|
|
|
_alternative \
|
|
|
|
'files:: _files' \
|
|
|
|
'hosts:: _rlogin_all_hosts -qS:' \
|
|
|
|
'users:: _rlogin_users -qS@' && ret=0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
return ret
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
_rlogin_users () {
|
2000-04-11 09:57:56 +02:00
|
|
|
_tags users && _combination -s '[:@]' my-accounts users-hosts users "$@"
|
2000-04-05 13:28:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
_rlogin_hosts () {
|
2000-04-11 09:57:56 +02:00
|
|
|
_tags hosts &&
|
2000-04-05 13:28:08 +02:00
|
|
|
if [[ "$IPREFIX" == *@ ]]; then
|
|
|
|
_combination -s '[:@]' my-accounts users-hosts "users=${IPREFIX/@}" hosts "$@"
|
|
|
|
else
|
|
|
|
_combination -s '[:@]' my-accounts users-hosts \
|
|
|
|
${opt_args[-l]:+"users=${opt_args[-l]:q}"} hosts "$@"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
_rlogin_all_hosts () {
|
|
|
|
_tags hosts && _combination -s '[:@]' my-accounts users-hosts hosts "$@"
|
|
|
|
}
|
|
|
|
|
|
|
|
_rlogin "$@"
|