* Re: _man only uses $manpath
@ 1999-09-17 9:45 Sven Wischnowsky
1999-09-17 11:22 ` Adam Spiers
1999-09-17 12:54 ` Clint Adams
0 siblings, 2 replies; 13+ messages in thread
From: Sven Wischnowsky @ 1999-09-17 9:45 UTC (permalink / raw)
To: zsh-workers
Oliver Kiddle wrote:
> Sven Wischnowsky wrote:
> > Andrej Borsenkow wrote:
> > > On Thu, 16 Sep 1999, Adam Spiers wrote:
> > > > Sounds like we need some way of intelligently figuring out a solution
> > > > for both scenarios. Does `man -w' return an error of some sort on
> > > > your system which we could test for?
> > > Well, exit code != 0. I have no idea, how reliable it is (different
> > > versions etc)
> >
> > Same here for Digital Unix. Maybe we should test $OSTYPE?
>
> The only man I can find which does support -w or --path is the GNU one.
> The exit code of != 0 seems fine on the systems I've looked at provided
> stderr is redirected.
>
> 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. The only way I know of finding the default manpath is by
> running the man binary through strings. Maybe we could use a for loop to
> guess possible man directories and check them.
Yes, a la `_x_color'.
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: _man only uses $manpath
1999-09-17 9:45 _man only uses $manpath Sven Wischnowsky
@ 1999-09-17 11:22 ` Adam Spiers
1999-09-17 12:43 ` Oliver Kiddle
1999-09-17 12:54 ` Clint Adams
1 sibling, 1 reply; 13+ messages in thread
From: Adam Spiers @ 1999-09-17 11:22 UTC (permalink / raw)
To: zsh-workers
Sven Wischnowsky (wischnow@informatik.hu-berlin.de) 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
...
?
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: _man only uses $manpath
1999-09-17 11:22 ` Adam Spiers
@ 1999-09-17 12:43 ` Oliver Kiddle
0 siblings, 0 replies; 13+ messages in thread
From: Oliver Kiddle @ 1999-09-17 12:43 UTC (permalink / raw)
To: Adam Spiers; +Cc: zsh-workers
Adam Spiers wrote:
>
> No, the GNU man displays all the man paths it will use if invoked as
> `man -w':
It seems that GNU man itself varies. The GNU man on the debian linux
system I have access to at work prints:
What manual page do you want?
in response to -w with no argument and has no -W option. Note that it
does return an exit code of 1 though so we can still use man -w if we
check the exit code.
> In the GNU case, you can just grep /etc/man.config for `^MANPATH '.
That must be specific to your linux distribution as opposed to GNU man.
> 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
That's probably the best approach as long as we don't find a system that
breaks it.
Oliver Kiddle
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: _man only uses $manpath
1999-09-17 9:45 _man only uses $manpath Sven Wischnowsky
1999-09-17 11:22 ` Adam Spiers
@ 1999-09-17 12:54 ` Clint Adams
1999-09-17 13:04 ` Clint Adams
1 sibling, 1 reply; 13+ messages in thread
From: Clint Adams @ 1999-09-17 12:54 UTC (permalink / raw)
To: Sven Wischnowsky; +Cc: zsh-workers
> Yes, a la `_x_color'.
Just to complicate things further, man_db (as used by Debian)
uses an /etc/manpath.config that looks like this:
MANDATORY_MANPATH /usr/man
MANDATORY_MANPATH /usr/share/man
MANDATORY_MANPATH /usr/X11R6/man
MANDATORY_MANPATH /usr/local/man
#---------------------------------------------------------
# set up PATH to MANPATH mapping
# ie. what man tree holds man pages for what binary directory.
#
# *PATH* -> *MANPATH*
#
MANPATH_MAP /bin /usr/share/man
MANPATH_MAP /usr/bin /usr/share/man
MANPATH_MAP /sbin /usr/share/man
MANPATH_MAP /usr/sbin /usr/share/man
MANPATH_MAP /usr/local/bin /usr/local/man
MANPATH_MAP /usr/local/sbin /usr/local/man
MANPATH_MAP /usr/X11R6/bin /usr/X11R6/man
MANPATH_MAP /usr/bin/X11 /usr/X11R6/man
MANPATH_MAP /usr/games /usr/share/man
MANPATH_MAP /opt/bin /opt/man
MANPATH_MAP /opt/sbin /opt/man
#---------------------------------------------------------
# *MANPATH* -> *CATPATH*
#
MANDB_MAP /usr/man /var/cache/man/fsstnd
MANDB_MAP /usr/share/man /var/cache/man
MANDB_MAP /usr/local/man /var/cache/man/local
MANDB_MAP /usr/X11R6/man /var/cache/man/X11R6
MANDB_MAP /opt/man /var/cache/man/opt
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: _man only uses $manpath
1999-09-17 12:54 ` Clint Adams
@ 1999-09-17 13:04 ` Clint Adams
1999-09-17 14:27 ` PATCH: " Oliver Kiddle
0 siblings, 1 reply; 13+ messages in thread
From: Clint Adams @ 1999-09-17 13:04 UTC (permalink / raw)
To: Clint Adams; +Cc: Sven Wischnowsky, zsh-workers
> MANDATORY_MANPATH /usr/man
> MANDATORY_MANPATH /usr/share/man
> MANDATORY_MANPATH /usr/X11R6/man
> MANDATORY_MANPATH /usr/local/man
And if you want that as a colon-delimited list, you can run
the manpath binary.
^ permalink raw reply [flat|nested] 13+ messages in thread
* PATCH: Re: _man only uses $manpath
1999-09-17 13:04 ` Clint Adams
@ 1999-09-17 14:27 ` Oliver Kiddle
1999-09-17 14:44 ` Peter Stephenson
0 siblings, 1 reply; 13+ messages in thread
From: Oliver Kiddle @ 1999-09-17 14:27 UTC (permalink / raw)
To: zsh-workers
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)
)
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: PATCH: Re: _man only uses $manpath
1999-09-17 14:27 ` PATCH: " Oliver Kiddle
@ 1999-09-17 14:44 ` Peter Stephenson
0 siblings, 0 replies; 13+ messages in thread
From: Peter Stephenson @ 1999-09-17 14:44 UTC (permalink / raw)
To: zsh-workers
Oliver Kiddle wrote:
> 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.
> + manpath=( /usr/man(-/N)
/(opt|usr)/(dt|share|X11R6|local)/(cat|)man(-/N) )
If you read the manual, you'll see that / in () isn't supposed to work,
with one exception which you can use here --- it's not exactly what you
want, because it will match those names to any depth:
/(opt|usr)/(dt|share|X11R6|local/)#(cat|)man(-/N)
There are actually two problems here. The first is that the test for the
existence of a file segment in a closure is bungled. The patch below
is supposed to fix this. I can't see how the code as it is can be right.
(This wouldn't show up in this case, actually; only in the rare case where
you have a fixed string in (.../)#, as I did when testing the following,
which is presumably why no-one has ever noticed.)
The second is more subtle. (.../)# behaves like **/, not ***/, in that it
won't follow links, so if /usr/local is a link (as it is here, which is why
I'm writing this at all) it won't be included. That's deliberate, since
**/, and not ***/, is the abbreviation for (*/)#. But it's rather
inconvenient. I can't think of a really clean fix.
--- Src/glob.c.sfp Tue Sep 14 13:43:43 1999
+++ Src/glob.c Fri Sep 17 16:33:47 1999
@@ -476,7 +476,7 @@
if (!errflag && !(q->closure && !strcmp(str, "."))) {
addpath(str);
- if (!closure || statfullpath("", NULL, 1))
+ if (!closure || !statfullpath("", NULL, 1))
scanner((q->closure) ? q : q->next);
pathbuf[pathpos = oppos] = '\0';
}
--
Peter Stephenson <pws@ibmth.df.unipi.it> Tel: +39 050 844536
WWW: http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: _man only uses $manpath
1999-09-17 7:23 Sven Wischnowsky
@ 1999-09-17 9:35 ` Oliver Kiddle
0 siblings, 0 replies; 13+ messages in thread
From: Oliver Kiddle @ 1999-09-17 9:35 UTC (permalink / raw)
To: zsh-workers
Sven Wischnowsky wrote:
> Andrej Borsenkow wrote:
> > On Thu, 16 Sep 1999, Adam Spiers wrote:
> > > Sounds like we need some way of intelligently figuring out a solution
> > > for both scenarios. Does `man -w' return an error of some sort on
> > > your system which we could test for?
> > Well, exit code != 0. I have no idea, how reliable it is (different
> > versions etc)
>
> Same here for Digital Unix. Maybe we should test $OSTYPE?
The only man I can find which does support -w or --path is the GNU one.
The exit code of != 0 seems fine on the systems I've looked at provided
stderr is redirected.
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. The only way I know of finding the default manpath is by
running the man binary through strings. Maybe we could use a for loop to
guess possible man directories and check them.
Oliver Kiddle
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: _man only uses $manpath
@ 1999-09-17 7:23 Sven Wischnowsky
1999-09-17 9:35 ` Oliver Kiddle
0 siblings, 1 reply; 13+ messages in thread
From: Sven Wischnowsky @ 1999-09-17 7:23 UTC (permalink / raw)
To: zsh-workers
Andrej Borsenkow wrote:
> On Thu, 16 Sep 1999, Adam Spiers wrote:
>
> >
> > Sounds like we need some way of intelligently figuring out a solution
> > for both scenarios. Does `man -w' return an error of some sort on
> > your system which we could test for?
> >
> >
>
> Well, exit code != 0. I have no idea, how reliable it is (different
> versions etc)
Same here for Digital Unix. Maybe we should test $OSTYPE?
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: _man only uses $manpath
1999-09-16 16:21 ` Adam Spiers
@ 1999-09-16 16:26 ` Andrej Borsenkow
0 siblings, 0 replies; 13+ messages in thread
From: Andrej Borsenkow @ 1999-09-16 16:26 UTC (permalink / raw)
To: Adam Spiers; +Cc: zsh workers mailing list
On Thu, 16 Sep 1999, Adam Spiers wrote:
>
> Sounds like we need some way of intelligently figuring out a solution
> for both scenarios. Does `man -w' return an error of some sort on
> your system which we could test for?
>
>
Well, exit code != 0. I have no idea, how reliable it is (different
versions etc)
--
------------------------------------------------------------------------
Andrej Borsenkow Fax: +7 (095) 737 2747
Siemens ICP ITS Moscow Tel: +7 (095) 737 2723
E-Mail: Andrej.Borsenkow@mow.siemens.ru
-------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: _man only uses $manpath
1999-09-16 16:19 ` Andrej Borsenkow
@ 1999-09-16 16:21 ` Adam Spiers
1999-09-16 16:26 ` Andrej Borsenkow
0 siblings, 1 reply; 13+ messages in thread
From: Adam Spiers @ 1999-09-16 16:21 UTC (permalink / raw)
To: zsh workers mailing list
Andrej Borsenkow (Andrej.Borsenkow@mow.siemens.ru) wrote:
> On Thu, 16 Sep 1999, Adam Spiers wrote:
>
> > Shouldn't _man calculate man page completions using `man -w' rather
> > than $manpath? For me, $manpath is always empty, so man doesn't
> > complete anything.
> >
> > Is it safe to assume that `-w' is present in all sensible versions of
> > man?
>
> No. It is not supported on our system at least. And here I do need
> $MANPATH.
Hmm. What about man --path? Maybe only the GNU man has it.
Sounds like we need some way of intelligently figuring out a solution
for both scenarios. Does `man -w' return an error of some sort on
your system which we could test for?
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: _man only uses $manpath
1999-09-16 15:54 Adam Spiers
@ 1999-09-16 16:19 ` Andrej Borsenkow
1999-09-16 16:21 ` Adam Spiers
0 siblings, 1 reply; 13+ messages in thread
From: Andrej Borsenkow @ 1999-09-16 16:19 UTC (permalink / raw)
To: Adam Spiers; +Cc: zsh workers mailing list
On Thu, 16 Sep 1999, Adam Spiers wrote:
> Shouldn't _man calculate man page completions using `man -w' rather
> than $manpath? For me, $manpath is always empty, so man doesn't
> complete anything.
>
> Is it safe to assume that `-w' is present in all sensible versions of
> man?
>
>
No. It is not supported on our system at least. And here I do need
$MANPATH.
--
------------------------------------------------------------------------
Andrej Borsenkow Fax: +7 (095) 737 2747
Siemens ICP ITS Moscow Tel: +7 (095) 737 2723
E-Mail: Andrej.Borsenkow@mow.siemens.ru
-------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 13+ messages in thread
* _man only uses $manpath
@ 1999-09-16 15:54 Adam Spiers
1999-09-16 16:19 ` Andrej Borsenkow
0 siblings, 1 reply; 13+ messages in thread
From: Adam Spiers @ 1999-09-16 15:54 UTC (permalink / raw)
To: zsh workers mailing list
Shouldn't _man calculate man page completions using `man -w' rather
than $manpath? For me, $manpath is always empty, so man doesn't
complete anything.
Is it safe to assume that `-w' is present in all sensible versions of
man?
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~1999-09-17 15:20 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-09-17 9:45 _man only uses $manpath Sven Wischnowsky
1999-09-17 11:22 ` Adam Spiers
1999-09-17 12:43 ` Oliver Kiddle
1999-09-17 12:54 ` Clint Adams
1999-09-17 13:04 ` Clint Adams
1999-09-17 14:27 ` PATCH: " Oliver Kiddle
1999-09-17 14:44 ` Peter Stephenson
-- strict thread matches above, loose matches on Subject: below --
1999-09-17 7:23 Sven Wischnowsky
1999-09-17 9:35 ` Oliver Kiddle
1999-09-16 15:54 Adam Spiers
1999-09-16 16:19 ` Andrej Borsenkow
1999-09-16 16:21 ` Adam Spiers
1999-09-16 16:26 ` Andrej Borsenkow
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).