From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from localhost (fantadrom.bsd.lv [local]); by fantadrom.bsd.lv (OpenSMTPD) with ESMTPA id 0963359e; for ; Thu, 7 May 2015 07:08:43 -0500 (EST) Date: Thu, 7 May 2015 07:08:43 -0500 (EST) Message-Id: <15650952966018548371.enqueue@fantadrom.bsd.lv> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: schwarze@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: Do not let the -m option or MANPATH with leading, trailing, or X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- Do not let the -m option or MANPATH with leading, trailing, or double colon override the default manpath, let them add to the default manpath. Only override the default manpath by the -M option, by MANPATH without leading, trailing, or double colon, or by "manpath" in man.conf(5). Problem reported by Jan Stary . Patch OK'ed by millert@. Modified Files: -------------- mdocml: manpath.c Revision Data ------------- Index: manpath.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/manpath.c,v retrieving revision 1.24 retrieving revision 1.25 diff -Lmanpath.c -Lmanpath.c -u -p -r1.24 -r1.25 --- manpath.c +++ manpath.c @@ -84,7 +84,6 @@ manconf_parse(struct manconf *conf, cons free(buf); pclose(stream); #else - char manpath_default[] = MANPATH_DEFAULT; char *insert; /* Always prepend -m. */ @@ -104,8 +103,6 @@ manconf_parse(struct manconf *conf, cons /* No MANPATH; use man.conf(5) only. */ if (NULL == defp || '\0' == defp[0]) { manconf_file(conf, file); - if (conf->manpath.sz == 0) - manpath_parseline(&conf->manpath, manpath_default, 0); return; } @@ -210,13 +207,14 @@ static void manconf_file(struct manconf *conf, const char *file) { const char *const toks[] = { "manpath", "output", "_whatdb" }; + char manpath_default[] = MANPATH_DEFAULT; FILE *stream; char *cp, *ep; size_t len, tok; if ((stream = fopen(file, "r")) == NULL) - return; + goto out; while ((cp = fgetln(stream, &len)) != NULL) { ep = cp + len; @@ -250,6 +248,7 @@ manconf_file(struct manconf *conf, const /* FALLTHROUGH */ case 0: /* manpath */ manpath_add(&conf->manpath, cp, 0); + *manpath_default = '\0'; break; case 1: /* output */ manconf_output(&conf->output, cp); @@ -258,8 +257,11 @@ manconf_file(struct manconf *conf, const break; } } - fclose(stream); + +out: + if (*manpath_default != '\0') + manpath_parseline(&conf->manpath, manpath_default, 0); } void -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv