From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27262 invoked from network); 19 Jul 2000 08:59:01 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 19 Jul 2000 08:59:01 -0000 Received: (qmail 28974 invoked by alias); 19 Jul 2000 08:58:33 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 12308 Received: (qmail 28967 invoked from network); 19 Jul 2000 08:58:32 -0000 Date: Wed, 19 Jul 2000 09:58:04 +0100 From: Peter Stephenson Subject: Re: PATCH: _man - small fix for manpages without section number suffix In-reply-to: "Your message of Wed, 19 Jul 2000 10:18:17 +0400." <000301bff149$20aedaa0$21c9ca95@mow.siemens.ru> To: zsh-workers@sunsite.auc.dk (Zsh hackers list) Message-id: <0FXX006DVSWSB9@la-la.cambridgesiliconradio.com> Content-transfer-encoding: 7BIT > > > > Our version of CDE installs manpages without section suffix (i.e. > > /usr/dt/man/man1/dtsession.Z instead of dtsession.1.Z). > > > > Anybody objects to the following patch? > > Thinking about it - any reason to check for specific suffix at all? What > else can live in manpath directories? How about this: simply check for files with a `.' in, and only do more powerful processing when stripping suffixes. The processing is: attempt to strip a known compression suffix (this is the only place where these need to go now), then attempt to strip the _minimum_ suffix beginning with a dot and a number (separating these into separate expansions means they always both get tried --- btw extendedglob didn't seem to get set for that `##' in the old version). This handles cases like Solaris's POSIX.1.5 (i.e. the manual entry for POSIX.1 in man5). If Andrej has entries with similar names like POSIX.1.Z, then we're out of luck and will have to resort to some extra processing to decide the current system's format. Index: Completion/User/_man =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/User/_man,v retrieving revision 1.4 diff -u -r1.4 _man --- Completion/User/_man 2000/05/31 09:27:52 1.4 +++ Completion/User/_man 2000/07/19 08:54:53 @@ -30,13 +30,16 @@ mrd=(${^manpath/\%L/${LANG:-En_US.ASCII}}/mandb(N)) if [[ $words[2] = (<->*|1M|l|n) ]]; then rep=( - $manpath/(sman|man|cat)${words[2]}/${~approx}$PREFIX${~star}$SUFFIX.<->*(N:t) ) + $manpath/(sman|man|cat)${words[2]}/${~approx}$PREFIX${~star}$SUFFIX.*(N:t) ) (($#mrd)) && rep[$#rep+1]=($(awk "\$2 == \"$words[2]\" {print \$1}" $mrd)) else - rep=( $manpath/(sman|man|cat)*/${~approx}$PREFIX${~star}$SUFFIX.<->*(N:t) ) + rep=( $manpath/(sman|man|cat)*/${~approx}$PREFIX${~star}$SUFFIX.*(N:t) ) (($#mrd)) && rep[$#rep+1]=($(awk '{print $1}' $mrd)) fi +# Remove any compression suffix, then remove the minimum possible string +# beginning with .<->: that handles problem cases like files called +# `POSIX.1.5'. (( $#rep )) && _wanted manuals expl 'manual page' \ - compadd - ${rep%%.[^.]##(.gz|.bz2|)} + compadd - ${${rep%%.(bz2|z|gz|Z)}%.<->*} -- Peter Stephenson Cambridge Silicon Radio, Unit 300, Science Park, Milton Road, Cambridge, CB4 0XL, UK Tel: +44 (0)1223 392070