source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: Don't retain the search query in the resulting manual links.
Date: Mon, 4 Jan 2016 07:36:56 -0500 (EST)	[thread overview]
Message-ID: <17971962241608732390.enqueue@fantadrom.bsd.lv> (raw)

Log Message:
-----------
Don't retain the search query in the resulting manual links.
Clean, simple URLs are best.
Patch from bentley@.

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

Revision Data
-------------
Index: cgi.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/cgi.c,v
retrieving revision 1.115
retrieving revision 1.116
diff -Lcgi.c -Lcgi.c -u -p -r1.115 -r1.116
--- cgi.c
+++ cgi.c
@@ -63,9 +63,6 @@ static	void		 html_print(const char *);
 static	void		 html_putchar(char);
 static	int		 http_decode(char *);
 static	void		 http_parse(struct req *, const char *);
-static	void		 http_print(const char *);
-static	void		 http_putchar(char);
-static	void		 http_printquery(const struct req *, const char *);
 static	void		 pathgen(struct req *);
 static	void		 pg_error_badrequest(const char *);
 static	void		 pg_error_internal(void);
@@ -149,40 +146,6 @@ html_putchar(char c)
 	}
 }
 
-static void
-http_printquery(const struct req *req, const char *sep)
-{
-
-	if (NULL != req->q.query) {
-		printf("query=");
-		http_print(req->q.query);
-	}
-	if (0 == req->q.equal)
-		printf("%sapropos=1", sep);
-	if (NULL != req->q.sec) {
-		printf("%ssec=", sep);
-		http_print(req->q.sec);
-	}
-	if (NULL != req->q.arch) {
-		printf("%sarch=", sep);
-		http_print(req->q.arch);
-	}
-	if (strcmp(req->q.manpath, req->p[0])) {
-		printf("%smanpath=", sep);
-		http_print(req->q.manpath);
-	}
-}
-
-static void
-http_print(const char *p)
-{
-
-	if (NULL == p)
-		return;
-	while ('\0' != *p)
-		http_putchar(*p++);
-}
-
 /*
  * Call through to html_putchar().
  * Accepts NULL strings.
@@ -303,20 +266,6 @@ next:
 	}
 }
 
-static void
-http_putchar(char c)
-{
-
-	if (isalnum((unsigned char)c)) {
-		putchar((unsigned char)c);
-		return;
-	} else if (' ' == c) {
-		putchar('+');
-		return;
-	}
-	printf("%%%.2x", c);
-}
-
 /*
  * HTTP-decode a string.  The standard explanation is that this turns
  * "%4e+foo" into "n foo" in the regular way.  This is done in-place
@@ -623,9 +572,8 @@ pg_searchres(const struct req *req, stru
 		 * without any delay.
 		 */
 		printf("Status: 303 See Other\r\n");
-		printf("Location: http://%s%s/%s/%s?",
+		printf("Location: http://%s%s/%s/%s",
 		    HTTP_HOST, scriptname, req->q.manpath, r[0].file);
-		http_printquery(req, "&");
 		printf("\r\n"
 		     "Content-Type: text/html; charset=utf-8\r\n"
 		     "\r\n");
@@ -640,9 +588,8 @@ pg_searchres(const struct req *req, stru
 	for (i = 0; i < sz; i++) {
 		printf("<TR>\n"
 		       "<TD CLASS=\"title\">\n"
-		       "<A HREF=\"%s/%s/%s?",
+		       "<A HREF=\"%s/%s/%s",
 		    scriptname, req->q.manpath, r[i].file);
-		http_printquery(req, "&amp;");
 		printf("\">");
 		html_print(r[i].names);
 		printf("</A>\n"
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

                 reply	other threads:[~2016-01-04 12:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=17971962241608732390.enqueue@fantadrom.bsd.lv \
    --to=schwarze@mdocml.bsd.lv \
    --cc=source@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).