=================================================================== RCS file: /cvs/mandoc/cgi.c,v retrieving revision 1.131 retrieving revision 1.134 diff -u -p -r1.131 -r1.134 --- mandoc/cgi.c 2016/04/29 10:45:36 1.131 +++ mandoc/cgi.c 2016/07/10 10:05:33 1.134 @@ -1,4 +1,4 @@ -/* $Id: cgi.c,v 1.131 2016/04/29 10:45:36 schwarze Exp $ */ +/* $Id: cgi.c,v 1.134 2016/07/10 10:05:33 schwarze Exp $ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons * Copyright (c) 2014, 2015, 2016 Ingo Schwarze @@ -385,8 +385,7 @@ resp_searchform(const struct req *req, enum focus focu /* Write query input box. */ - printf( "
\n" - "q.query != NULL) html_print(req->q.query); printf( "\" size=\"40\""); @@ -394,24 +393,16 @@ resp_searchform(const struct req *req, enum focus focu printf(" autofocus"); puts(">"); - /* Write submission and reset buttons. */ + /* Write submission buttons. */ - printf( "\n" - "\n"); + printf( "\n" + "\n
\n"); - /* Write show radio button */ - - printf( "
\n" - "q.equal) - printf("checked=\"checked\" "); - printf( "name=\"apropos\" id=\"show\" value=\"0\">\n" - "\n"); - /* Write section selector. */ - puts( "
\n" - ""); for (i = 0; i < sec_MAX; i++) { printf("\n" - "q.equal) - printf("checked=\"checked\" "); - printf( "name=\"apropos\" id=\"search\" value=\"1\">\n" - "\n"); - - puts("
\n" - "\n" + puts("\n" "\n" ""); puts(""); @@ -489,9 +470,6 @@ validate_manpath(const struct req *req, const char* ma { size_t i; - if ( ! strcmp(manpath, "mandoc")) - return 1; - for (i = 0; i < req->psz; i++) if ( ! strcmp(manpath, req->p[i])) return 1; @@ -518,9 +496,9 @@ pg_index(const struct req *req) resp_searchform(req, FOCUS_QUERY); printf("

\n" "This web interface is documented in the\n" - "man.cgi\n" + "man.cgi(8)\n" "manual, and the\n" - "apropos\n" + "apropos(1)\n" "manual explains the query syntax.\n" "

\n", scriptname, *scriptname == '\0' ? "" : "/", @@ -903,13 +881,8 @@ pg_show(struct req *req, const char *fullpath) free(manpath); return; } + free(manpath); - if (strcmp(manpath, "mandoc")) { - free(req->q.manpath); - req->q.manpath = manpath; - } else - free(manpath); - if ( ! validate_filename(file)) { pg_error_badrequest( "You specified an invalid manual file."); @@ -1045,7 +1018,7 @@ main(void) if (*path != '\0') { parse_path_info(&req, path); - if (access(path, F_OK) == -1) + if (req.q.manpath == NULL || access(path, F_OK) == -1) path = ""; } else if ((querystring = getenv("QUERY_STRING")) != NULL) parse_query_string(&req, querystring);