Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: Re: Bug with _perl_builtin_funcs
- X-seq: zsh-workers 18461
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Felix Rosencrantz <f_rosencrantz@xxxxxxxxx>
- Subject: PATCH: Re: Bug with _perl_builtin_funcs
- Date: Wed, 23 Apr 2003 12:17:02 +0200
- Cc: zw <zsh-workers@xxxxxxxxxx>
- In-reply-to: <20030401151646.34142.qmail@xxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20030401151646.34142.qmail@xxxxxxxxxxxxxxxxxxxxxxx>
On 1 Apr, Felix Rosencrantz wrote:
> There is a bug in the function _perl_builtin_funcs. This function attempts to
> build a list of perl builtin funcs by parsing the man page for perlfunc. When
> it parses the man page it assume it is plain text. However, on RH the man page
> is compressed with gzip.
This should make it use bzip2 or gzip as appropriate. I also had
problems with the lines starting .IP instead of .Ip so I fixed that so
it now works on my system.
Oliver
Index: _perl_builtin_funcs
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_perl_builtin_funcs,v
retrieving revision 1.1
diff -u -r1.1 _perl_builtin_funcs
--- _perl_builtin_funcs 2 Apr 2001 11:40:15 -0000 1.1
+++ _perl_builtin_funcs 23 Apr 2003 10:10:22 -0000
@@ -8,24 +8,31 @@
# for future use.
#
-if [[ ${+_perl_builtin_funcs} -eq 0 ]]; then
+if (( ! $+_perl_builtin_funcs )); then
typeset -agU _perl_builtin_funcs
local perlfunc
- if [[ -n "${perlfunc:=$(man -w perlfunc 2>/dev/null; print -l ${^manpath}/man1/perlfunc.1(N) {/usr/man,/usr/share/man,/usr/local/man}/man1/perlfunc.1(N))}" ]]; then
- _perl_builtin_funcs=( `perl -lne '
- $in_funcs++, next if /Alphabetical/; \
- next unless $in_funcs; \
- if (/^\.Ip "(\w+)/) { \
- print $1 unless $func{$1}; $func{$1}++ \
- }' $=perlfunc`
- )
+ if [[ -n "${perlfunc:=$(man -w perlfunc 2>/dev/null; print -l ${^manpath:-${(s.:.)$(manpath)}}/man1/perlfunc.1(|[zZ]|gz|bz2)(N) {/usr/man,/usr/share/man,/usr/local/man}/man1/perlfunc.1(|[zZ]|gz|bz2)(N))}" ]]; then
+ case $perlfunc in
+ *.bz2) perlfunc="bzip2 -cd $perlfunc" ;;
+ *[zZ]) perlfunc="gzip -cd $perlfunc" ;;
+ *) perlfunc="cat $perlfunc" ;;
+ esac
+ _perl_builtin_funcs=(
+ $($=perlfunc | perl -lne '
+ $in_funcs++, next if /Alphabetical/;
+ next unless $in_funcs;
+ if (/^\.I[pP] "(\w+)/) {
+ print $1 unless $func{$1}; $func{$1}++
+ }')
+ )
else
- echo "Couldn't find perlfunc man page; giving up."
+ _message "can't find perlfunc man page; giving up"
return 1
fi
fi
local expl
-_wanted functions expl 'Perl built-in functions' compadd -a _perl_builtin_funcs
+_wanted functions expl 'perl built-in function' compadd "$@" -a - \
+ _perl_builtin_funcs
Messages sorted by:
Reverse Date,
Date,
Thread,
Author