aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/cgi.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-07-09 08:53:28 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-07-09 08:53:28 +0000
commit0a240202f972c8246bb6e27854c1c2604f30bbb6 (patch)
tree9e976d9afad945ca42cf21b4a7e5f372a2051941 /cgi.c
parent2cf2df574b3dd9ddf7d581c66360314505d0a05f (diff)
downloadmandoc-0a240202f972c8246bb6e27854c1c2604f30bbb6.tar.gz
mandoc-0a240202f972c8246bb6e27854c1c2604f30bbb6.tar.zst
mandoc-0a240202f972c8246bb6e27854c1c2604f30bbb6.zip
include manpath= when printing queries, and omit empty parameters
Diffstat (limited to 'cgi.c')
-rw-r--r--cgi.c46
1 files changed, 33 insertions, 13 deletions
diff --git a/cgi.c b/cgi.c
index 3bf4c9fd..5b6fed23 100644
--- a/cgi.c
+++ b/cgi.c
@@ -1,4 +1,4 @@
-/* $Id: cgi.c,v 1.52 2014/07/09 07:30:47 schwarze Exp $ */
+/* $Id: cgi.c,v 1.53 2014/07/09 08:53:28 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014 Ingo Schwarze <schwarze@usta.de>
@@ -134,12 +134,22 @@ static void
http_printquery(const struct req *req)
{
- printf("&expr=");
- http_print(req->q.expr ? req->q.expr : "");
- printf("&sec=");
- http_print(req->q.sec ? req->q.sec : "");
- printf("&arch=");
- http_print(req->q.arch ? req->q.arch : "");
+ if (NULL != req->q.manroot) {
+ printf("&manpath=");
+ http_print(req->q.manroot);
+ }
+ if (NULL != req->q.sec) {
+ printf("&sec=");
+ http_print(req->q.sec);
+ }
+ if (NULL != req->q.arch) {
+ printf("&arch=");
+ http_print(req->q.arch);
+ }
+ if (NULL != req->q.expr) {
+ printf("&expr=");
+ http_print(req->q.expr ? req->q.expr : "");
+ }
}
@@ -147,12 +157,22 @@ static void
html_printquery(const struct req *req)
{
- printf("&amp;expr=");
- html_print(req->q.expr ? req->q.expr : "");
- printf("&amp;sec=");
- html_print(req->q.sec ? req->q.sec : "");
- printf("&amp;arch=");
- html_print(req->q.arch ? req->q.arch : "");
+ if (NULL != req->q.manroot) {
+ printf("&amp;manpath=");
+ html_print(req->q.manroot);
+ }
+ if (NULL != req->q.sec) {
+ printf("&amp;sec=");
+ html_print(req->q.sec);
+ }
+ if (NULL != req->q.arch) {
+ printf("&amp;arch=");
+ html_print(req->q.arch);
+ }
+ if (NULL != req->q.expr) {
+ printf("&amp;expr=");
+ html_print(req->q.expr ? req->q.expr : "");
+ }
}
static void