Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: _man - fast searching for glob patterns
- X-seq: zsh-workers 8075
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: "Andrej Borsenkow" <Andrej.Borsenkow@xxxxxxxxxxxxxx>, "ZSH workers mailing list" <zsh-workers@xxxxxxxxxxxxxx>, Zefram <zefram@xxxxxxxx>
- Subject: Re: _man - fast searching for glob patterns
- Date: Mon, 27 Sep 1999 17:33:07 +0000
- In-reply-to: <000101bf090a$e9069970$21c9ca95@xxxxxxxxxxxxxx>
- In-reply-to: <E11VePQ-0005aL-00@xxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <000101bf090a$e9069970$21c9ca95@xxxxxxxxxxxxxx> <E11VePQ-0005aL-00@xxxxxxxxxxxxxxxxxx>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author