From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from localhost (fantadrom.bsd.lv [local]) by fantadrom.bsd.lv (OpenSMTPD) with ESMTPA id 37a75ac0 for ; Thu, 14 Apr 2016 19:14:47 -0500 (EST) Date: Thu, 14 Apr 2016 19:14:47 -0500 (EST) Message-Id: <5151856099009443713.enqueue@fantadrom.bsd.lv> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: schwarze@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: omit list of other results when there is only one match X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 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("
"); - puts(""); - for (i = 0; i < sz; i++) { - printf("\n" - "\n" - "\n" - ""); - } + if (sz > 1) { + puts("
"); + puts("
\n" - "q.manpath, r[i].file); - printf("\">"); - html_print(r[i].names); - printf("\n" - ""); - html_print(r[i].output); - puts("
"); + + for (i = 0; i < sz; i++) { + printf("\n" + "\n" + "\n" + ""); + } - puts("
\n" + "q.manpath, r[i].file); + printf("\">"); + html_print(r[i].names); + printf("\n" + ""); + html_print(r[i].output); + puts("
\n" - "
"); + puts("\n" + ""); + } /* * 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("
"); iuse = 0; priouse = 20; -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv