diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2014-07-09 08:53:28 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2014-07-09 08:53:28 +0000 |
commit | 0a240202f972c8246bb6e27854c1c2604f30bbb6 (patch) | |
tree | 9e976d9afad945ca42cf21b4a7e5f372a2051941 | |
parent | 2cf2df574b3dd9ddf7d581c66360314505d0a05f (diff) | |
download | mandoc-0a240202f972c8246bb6e27854c1c2604f30bbb6.tar.gz mandoc-0a240202f972c8246bb6e27854c1c2604f30bbb6.tar.zst mandoc-0a240202f972c8246bb6e27854c1c2604f30bbb6.zip |
include manpath= when printing queries, and omit empty parameters
-rw-r--r-- | cgi.c | 46 |
1 files changed, 33 insertions, 13 deletions
@@ -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("&expr="); - html_print(req->q.expr ? req->q.expr : ""); - printf("&sec="); - html_print(req->q.sec ? req->q.sec : ""); - printf("&arch="); - html_print(req->q.arch ? req->q.arch : ""); + if (NULL != req->q.manroot) { + printf("&manpath="); + html_print(req->q.manroot); + } + if (NULL != req->q.sec) { + printf("&sec="); + html_print(req->q.sec); + } + if (NULL != req->q.arch) { + printf("&arch="); + html_print(req->q.arch); + } + if (NULL != req->q.expr) { + printf("&expr="); + html_print(req->q.expr ? req->q.expr : ""); + } } static void |