* mdocml: omit list of other results when there is only one match
@ 2016-04-15 0:14 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2016-04-15 0:14 UTC (permalink / raw)
To: source
Log Message:
-----------
omit list of other results when there is only one match
Modified Files:
--------------
mdocml:
cgi.c
Revision Data
-------------
Index: cgi.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/cgi.c,v
retrieving revision 1.122
retrieving revision 1.123
diff -Lcgi.c -Lcgi.c -u -p -r1.122 -r1.123
--- cgi.c
+++ cgi.c
@@ -588,34 +588,37 @@ pg_searchres(const struct req *req, stru
resp_begin_html(200, NULL);
resp_searchform(req);
- puts("<DIV CLASS=\"results\">");
- puts("<TABLE>");
- for (i = 0; i < sz; i++) {
- printf("<TR>\n"
- "<TD CLASS=\"title\">\n"
- "<A HREF=\"/%s%s%s/%s",
- scriptname, *scriptname == '\0' ? "" : "/",
- req->q.manpath, r[i].file);
- printf("\">");
- html_print(r[i].names);
- printf("</A>\n"
- "</TD>\n"
- "<TD CLASS=\"desc\">");
- html_print(r[i].output);
- puts("</TD>\n"
- "</TR>");
- }
+ if (sz > 1) {
+ puts("<DIV CLASS=\"results\">");
+ puts("<TABLE>");
+
+ for (i = 0; i < sz; i++) {
+ printf("<TR>\n"
+ "<TD CLASS=\"title\">\n"
+ "<A HREF=\"/%s%s%s/%s",
+ scriptname, *scriptname == '\0' ? "" : "/",
+ req->q.manpath, r[i].file);
+ printf("\">");
+ html_print(r[i].names);
+ printf("</A>\n"
+ "</TD>\n"
+ "<TD CLASS=\"desc\">");
+ html_print(r[i].output);
+ puts("</TD>\n"
+ "</TR>");
+ }
- puts("</TABLE>\n"
- "</DIV>");
+ puts("</TABLE>\n"
+ "</DIV>");
+ }
/*
* In man(1) mode, show one of the pages
* even if more than one is found.
*/
- if (req->q.equal) {
+ if (req->q.equal || sz == 1) {
puts("<HR>");
iuse = 0;
priouse = 20;
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-04-15 0:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-15 0:14 mdocml: omit list of other results when there is only one match schwarze
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).