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

Re: _man only uses $manpath



Sven Wischnowsky (wischnow@xxxxxxxxxxxxxxxxxxxxxxx) wrote:
> Oliver Kiddle wrote:
> > What are you trying to achieve with man -w - find a default manpath to
> > use if $manpath is unset? As far as I can tell man -w only gives you the
> > location of a specific man page which isn't entirely useful for finding
> > a default manpath as the default can (and often will) contain more than
> > one directory.

No, the GNU man displays all the man paths it will use if invoked as
`man -w':

       -w or --path
              Don't  actually display the man pages, but do print
              the location(s) of the files that would be  format-
              ted  or displayed. If no argument is given: display
              (on  stdout)  the  list  of  directories  that   is
              searched by man for man pages. If manpath is a link
              to  man,  then  "manpath"  is  equivalent  to  "man
              --path".

       -W     Like -w, but print file names one per line, without
              additional information.  This is  useful  in  shell
              commands like man -aW man | xargs ls -l

> > The only way I know of finding the default manpath is by
> > running the man binary through strings.

In the GNU case, you can just grep /etc/man.config for `^MANPATH '.

> > Maybe we could use a for loop to
> > guess possible man directories and check them.
> 
> Yes, a la `_x_color'.

I'd rather keep guessing as a last resort.  Maybe try man -w and check
the exit code, then

  if [[ -r /etc/man.config ]]; then 
    ...

?



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