===================================================================
RCS file: /cvs/mandoc/cgi.c,v
retrieving revision 1.20
retrieving revision 1.23
diff -u -p -r1.20 -r1.23
--- mandoc/cgi.c 2011/12/09 11:29:19 1.20
+++ mandoc/cgi.c 2011/12/10 10:59:21 1.23
@@ -1,4 +1,4 @@
-/* $Id: cgi.c,v 1.20 2011/12/09 11:29:19 kristaps Exp $ */
+/* $Id: cgi.c,v 1.23 2011/12/10 10:59:21 kristaps Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons
*
@@ -128,6 +128,7 @@ kval_query(struct query *q, const struct kval *fields,
int i, legacy;
memset(q, 0, sizeof(struct query));
+ q->whatis = 1;
legacy = -1;
for (i = 0; i < (int)sz; i++)
@@ -158,10 +159,17 @@ kval_query(struct query *q, const struct kval *fields,
q->whatis = 1;
}
- /* Section "0" means no section when in legacy mode. */
+ /*
+ * Section "0" means no section when in legacy mode.
+ * For some man.cgi scripts, "default" arch is none.
+ */
- if (q->legacy && NULL != q->sec && 0 == strcmp(q->sec, "0"))
- q->sec = NULL;
+ if (q->legacy && NULL != q->sec)
+ if (0 == strcmp(q->sec, "0"))
+ q->sec = NULL;
+ if (q->legacy && NULL != q->arch)
+ if (0 == strcmp(q->arch, "default"))
+ q->arch = NULL;
}
/*
@@ -433,7 +441,7 @@ resp_error400(void)
"\n"
"The query your entered was malformed.\n"
"Try again from the\n"
- "main page\n"
+ "main page.\n"
"
", progname);
resp_end_html();
}
@@ -451,7 +459,7 @@ resp_error404(const char *page)
printf(",\n"
"could not be found.\n"
"Try searching from the\n"
- "main page\n"
+ "main page.\n"
"
", progname);
resp_end_html();
}
@@ -502,8 +510,9 @@ resp_search(struct res *r, size_t sz, void *arg)
kval_query(&q, req->fields, req->fieldsz);
if (0 == sz) {
- puts("\n"
- "No results found.");
+ printf("
\n"
+ "No %s results found.",
+ q.whatis ? "whatis" : "apropos");
if (q.whatis) {
printf("(Try