From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: Provide a dropdown entry "All Architectures" and make it the
Date: Thu, 24 Jul 2014 04:26:57 -0400 (EDT) [thread overview]
Message-ID: <201407240826.s6O8Qvft022823@krisdoz.my.domain> (raw)
Log Message:
-----------
Provide a dropdown entry "All Architectures" and make it the default.
Still, amd64 remains the default in the following sense:
If a man(1) mode search returns more than one page of the same name,
prefer amd64 over other architectures for immediate display.
ok deraadt@ daniel@
Modified Files:
--------------
mdocml:
cgi.c
Revision Data
-------------
Index: cgi.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/cgi.c,v
retrieving revision 1.80
retrieving revision 1.81
diff -Lcgi.c -Lcgi.c -u -p -r1.80 -r1.81
--- cgi.c
+++ cgi.c
@@ -422,7 +422,11 @@ resp_searchform(const struct req *req)
/* Write architecture selector. */
- puts("<SELECT NAME=\"arch\">");
+ printf( "<SELECT NAME=\"arch\">\n"
+ "<OPTION VALUE=\"default\"");
+ if (NULL == req->q.arch)
+ printf(" SELECTED");
+ puts(">All Architectures</OPTION>");
for (i = 0; i < arch_MAX; i++) {
printf("<OPTION VALUE=\"%s\"", arch_names[i]);
if (NULL != req->q.arch &&
@@ -559,7 +563,9 @@ pg_error_internal(void)
static void
pg_searchres(const struct req *req, struct manpage *r, size_t sz)
{
+ char *arch, *archend;
size_t i, iuse, isec;
+ int archprio, archpriouse;
int prio, priouse;
char sec;
@@ -622,12 +628,30 @@ pg_searchres(const struct req *req, stru
puts("<HR>");
iuse = 0;
priouse = 10;
+ archpriouse = 3;
for (i = 0; i < sz; i++) {
isec = strcspn(r[i].file, "123456789");
sec = r[i].file[isec];
if ('\0' == sec)
continue;
prio = sec_prios[sec - '1'];
+ if (NULL == req->q.arch) {
+ archprio =
+ (NULL == (arch = strchr(
+ r[i].file + isec, '/'))) ? 3 :
+ (NULL == (archend = strchr(
+ arch + 1, '/'))) ? 0 :
+ strncmp(arch, "amd64/",
+ archend - arch) ? 2 : 1;
+ if (archprio < archpriouse) {
+ archpriouse = archprio;
+ priouse = prio;
+ iuse = i;
+ continue;
+ }
+ if (archprio > archpriouse)
+ continue;
+ }
if (prio >= priouse)
continue;
priouse = prio;
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
next reply other threads:[~2014-07-24 8:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-24 8:26 schwarze [this message]
-- strict thread matches above, loose matches on Subject: below --
2014-07-24 8:26 schwarze
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201407240826.s6O8Qvft022823@krisdoz.my.domain \
--to=schwarze@mdocml.bsd.lv \
--cc=source@mdocml.bsd.lv \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).