On Fri, 26 Apr 2002, James Olin Oden wrote: > > I'm often more on design than a straight forward solution, > > but you are right GNU man does not support /opt/*/man well, > > hey that could be another way, enhance the GNU man to support > > wildcards with glob() ... something like this > > > I like that idea also. If it is a security problem in a particular > environment, it could be turned off. Really, it could be turned off by > default, and then if someone needed it it could be turned on. For > packagers thought the /etc/man.config.d would probably be for the best, but > for a sysamdin the globbing approach would probably be best. > MANPATH globbing is also very easy to implement, actually so simple I did it already :) I'm still thinking /etc/man.config.d/ support possibilities. As the /etc/man.config is just flat config with really no really need stacked options or anything and the /etc/man.config.d/ could be achieved simply modifying read_config_file() to traverse the directory and include all configs. Will possibly look it further later, if someone else does not like to implement it. BTW The ready made RPMs with glob support for test can be found from http://people.jyu.fi/~mesrik/tmp/man/ I think the glob feature with MANPATH at /etc/man.config is useful, and suggest that it would be worth merging it to main tree. HTH, :-) riku --- man-1.5j/src/man-config.c.dist Fri Apr 26 20:23:21 2002 +++ man-1.5j/src/man-config.c Fri Apr 26 23:06:48 2002 @@ -19,6 +19,14 @@ #include <string.h> #include <stdlib.h> +#ifndef NOGLOB +/* Can't refer to system <glob.h> as long as there is local glob.h + on this same directory. Is that really needed any more or would + it be better replace glob_filename() with few lines of code and + call to glob from libc ? -- mesrik@cc.jyu.fi */ +#include "/usr/include/glob.h" +#endif + #include "defs.h" #include "man-config.h" #include "man.h" @@ -201,7 +209,10 @@ char *p; char buf[BUFSIZE]; FILE *config = NULL; - +#ifndef NOGLOB + glob_t gs; + char **gp; +#endif if (cf) { /* User explicitly specified a config file */ if ((config = fopen (cf, "r")) == NULL) { @@ -249,9 +260,24 @@ if (!strncmp ("MANPATH_MAP", bp, 11)) adddir (bp+11, 0); - else if (!strncmp ("MANPATH", bp, 7)) + else if (!strncmp ("MANPATH", bp, 7)) { +#ifndef NOGLOB + /* config glob manpath support - mesrik@cc.jyu.fi */ + p = bp+7; + while (whitespace(*p)) + p++; + if (!glob(p,0,NULL,&gs)) { + for (gp = gs.gl_pathv; *gp; gp++) { + adddir (*gp, 1); + } + } else { + adddir(bp+7,1); + } + globfree(&gs); +#else adddir (bp+7, 1); - else if(!strncmp ("MANDATORY_MANPATH", bp, 17))/* backwards compatible */ +#endif + } else if(!strncmp ("MANDATORY_MANPATH", bp, 17))/* backwards compatible */ adddir (bp+17, 1); else if (!strncmp ("FHS", bp, 3)) fhs = 1; --- man-1.5j/src/man.conf.in.diff Fri Apr 26 23:33:46 2002 +++ man-1.5j/src/man.conf.in Fri Apr 26 23:34:13 2002 @@ -40,6 +40,7 @@ MANPATH /usr/X11R6/man MANPATH /usr/local/man MANPATH /usr/kerberos/man +MANPATH /opt/*/man MANPATH /usr/man # # Uncomment if you want to include one of these by default --- man.spec.dist Fri Apr 26 23:51:42 2002 +++ man.spec Fri Apr 26 23:15:55 2002 @@ -5,7 +5,7 @@ Summary: A set of documentation tools: man, apropos and whatis. Name: man Version: 1.5j -Release: 6 +Release: 7 License: GPL Group: System Environment/Base Source0: ftp://ftp.win.tue.nl/pub/linux-local/utils/man/man-%{version}.tar.bz2 @@ -32,6 +32,7 @@ Patch24: man-1.5i2-initial.patch Patch25: man-1.5i2-legacy.patch Patch26: man-1.5j-sanitycheck.patch +Patch27: man-1.5j-globfeat.patch # Japanese patches Patch51: man-1.5h1-gencat.patch @@ -84,7 +85,7 @@ %endif %patch26 -p1 -b .sanitycheck - +%patch27 -p1 -b .globfeat #rm -f $RPM_BUILD_DIR/man-%{version}/man/en/man.conf.man find $RPM_BUILD_DIR/man-%{version} -type f|xargs perl -pi -e 's,man\.conf\(5\),man.config(5),g' @@ -227,6 +228,10 @@ %attr(0775,root,man) %dir %{cache}/X11R6/cat[123456789n] %changelog +* Fri Apr 26 2002 Riku Meskanen <mesrik@cc.jyy.fi> +- Added glob() to man.config MANPATH for supporting easier /opt + deployment, feature simplifies setting MANPATH /opt/*/man + * Mon Mar 25 2002 Bernhard Rosenkraenzer <bero@redhat.com> 1.5j-6 - Fix bugs #60676 and #61105 - Add /usr/local/man and /usr/X11R6/man to makewhatis default paths -- [ This .signature intentionally left blank ]