From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9613 invoked from network); 12 Sep 1999 00:01:14 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 12 Sep 1999 00:01:14 -0000 Received: (qmail 28227 invoked by alias); 12 Sep 1999 00:01:02 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7779 Received: (qmail 28220 invoked from network); 12 Sep 1999 00:01:01 -0000 To: zsh-workers@sunsite.auc.dk Subject: PATCH: _hosts, _hostports, _telnet and _socket MIME-Version: 1.0 (generated by AKEMI 1.13.2 - =?ISO-2022-JP?B?Ig==?= =?ISO-2022-JP?B?GyRCQTA0Y0s8GyhCIg==?=) Content-Type: text/plain; charset=US-ASCII From: Tanaka Akira Date: 12 Sep 1999 09:00:59 +0900 Message-ID: User-Agent: Chao-gnus/6.12.5 AKEMI/1.13.2 (=?ISO-2022-JP?B?GyRCQTAbKEI=?= =?ISO-2022-JP?B?GyRCNGNLPBsoQg==?=) FLAM-DOODLE/1.12.6 (=?ISO-2022-JP?B?GyRCM3cbKEI=?= 10R4.0/5.0) Emacs/20.4 (sparc-sun-solaris2.6) MULE/4.0 (HANANOEN) I made `_telnet' and `_socket'. They may complete port number and names depend on a host argument. So I extended the format of the variable `hosts' to be able to contain port numbers and names as: hosts=(... host:port ...) For that purpose, I modified `_hosts' to handle this format and made `_hostports' to complete port numbers and names depend on a host. Index: Completion/User/_hosts =================================================================== RCS file: /projects/zsh/zsh/Completion/User/_hosts,v retrieving revision 1.1.1.11 diff -u -F^( -r1.1.1.11 _hosts --- _hosts 1999/09/06 18:36:15 1.1.1.11 +++ _hosts 1999/09/11 23:42:55 @@ -1,8 +1,8 @@ -#compdef ftp ncftp ping rwho rup xping traceroute telnet +#compdef ftp ncftp ping rwho rup xping traceroute local expl : ${(A)hosts:=${(s: :)${(ps:\t:)${${(f)"$(command' \ + ':arg1:->arg1' \ + ':arg2:->arg2' + +case "$state" in +command) + compset -q + _normal + ;; + +arg1) + if (( $+options[-s] )); then + _message 'port' + else + _description expl 'host' + _hosts "$expl[@]" + fi + ;; + +arg2) + if (( ! $+options[-s] )); then + _description expl 'port' + _hostports $line[2] "$expl[@]" + fi + ;; +esac -- Tanaka Akira