Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: Re: _man only uses $manpath



Clint Adams wrote:

> And if you want that as a colon-delimited list, you can run
> the manpath binary.

As far as I can tell, running manpath will always work where man -w will
and in other cases such as debian where man -w doesn't so we can use
that. I've attached a basic patch which tries running manpath and
failing that, uses filename expansion to generate a reasonable guessed
manpath. No doubt we'll shortly find that everyone can think of many
more directories which can be in the default manpath. I couldn't think
of a much better way to check the directories other than determining
that they are existing directories. A for loop can be used if someone
can think of a suitable check.

I'm not convinced that it is worth it to parse files in /etc for any
system where a the manpath command exists so I haven't bothered with it.

As an aside, can the filename generation below be put all in one word:
it seems that I can't nest brackets with | and can't do things like (|/)
without getting a zsh: bad pattern error.

Oliver Kiddle

*** _man.old	Fri Sep 17 14:39:09 1999
--- _man	Fri Sep 17 15:08:42 1999
***************
*** 14,19 ****
--- 14,22 ----
    approx="(#a${_comp_correct})"
  fi
  
+ [ "$manpath" ] || manpath=$(manpath 2>/dev/null) || \
+   manpath=( /usr/man(-/N)
/(opt|usr)/(dt|share|X11R6|local)/(cat|)man(-/N) )
+ 
  if [[ $words[2] = (<->*|ln) ]]; then
    rep=(
   
$manpath/(man|cat)${words[2]}/${~approx}$PREFIX${~star}$SUFFIX.<->*(N:t:r)
)



Messages sorted by: Reverse Date, Date, Thread, Author