tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: "Andreas Vögele" <andreas@andreasvoegele.com>
To: tech@mdocml.bsd.lv
Subject: cgi.c does not add script name to links in manual pages
Date: Tue, 28 Feb 2017 08:51:02 +0100	[thread overview]
Message-ID: <53dc1a39-71d8-e9fb-daa1-1b3b2dd3aa66@andreasvoegele.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 266 bytes --]

Hi,

attached is a patch that adds the script name to links in manual pages.

Without the patch links point to "http://www.example.org/apropos.1" 
instead of "http://www.example.org/cgi-bin/man.cgi/apropos.1" even if 
the script name is not empty.

Regards,
Andreas

[-- Attachment #2: cgi_c_href.diff --]
[-- Type: text/x-patch, Size: 503 bytes --]

--- mdocml-1.14.1/cgi.c.orig	2017-02-21 01:25:20.000000000 +0100
+++ mdocml-1.14.1/cgi.c	2017-02-25 18:33:31.760281123 +0100
@@ -803,7 +803,8 @@
 	conf.fragment = 1;
 	conf.style = mandoc_strdup(CSS_DIR "/mandoc.css");
 	usepath = strcmp(req->q.manpath, req->p[0]);
-	mandoc_asprintf(&conf.man, "/%s%s%%N.%%S",
+	mandoc_asprintf(&conf.man, "/%s%s%s%s%%N.%%S",
+	    scriptname, *scriptname == '\0' ? "" : "/",
 	    usepath ? req->q.manpath : "", usepath ? "/" : "");
 
 	mparse_result(mp, &man, NULL);

             reply	other threads:[~2017-02-28  7:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-28  7:51 Andreas Vögele [this message]
2017-03-18 16:23 ` Ingo Schwarze

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53dc1a39-71d8-e9fb-daa1-1b3b2dd3aa66@andreasvoegele.com \
    --to=andreas@andreasvoegele.com \
    --cc=tech@mdocml.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).