zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@cambridgesiliconradio.com>
To: zsh-workers@sunsite.auc.dk (Zsh hackers list)
Subject: Re: PATCH: _man - small fix for manpages without section number suffix
Date: Wed, 19 Jul 2000 09:58:04 +0100	[thread overview]
Message-ID: <0FXX006DVSWSB9@la-la.cambridgesiliconradio.com> (raw)
In-Reply-To: "Your message of Wed, 19 Jul 2000 10:18:17 +0400." <000301bff149$20aedaa0$21c9ca95@mow.siemens.ru>

> >
> > 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 <pws@cambridgesiliconradio.com>
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070


      reply	other threads:[~2000-07-19  8:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-07-18 10:50 Andrej Borsenkow
2000-07-19  6:18 ` Andrej Borsenkow
2000-07-19  8:58   ` Peter Stephenson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0FXX006DVSWSB9@la-la.cambridgesiliconradio.com \
    --to=pws@cambridgesiliconradio.com \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).