===================================================================
RCS file: /cvs/mandoc/cgi.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -p -r1.11 -r1.12
--- mandoc/cgi.c 2011/12/07 11:52:36 1.11
+++ mandoc/cgi.c 2011/12/07 13:00:40 1.12
@@ -1,4 +1,4 @@
-/* $Id: cgi.c,v 1.11 2011/12/07 11:52:36 kristaps Exp $ */
+/* $Id: cgi.c,v 1.12 2011/12/07 13:00:40 kristaps Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons \n"
- " The query your entered was malformed.\n"
- " Try again from the\n"
- " main page\n"
- " \n"
+ " The query your entered was malformed.\n"
+ " Try again from the\n"
+ " main page\n"
+ "Malformed Query
\n"
- "Malformed Query
\n"
+ "
"); while (NULL != (p = fgetln(f, &len))) { @@ -721,7 +728,7 @@ static void pg_search(const struct manpaths *ps, const struct req *req, char *path) { size_t tt; - int i, sz, rc; + int i, sz, rc, whatis; const char *ep, *start; char **cp; struct opts opt; @@ -731,6 +738,7 @@ pg_search(const struct manpaths *ps, const struct req cp = NULL; ep = NULL; sz = 0; + whatis = 0; memset(&opt, 0, sizeof(struct opts)); @@ -741,6 +749,9 @@ pg_search(const struct manpaths *ps, const struct req opt.cat = req->fields[i].val; else if (0 == strcmp(req->fields[i].key, "arch")) opt.arch = req->fields[i].val; + else if (0 == strcmp(req->fields[i].key, "op")) + whatis = 0 == strcasecmp + (req->fields[i].val, "whatis"); /* * Poor man's tokenisation. @@ -770,7 +781,10 @@ pg_search(const struct manpaths *ps, const struct req * The resp_search() function is called with the results. */ - if (NULL != (expr = exprcomp(sz, cp, &tt))) + expr = whatis ? termcomp(sz, cp, &tt) : + exprcomp(sz, cp, &tt); + + if (NULL != expr) rc = apropos_search (ps->sz, ps->paths, &opt, expr, tt, (void *)req, resp_search);