tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
* cgi.c does not add script name to links in manual pages
@ 2017-02-28  7:51 Andreas Vögele
  2017-03-18 16:23 ` Ingo Schwarze
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Vögele @ 2017-02-28  7:51 UTC (permalink / raw)
  To: tech

[-- 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);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: cgi.c does not add script name to links in manual pages
  2017-02-28  7:51 cgi.c does not add script name to links in manual pages Andreas Vögele
@ 2017-03-18 16:23 ` Ingo Schwarze
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Schwarze @ 2017-03-18 16:23 UTC (permalink / raw)
  To: Andreas Voegele; +Cc: tech

Hi,

Andreas Voegele wrote on Tue, Feb 28, 2017 at 08:51:02AM +0100:

> 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.

Committed.  Thanks for the patch!
  Ingo


Log Message:
-----------
Bugfix: use SCRIPT_NAME for .Xr hyperlinks.
Patch from <andreas at AndreasVoegele dot com>.

Modified Files:
--------------
    mdocml:
        cgi.c

Revision Data
-------------
Index: cgi.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/cgi.c,v
retrieving revision 1.151
retrieving revision 1.152
diff -Lcgi.c -Lcgi.c -u -p -r1.151 -r1.152
--- cgi.c
+++ cgi.c
@@ -839,7 +839,8 @@ resp_format(const struct req *req, const
 	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);
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-18 16:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-28  7:51 cgi.c does not add script name to links in manual pages Andreas Vögele
2017-03-18 16:23 ` Ingo Schwarze

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).