From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21084 invoked from network); 27 Sep 1999 17:36:34 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 27 Sep 1999 17:36:34 -0000 Received: (qmail 2816 invoked by alias); 27 Sep 1999 17:36:30 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8075 Received: (qmail 2809 invoked from network); 27 Sep 1999 17:36:28 -0000 From: "Bart Schaefer" Message-Id: <990927173307.ZM17473@candle.brasslantern.com> Date: Mon, 27 Sep 1999 17:33:07 +0000 In-Reply-To: <000101bf090a$e9069970$21c9ca95@mow.siemens.ru> Comments: In reply to "Andrej Borsenkow" "_man - fast searching for glob patterns" (Sep 27, 9:08pm) References: <000101bf090a$e9069970$21c9ca95@mow.siemens.ru> In-Reply-To: Comments: In reply to Zefram "Re: _man - fast searching for glob patterns" (Sep 27, 6:17pm) X-Mailer: Z-Mail (5.0.0 30July97) To: "Andrej Borsenkow" , "ZSH workers mailing list" , Zefram Subject: Re: _man - fast searching for glob patterns MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Sep 27, 9:08pm, Andrej Borsenkow wrote: } Subject: _man - fast searching for glob patterns } } while read manpage dummy } if [[ $manpage == $our-search-pattern ]] } ... } done < $mandb-file } } needs a considerable amount of time (10-15 seconds here). On Sep 27, 6:17pm, Zefram wrote: } Subject: Re: _man - fast searching for glob patterns } } Better read the index file once, and cache it in an associative array. Check out the "mapfile" module. zmodload mapfile if [[ -f /usr/man/mandb ]] then allpages=(${"${(f)mapfile[/usr/man/mandb]}"%% *}) firstmatchingpage=$allpages[(r)$our-search-pattern] # ... etc. ... fi -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com