+resp_searchform(const struct req *req, enum focus focus)
+{
+ int i;
+
+ printf("<form action=\"/%s\" method=\"get\">\n"
+ " <fieldset>\n"
+ " <legend>Manual Page Search Parameters</legend>\n",
+ scriptname);
+
+ /* Write query input box. */
+
+ printf(" <input type=\"text\" name=\"query\" value=\"");
+ if (req->q.query != NULL)
+ html_print(req->q.query);
+ printf( "\" size=\"40\"");
+ if (focus == FOCUS_QUERY)
+ printf(" autofocus");
+ puts(">");
+
+ /* Write submission buttons. */
+
+ printf( " <button type=\"submit\" name=\"apropos\" value=\"0\">"
+ "man</button>\n"
+ " <button type=\"submit\" name=\"apropos\" value=\"1\">"
+ "apropos</button>\n"
+ " <br/>\n");
+
+ /* Write section selector. */
+
+ puts(" <select name=\"sec\">");
+ for (i = 0; i < sec_MAX; i++) {
+ printf(" <option value=\"%s\"", sec_numbers[i]);
+ if (NULL != req->q.sec &&
+ 0 == strcmp(sec_numbers[i], req->q.sec))
+ printf(" selected=\"selected\"");
+ printf(">%s</option>\n", sec_names[i]);
+ }
+ puts(" </select>");
+
+ /* Write architecture selector. */
+
+ printf( " <select name=\"arch\">\n"
+ " <option value=\"default\"");
+ if (NULL == req->q.arch)
+ printf(" selected=\"selected\"");
+ puts(">All Architectures</option>");
+ for (i = 0; i < arch_MAX; i++) {
+ printf(" <option value=\"%s\"", arch_names[i]);
+ if (NULL != req->q.arch &&
+ 0 == strcmp(arch_names[i], req->q.arch))
+ printf(" selected=\"selected\"");
+ printf(">%s</option>\n", arch_names[i]);
+ }
+ puts(" </select>");
+
+ /* Write manpath selector. */
+
+ if (req->psz > 1) {
+ puts(" <select name=\"manpath\">");
+ for (i = 0; i < (int)req->psz; i++) {
+ printf(" <option ");
+ if (strcmp(req->q.manpath, req->p[i]) == 0)
+ printf("selected=\"selected\" ");
+ printf("value=\"");
+ html_print(req->p[i]);
+ printf("\">");
+ html_print(req->p[i]);
+ puts("</option>");
+ }
+ puts(" </select>");
+ }
+
+ puts(" </fieldset>\n"
+ "</form>");
+}
+
+static int
+validate_urifrag(const char *frag)