From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from krisdoz.my.domain (schwarze@localhost [127.0.0.1]) by krisdoz.my.domain (8.14.5/8.14.5) with ESMTP id s6PK997Q032195 for ; Fri, 25 Jul 2014 16:09:09 -0400 (EDT) Received: (from schwarze@localhost) by krisdoz.my.domain (8.14.5/8.14.3/Submit) id s6PK99Mi015440; Fri, 25 Jul 2014 16:09:09 -0400 (EDT) Date: Fri, 25 Jul 2014 16:09:09 -0400 (EDT) Message-Id: <201407252009.s6PK99Mi015440@krisdoz.my.domain> 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: Sort the URI keys for .Xr links in the same order used by the X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- Sort the URI keys for .Xr links in the same order used by the search form, and leave out the manpath when it is the default. For building the HTML formatter options, do not use a static buffer. Modified Files: -------------- mdocml: cgi.c Revision Data ------------- Index: cgi.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/cgi.c,v retrieving revision 1.89 retrieving revision 1.90 diff -Lcgi.c -Lcgi.c -u -p -r1.89 -r1.90 --- cgi.c +++ cgi.c @@ -851,12 +851,13 @@ static void format(const struct req *req, const char *file) { struct mparse *mp; - int fd; struct mdoc *mdoc; struct man *man; void *vp; + char *opts; enum mandoclevel rc; - char opts[PATH_MAX + 128]; + int fd; + int usepath; if (-1 == (fd = open(file, O_RDONLY, 0))) { puts("

You specified an invalid manual file.

"); @@ -875,11 +876,14 @@ format(const struct req *req, const char return; } - snprintf(opts, sizeof(opts), "fragment,man=%s?" - "manpath=%s&query=%%N&sec=%%S%s%s", - scriptname, req->q.manpath, - req->q.arch ? "&arch=" : "", - req->q.arch ? req->q.arch : ""); + usepath = strcmp(req->q.manpath, req->p[0]); + mandoc_asprintf(&opts, + "fragment,man=%s?query=%%N&sec=%%S%s%s%s%s", + scriptname, + req->q.arch ? "&arch=" : "", + req->q.arch ? req->q.arch : "", + usepath ? "&manpath=" : "", + usepath ? req->q.manpath : ""); mparse_result(mp, &mdoc, &man, NULL); if (NULL == man && NULL == mdoc) { @@ -899,6 +903,7 @@ format(const struct req *req, const char html_free(vp); mparse_free(mp); + free(opts); } static void -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv