From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9206 invoked from network); 1 Jul 1999 14:37:09 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 1 Jul 1999 14:37:09 -0000 Received: (qmail 100 invoked by alias); 1 Jul 1999 14:35:53 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6939 Received: (qmail 93 invoked from network); 1 Jul 1999 14:35:51 -0000 Message-ID: <377B7C6D.5F1FC98C@thoth.u-net.com> Date: Thu, 01 Jul 1999 15:34:21 +0100 From: Oliver Kiddle X-Mailer: Mozilla 4.61 [en] (Win95; I) X-Accept-Language: en MIME-Version: 1.0 To: Peter Stephenson CC: Zsh hackers list Subject: PATCH: completion for hosts and character classes References: <9906211143.AA29441@ibmth.df.unipi.it> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit On 21 Jun, Peter Stephenson wrote: > Oliver Kiddle wrote: > > BTW, the _hosts change which I sent last Friday (and which isn't in pws-23) > > doesn't work with my hosts file at home so I'll send a replacement later in > > the week. My mistake was using \t in the pattern to match tabs which ofcourse doesn't work. The patch which follows uses [:blank:] and works with all the host files I've tried. I've also included a patch for compctl-examples which generated hosts and groups arrays, using the old method with lots of (@). Interestingly, the replacements seem to be noticeably faster (on my slow computer). The other part of the patch is to complete the character classes like [:blank:]. This seems to work but as with my other attempts to patch _subscript, will probably need a bit of tidying up. > I must have forgotten about that. But we probably need more sophisticated > ways of generating host names from all sorts of different sources. > /etc/hosts isn't all that well used any more. Have you got any suggestions for other ways of generating a hosts list. The only cases I can think of where there won't be a hosts file is if NIS is being used or if the computer is a nameserver itself. It's quite easy to generate a list of hosts in each of these cases but I'm not quite sure how to determine when these are the case. In some contexts, we'll probably want to do something totally different for completing hosts. For example, with ncftp, using the bookmarks and for urls using the Netscape/Lynx bookmarks or history file. Oliver Kiddle PS. If the patch doesn't work, check that none of the lines have been wrapped. *** Completion/User/_hosts.old Tue Apr 13 08:37:40 1999 --- Completion/User/_hosts Thu Jul 1 13:58:17 1999 *************** *** 1,3 **** ! #compdef ftp ncftp ping rwho rup xping traceroute nslookup ! compgen -k hosts --- 1,5 ---- ! #compdef ftp ncftp ping rwho rup xping traceroute nslookup telnet xhost ! : ${(A)hosts:=${(s: :)${(ps:\t:)${${(f)"$(