On Mon, Jan 02, 2023 at 09:01:23PM +0100, Bruno Haible wrote: > By doing this, you improved things on Solaris OpenIndiana. But it > got worse on FreeBSD, where the 'man' command has a '-w' option > that displays the location but does not have a '--where' option [1]. > Likewise on macOS, where 'man --path' is an alias for 'man -w'. > > How about, instead, reverting to option '-w' and disabling this > piece of code on Solaris (#ifndef __sun) ? > > Bruno > > [1] https://www.freebsd.org/cgi/man.cgi?query=man >
I've committed the following change that does what you suggest: diff --git a/ChangeLog b/ChangeLog index b31722ff55..f730d9f201 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2023-01-02 Gavin Smith <gavinsmith0...@gmail.com> + + * info/man.c (check_manpage_node): Revert to using "man -w" + instead of "man --where" to work on FreeBSD and macOS. + Disable this code if __sun is defined. From Bruno Haible. + 2023-01-02 Patrice Dumas <pertu...@free.fr> * tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line), diff --git a/info/man.c b/info/man.c index 39d011c57f..49a0d0636f 100644 --- a/info/man.c +++ b/info/man.c @@ -1,6 +1,6 @@ /* man.c: How to read and format man files. - Copyright 1995-2022 Free Software Foundation, Inc. + Copyright 1995-2023 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -63,14 +63,11 @@ static NODE **manpage_nodes = 0; size_t manpage_node_index = 0; size_t manpage_node_slots = 0; -#if PIPE_USE_FORK +#if PIPE_USE_FORK && !defined(__sun) -/* Check if a man page exists. Use "man --where" for this rather than getting +/* Check if a man page exists. Use "man -w" for this rather than getting the contents of the man page. This is faster if we are running - "info --where" and we don't need the contents. - - NB use man --where instead of man -w as the latter has a different meaning - on Solaris (update whatis database). */ + "info --where" and we don't need the contents. */ int check_manpage_node (char *pagename) { @@ -91,7 +88,7 @@ check_manpage_node (char *pagename) formatter = find_man_formatter(); if (!formatter) exit (1); - execl (formatter, formatter, "--where", pagename, (void *) 0); + execl (formatter, formatter, "-w", pagename, (void *) 0); exit (2); /* exec failed */ } else @@ -112,7 +109,9 @@ check_manpage_node (char *pagename) return 0; } -#else /* !PIPE_USE_FORK */ +#else /* !PIPE_USE_FORK || defined(__sun) */ +/* We check __sun because 'man -w' has a different meaning on + Solaris (update whatis database). */ int check_manpage_node (char *pagename)