summaryrefslogtreecommitdiffstats
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
commit23a18e51d6be043e909d2538c8c720ccd7780ca8 (patch)
treef7e4f364ac32700b6f2314ee45f8a2cc967d9939 /cgi.c
parent4f4fcd43d21d85de72131727bce600371434c3e0 (diff)
downloadmandoc-23a18e51d6be043e909d2538c8c720ccd7780ca8.tar.gz
include manpath= when printing queries, and omit empty parameters
Diffstat (limited to 'cgi.c')
-rw-r--r--cgi.c44
1 files changed, 32 insertions, 12 deletions
diff --git a/cgi.c b/cgi.c
index 3d329308..424b99de 100644
--- a/cgi.c
+++ b/cgi.c
@@ -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