zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: _man - small fix for manpages without section number suffix
@ 2000-07-18 10:50 Andrej Borsenkow
  2000-07-19  6:18 ` Andrej Borsenkow
  0 siblings, 1 reply; 3+ messages in thread
From: Andrej Borsenkow @ 2000-07-18 10:50 UTC (permalink / raw)
  To: ZSH workers mailing list

[-- Attachment #1: Type: text/plain, Size: 195 bytes --]

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?

-andrej

Have a nice DOS!
B >>

[-- Attachment #2: _man.patch --]
[-- Type: application/octet-stream, Size: 891 bytes --]

--- Completion/User/_man	Thu Jun  1 09:58:09 2000
+++ /tools/share/zsh/3.1.9-dev-3/functions/User/_man	Tue Jul 18 14:44:54 2000
@@ -30,13 +30,13 @@
 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.(<->*|Z)(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.(<->*|Z)(N:t) )
   (($#mrd)) && rep[$#rep+1]=($(awk '{print $1}' $mrd))
 fi
 
 
 (( $#rep )) && _wanted manuals expl 'manual page' \
-    compadd - ${rep%%.[^.]##(.gz|.bz2|)}
+    compadd - ${rep%%.[^.]##(.gz|.bz2|.Z|)}

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: PATCH: _man - small fix for manpages without section number suffix
  2000-07-18 10:50 PATCH: _man - small fix for manpages without section number suffix Andrej Borsenkow
@ 2000-07-19  6:18 ` Andrej Borsenkow
  2000-07-19  8:58   ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Andrej Borsenkow @ 2000-07-19  6:18 UTC (permalink / raw)
  To: ZSH workers mailing list

>
> 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?

-andrej


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: _man - small fix for manpages without section number suffix
  2000-07-19  6:18 ` Andrej Borsenkow
@ 2000-07-19  8:58   ` Peter Stephenson
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2000-07-19  8:58 UTC (permalink / raw)
  To: Zsh hackers list

> >
> > 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2000-07-19  8:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-07-18 10:50 PATCH: _man - small fix for manpages without section number suffix Andrej Borsenkow
2000-07-19  6:18 ` Andrej Borsenkow
2000-07-19  8:58   ` Peter Stephenson

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).