Index: apropos.1 =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/apropos.1,v retrieving revision 1.13 diff -u -r1.13 apropos.1 --- apropos.1 12 Dec 2011 02:00:49 -0000 1.13 +++ apropos.1 18 Dec 2011 14:48:27 -0000 @@ -239,11 +239,22 @@ .Sh ENVIRONMENT .Bl -tag -width Ds .It Ev MANPATH -Colon-separated paths overriding the default list of paths searched for +Colon-separated paths modifying the default list of paths searched for manual databases. Invalid paths, or paths without manual databases, are ignored. Overridden by .Fl M . +If +.Ev MANPATH +begins with a +.Sq \&: , +it is appended to the default list; +else if it ends with +.Sq \&: , +it is prepended to the default list; else if it contains +.Sq \&:: , +the default list is inserted between the colons. +If none of these conditions are met, it overrides the default list. .El .Sh FILES .Bl -tag -width "/etc/man.conf" -compact Index: catman.8 =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/catman.8,v retrieving revision 1.2 diff -u -r1.2 catman.8 --- catman.8 4 Dec 2011 22:52:50 -0000 1.2 +++ catman.8 18 Dec 2011 14:48:27 -0000 @@ -23,6 +23,7 @@ .Sh SYNOPSIS .Nm catman .Op Fl fv +.Op Fl C Ar file .Op Fl M Ar manpath .Op Fl m Ar manpath .Op Fl o Ar path @@ -37,6 +38,12 @@ Force an update to all files. .It Fl v Print each file being updated. +.It Fl C Ar file +Specify an alternative configuration +.Ar file +in +.Xr man.conf 5 +format. .It Fl M Ar manpath Use the colon-separated path instead of the default list of paths searched for @@ -44,7 +51,7 @@ databases. Invalid paths, or paths without manual databases, are ignored. .It Fl m Ar manpath -Append the colon-separated paths to the list of paths searched +Prepend the colon-separated paths to the list of paths searched for .Xr mandocdb 8 databases. @@ -70,6 +77,26 @@ If .Fl f is specified, all files are updated. +.Sh ENVIRONMENT +.Bl -tag -width Ds +.It Ev MANPATH +Colon-separated paths modifying the default list of paths searched for +manual databases. +Invalid paths, or paths without manual databases, are ignored. +Overridden by +.Fl M . +If +.Ev MANPATH +begins with a +.Sq \&: , +it is appended to the default list; +else if it ends with +.Sq \&: , +it is prepended to the default list; else if it contains +.Sq \&:: , +the default list is inserted between the colons. +If none of these conditions are met, it overrides the default list. +.El .Sh EXIT STATUS .Ex -std .Sh SEE ALSO Index: catman.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/catman.c,v retrieving revision 1.7 diff -u -r1.7 catman.c --- catman.c 16 Dec 2011 12:06:35 -0000 1.7 +++ catman.c 18 Dec 2011 14:48:27 -0000 @@ -66,7 +66,7 @@ main(int argc, char *argv[]) { int ch; - char *aux, *base; + char *aux, *base, *conf_file; struct manpaths dirs; char buf[MAXPATHLEN]; extern char *optarg; @@ -81,8 +81,11 @@ aux = base = NULL; xstrlcpy(buf, "/var/www/cache/man.cgi", MAXPATHLEN); - while (-1 != (ch = getopt(argc, argv, "fm:M:o:v"))) + while (-1 != (ch = getopt(argc, argv, "C:fm:M:o:v"))) switch (ch) { + case ('C'): + conf_file = optarg; + break; case ('f'): force = 1; break; @@ -112,7 +115,7 @@ } memset(&dirs, 0, sizeof(struct manpaths)); - manpath_parse(&dirs, NULL, base, aux); + manpath_parse(&dirs, conf_file, base, aux); ch = manup(&dirs, buf); manpath_free(&dirs); return(ch ? EXIT_SUCCESS : EXIT_FAILURE); @@ -124,6 +127,7 @@ fprintf(stderr, "usage: %s " "[-fv] " + "[-C file] " "[-o path] " "[-m manpath] " "[-M manpath]\n", Index: manpath.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/manpath.c,v retrieving revision 1.7 diff -u -r1.7 manpath.c --- manpath.c 13 Dec 2011 21:09:01 -0000 1.7 +++ manpath.c 18 Dec 2011 14:48:27 -0000 @@ -87,15 +87,40 @@ free(buf); pclose(stream); #else - manpath_parseline(dirs, auxp); + int append, prepend; + char *insert; - if (NULL == defp) - defp = getenv("MANPATH"); + insert = NULL; + append = prepend = 0; + file = NULL == file ? MAN_CONF_FILE : file; - if (NULL == defp) - manpath_manconf(dirs, file ? file : MAN_CONF_FILE); - else + if (NULL == defp && NULL != (defp = getenv("MANPATH"))) { + append = ':' == defp[0]; + if ( ! append && '\0' != defp[0]) + if (':' == defp[(int)strlen(defp) - 1]) + prepend = 1; + if ( ! append && ! prepend) + insert = strstr(defp, "::"); + } + + if (NULL == defp) { + manpath_manconf(dirs, file); + return; + } + + if (prepend) + manpath_manconf(dirs, file); + + if (NULL != insert) { + *insert++ = '\0'; manpath_parseline(dirs, defp); + manpath_manconf(dirs, file); + manpath_parseline(dirs, insert + 1); + } else + manpath_parseline(dirs, defp); + + if (append) + manpath_manconf(dirs, file); #endif } Index: whatis.1 =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/whatis.1,v retrieving revision 1.4 diff -u -r1.4 whatis.1 --- whatis.1 12 Dec 2011 02:00:49 -0000 1.4 +++ whatis.1 18 Dec 2011 14:48:27 -0000 @@ -111,11 +111,22 @@ .Sh ENVIRONMENT .Bl -tag -width Ds .It Ev MANPATH -Colon-separated paths overriding the default list of paths searched for +Colon-separated paths modifying the default list of paths searched for manual databases. Invalid paths, or paths without manual databases, are ignored. Overridden by .Fl M . +If +.Ev MANPATH +begins with a +.Sq \&: , +it is appended to the default list; +else if it ends with +.Sq \&: , +it is prepended to the default list; else if it contains +.Sq \&:: , +the default list is inserted between the colons. +If none of these conditions are met, it overrides the default list. .El .Sh FILES .Bl -tag -width "/etc/man.conf" -compact