diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-12-07 15:12:34 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-12-07 15:12:34 +0000 |
commit | 4c2e6a534c31f69cc3ff5bf8348cee02c95a637a (patch) | |
tree | 51a92728d515efcdf2f03ffcebc42dfc055d1223 /cgi.c | |
parent | 599529fe8cec0ee754a5030abaa9a8d842f90977 (diff) | |
download | mandoc-4c2e6a534c31f69cc3ff5bf8348cee02c95a637a.tar.gz |
Accept old-school man.cgi parameters like "sektion" and "query". This still
needs work because specifying an arch with "arch=i386" will return results
that don't have an arch specified. I think this is weird, but it will need
to be supported if we want backwards compatibility.
Diffstat (limited to 'cgi.c')
-rw-r--r-- | cgi.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -323,11 +323,18 @@ resp_searchform(const struct req *req) 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, "query")) + 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, "sektion")) + sec = req->fields[i].val; else if (0 == strcmp(req->fields[i].key, "arch")) arch = req->fields[i].val; + if (NULL != sec && 0 == strcmp(sec, "0")) + sec = NULL; + puts("<!-- Begin search form. //-->"); printf("<FORM ACTION=\""); html_print(progname); @@ -745,14 +752,24 @@ pg_search(const struct manpaths *ps, const struct req *req, char *path) for (sz = i = 0; i < (int)req->fieldsz; i++) if (0 == strcmp(req->fields[i].key, "expr")) ep = req->fields[i].val; + else if (0 == strcmp(req->fields[i].key, "query")) + ep = req->fields[i].val; else if (0 == strcmp(req->fields[i].key, "sec")) opt.cat = req->fields[i].val; + else if (0 == strcmp(req->fields[i].key, "sektion")) + 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, "apropos")) + whatis = 0 == strcmp + (req->fields[i].val, "0"); else if (0 == strcmp(req->fields[i].key, "op")) whatis = 0 == strcasecmp (req->fields[i].val, "whatis"); + if (NULL != opt.cat && 0 == strcmp(opt.cat, "0")) + opt.cat = NULL; + /* * Poor man's tokenisation. * Just break apart by spaces. |