- int i;
- const char *expr, *sec, *arch;
-
- expr = sec = arch = "";
-
- for (i = 0; i < (int)req->fieldsz; i++)
- if (0 == strcmp(req->fields[i].key, "expr"))
- expr = req->fields[i].val;
- else if (0 == strcmp(req->fields[i].key, "sec"))
- sec = req->fields[i].val;
- else if (0 == strcmp(req->fields[i].key, "arch"))
- arch = req->fields[i].val;
-
- puts("<!-- Begin search form. //-->");
- printf("<FORM ACTION=\"");
- html_print(progname);
- printf("/search\" METHOD=\"get\">\n");
- puts(" <FIELDSET>" "\n"
- " <INPUT TYPE=\"submit\" VALUE=\"Search:\">");
- printf(" Terms: <INPUT TYPE=\"text\" "
- "SIZE=\"60\" NAME=\"expr\" VALUE=\"");
- html_print(expr);
- puts("\">");
- printf(" Section: <INPUT TYPE=\"text\" "
- "SIZE=\"4\" NAME=\"sec\" VALUE=\"");
- html_print(sec);
- puts("\">");
- printf(" Arch: <INPUT TYPE=\"text\" "
- "SIZE=\"8\" NAME=\"arch\" VALUE=\"");
- html_print(arch);
- puts("\">");
- puts(" </FIELDSET>\n</FORM>\n<!-- End search form. //-->");
+ 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>");