From 93dd310d31dfaf5095beb50ebca5e05ed3a728e2 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Sat, 12 Jul 2014 23:46:44 +0000 Subject: Polish the search form using feedback from beck@ and others, in particular introduce a section dropdown and an architecture dropdown. --- cgi.c | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 97 insertions(+), 28 deletions(-) (limited to 'cgi.c') diff --git a/cgi.c b/cgi.c index 5c53279a..b6859b3d 100644 --- a/cgi.c +++ b/cgi.c @@ -1,4 +1,4 @@ -/* $Id: cgi.c,v 1.67 2014/07/12 18:32:47 schwarze Exp $ */ +/* $Id: cgi.c,v 1.68 2014/07/12 23:46:44 schwarze Exp $ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons * Copyright (c) 2014 Ingo Schwarze @@ -81,6 +81,39 @@ static void resp_searchform(const struct req *); static const char *scriptname; /* CGI script name */ static const char *httphost; /* hostname used in the URIs */ +static const char *const sec_numbers[] = { + "0", "1", "2", "3", "3p", "4", "5", "6", "7", "8", "9" +}; +static const char *const sec_names[] = { + "All Sections", + "1 - General Commands", + "2 - System Calls", + "3 - Subroutines", + "3p - Perl Subroutines", + "4 - Special Files", + "5 - File Formats", + "6 - Games", + "7 - Macros and Conventions", + "8 - Maintenance Commands", + "9 - Kernel Interface" +}; +static const int sec_MAX = sizeof(sec_names) / sizeof(char *); + +static const char *const arch_names[] = { + "amd64", "alpha", "armish", "armv7", + "aviion", "hppa", "hppa64", "i386", + "ia64", "landisk", "loongson", "luna88k", + "macppc", "mips64", "octeon", "sgi", + "socppc", "solbourne", "sparc", "sparc64", + "vax", "zaurus", + "amiga", "arc", "arm32", "atari", + "beagle", "cats", "hp300", "mac68k", + "mvme68k", "mvme88k", "mvmeppc", "palm", + "pc532", "pegasos", "pmax", "powerpc", + "sun3", "wgrisc", "x68k" +}; +static const int arch_MAX = sizeof(arch_names) / sizeof(char *); + /* * Print a character, escaping HTML along the way. * This will pass non-ASCII straight to output: be warned! @@ -338,38 +371,65 @@ resp_searchform(const struct req *req) printf("
\n" "
\n" "
\n" - "Search Parameters\n" - " " - "for manuals \n", + "Manual Page Search Parameters\n", scriptname); - printf("q.expr) + html_print(req->q.expr); + puts("\" SIZE=\"40\">"); + + /* Write submission and reset buttons. */ + + printf( "\n" + "\n"); + + /* Write show radio button */ + + printf( "\n" + "q.equal) - printf(" SELECTED=\"selected\""); - printf(">named\n" - "\n" - "\n" - "q.expr ? req->q.expr : ""); - printf("\">, section " - "q.sec ? req->q.sec : ""); - printf("\">, arch " - "q.arch ? req->q.arch : ""); - printf("\">"); + printf("CHECKED "); + printf( "NAME=\"apropos\" ID=\"show\" VALUE=\"0\">\n" + "\n"); + + /* Write section selector. */ + + printf( "\n" + ""); + + /* Write architecture selector. */ + + puts(""); + + /* Write manpath selector. */ + if (req->psz > 1) { - puts(", in "); for (i = 0; i < (int)req->psz; i++) { printf("
\n" "
\n" "
"); -- cgit v1.2.3-56-ge451