From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18556 invoked from network); 26 May 2008 10:14:57 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 26 May 2008 10:14:57 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 91456 invoked from network); 26 May 2008 10:14:51 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 26 May 2008 10:14:51 -0000 Received: (qmail 709 invoked by alias); 26 May 2008 10:14:47 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25111 Received: (qmail 694 invoked from network); 26 May 2008 10:14:46 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 26 May 2008 10:14:46 -0000 Received: from rcpt-expgw.biglobe.ne.jp (rcpt-expgw.biglobe.ne.jp [133.205.19.67]) by bifrost.dotsrc.org (Postfix) with ESMTP id 0273880589A4 for ; Mon, 26 May 2008 12:14:38 +0200 (CEST) Received: from smtp-gw.biglobe.ne.jp by rcpt-expgw.biglobe.ne.jp (kbkr/0208160408) with ESMTP id m4QAEZhq014738 for ; Mon, 26 May 2008 19:14:35 +0900 X-Biglobe-Sender: Received: from [133.24.86.14] (133.24.86.14 [133.24.86.14]) by smtp-gw.biglobe.ne.jp id TANAAC15AFD5; Mon, 26 May 2008 19:14:35 +0900 (JST) Mime-Version: 1.0 X-Mailer: QUALCOMM MacOS X Eudora Version 6.2J rev3.3 Message-Id: In-Reply-To: <20080525155231.691a4979@pws-pc> References: <20080524095358.26811.79795.reportbug@nexus><20080524135404.GA9888@scru.or g><20080524164656.GA2682@nexus><20080524202135.GA18082@scru.org> <20080525155231.691a4979@pws-pc> Date: Mon, 26 May 2008 19:14:33 +0900 To: zsh-workers@sunsite.dk From: "Jun T." Subject: Re: Bug#482662: zsh: completion with locate gives extra output Content-Type: text/plain; charset="us-ascii" X-Virus-Scanned: ClamAV 0.91.2/7241/Mon May 26 10:56:02 2008 on bifrost X-Virus-Status: Clean I want take this opportunity to make it support MacOSX. I believe this will work on (free|Open)BSD as well. NOTES: (1) this includes the patch by PWS, which is not yet committed. (2) I'm not sure if we should 'setopt EXTENDED_GLOB' at the top of this script. (the globbing flag (#i) requires the option). (3) I used '_arguments -S' also for mlocate and slocate. Should it be used also for gnu locate? (4) '_arguments -A' is used only for bsd locate, since mlocate/slocate accepts options after pattern(s). Index: Completion/Unix/Command/_locate =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_locate,v retrieving revision 1.2 diff -u -r1.2 _locate --- Completion/Unix/Command/_locate 11 Feb 2008 16:28:30 -0000 1.2 +++ Completion/Unix/Command/_locate 26 May 2008 10:10:49 -0000 @@ -11,7 +11,7 @@ ;; (locate) - input="$(_call_program locate $words[1] -V)" + input="$(_call_program locate $words[1] -V 2>&1)" case $input in (*mlocate*) ltype=mlocate @@ -21,10 +21,18 @@ ltype=slocate ;; - (*(#i)gnu locate*) + (*(#i)gnu locate*|*findutils*gnu*) ltype=gnu ;; + (*illegal option*) + if [[ $OSTYPE == (freebsd|openbsd|dragonfly|darwin)* ]]; then + ltype=bsd + else + ltype=$best_guess + fi + ;; + # guess (*) ltype=$best_guess @@ -43,7 +51,7 @@ # -r/--regexp mean no normal arguments, so shouldn't complete # -m and --mmap are ignored, so don't bother # -s and --stdio likewise - _arguments -s : \ + _arguments -s -S : \ {-b,--basename}'[Match only the basename of files in the database]' \ {-c,--count}'[Output the number of matching entries]' \ {-d,--database=}'[Use alternative database]:database:_files' \ @@ -67,7 +75,7 @@ # -d can take path # -e can take a comma-separated list of directories. # -f should complete list of file system types like mount - _arguments -s : \ + _arguments -s -S : \ -u'[Create slocate database starting at path /]' \ -U'[Create slocate database starting at given path]:directory:_files -/' \ -c'[Parse GNU locate updatedb with -u, -U]' \ @@ -108,4 +116,17 @@ --help'[Show help]' \ '*:pattern: ' ;; + + (bsd) + _arguments -s -S -A '-*' \ + '(-S)-0[Separate file names by NUL characters]' \ + '(- *)-S[Show database statistics and exit]' \ + '(-S)-c[Output the number of matching file names]' \ + '(-S)*-d[Specify database to search]:database:_files' \ + '(-S)-i[Ignore case distinctions in pattern and database]' \ + '(-S)-l[Limit output to specified number of file names]:file limit: ' \ + '(-S)-m[Use mmap(2) instead of stdio(3) (default)]' \ + '(-S)-s[Use stdio(3) instead of mmap(2)]' \ + '*:pattern: ' + ;; esac