=================================================================== RCS file: /cvs/mandoc/cgi.c,v retrieving revision 1.122 retrieving revision 1.124 diff -u -p -r1.122 -r1.124 --- mandoc/cgi.c 2016/04/14 23:48:48 1.122 +++ mandoc/cgi.c 2016/04/15 00:37:50 1.124 @@ -1,4 +1,4 @@ -/* $Id: cgi.c,v 1.122 2016/04/14 23:48:48 schwarze Exp $ */ +/* $Id: cgi.c,v 1.124 2016/04/15 00:37:50 schwarze Exp $ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons * Copyright (c) 2014, 2015, 2016 Ingo Schwarze @@ -588,34 +588,37 @@ pg_searchres(const struct req *req, struct manpage *r, resp_begin_html(200, NULL); resp_searchform(req); - puts("
"); - puts(""); - for (i = 0; i < sz; i++) { - printf("\n" - "\n" - "\n" - ""); - } + if (sz > 1) { + puts("
"); + puts("
\n" - "q.manpath, r[i].file); - printf("\">"); - html_print(r[i].names); - printf("\n" - ""); - html_print(r[i].output); - puts("
"); - puts("
\n" - "
"); + for (i = 0; i < sz; i++) { + printf("\n" + "\n" + "q.manpath, r[i].file); + printf("\">"); + html_print(r[i].names); + printf("\n" + "\n" + ""); + html_print(r[i].output); + puts("\n" + ""); + } + puts("\n" + ""); + } + /* * In man(1) mode, show one of the pages * even if more than one is found. */ - if (req->q.equal) { + if (req->q.equal || sz == 1) { puts("
"); iuse = 0; priouse = 20; @@ -1034,9 +1037,10 @@ main(void) else if (*path == '/') path++; - if (*path != '\0' && access(path, F_OK) == -1) { + if (*path != '\0') { path_parse(&req, path); - path = ""; + if (access(path, F_OK) == -1) + path = ""; } else if ((querystring = getenv("QUERY_STRING")) != NULL) http_parse(&req, querystring);