From 910ad63849bea2b09b02b8fd7dbf18f78869967c Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Wed, 7 Dec 2011 15:55:06 +0000 Subject: Add skeleton man.cgi.css file. I don't think this should become more complicated than this. Also make the title be printed out in caps as it is in apropos(1) and whatis(1). --- cgi.c | 47 +++++++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 20 deletions(-) (limited to 'cgi.c') diff --git a/cgi.c b/cgi.c index bed8fb2d..b81c0069 100644 --- a/cgi.c +++ b/cgi.c @@ -295,8 +295,8 @@ resp_begin_html(int code, const char *msg) " \"http://www.w3.org/TR/html4/strict.dtd\">" "\n" "" "\n" " " "\n" - " " "\n" + " " "\n" " " "\n" " System Manpage Reference" "\n" @@ -339,21 +339,20 @@ resp_searchform(const struct req *req) printf("
\n"); - puts("
\n" - " or \n" - " for manuals satisfying \n" - "\n" + " or \n" + " for manuals satisfying \n" + ", section " - ", section " + ", arch " - ", arch " + ".\n" "\n" @@ -424,6 +423,7 @@ static void resp_search(struct res *r, size_t sz, void *arg) { int i; + char *cp; if (1 == sz) { /* @@ -441,23 +441,30 @@ resp_search(struct res *r, size_t sz, void *arg) resp_begin_html(200, NULL); resp_searchform((const struct req *)arg); - if (0 == sz) + if (0 == sz) { puts("

No results found.

"); + resp_end_html(); + return; + } + + puts("

\n" + ""); for (i = 0; i < (int)sz; i++) { - printf("

"); } resp_end_html(); -- cgit
", r[i].volume, r[i].rec); - html_print(r[i].title); + for (cp = r[i].title; '\0' != *cp; cp++) + html_putchar(toupper((unsigned char)*cp)); putchar('('); html_print(r[i].cat); if (r[i].arch && '\0' != *r[i].arch) { putchar('/'); html_print(r[i].arch); } - printf(") "); + printf(")"); html_print(r[i].desc); - puts("

"); + puts("