From: kristaps@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: Finishing touches on multi-manroot man.cgi.
Date: Sat, 10 Dec 2011 18:04:31 -0500 (EST) [thread overview]
Message-ID: <201112102304.pBAN4VkQ014558@krisdoz.my.domain> (raw)
Log Message:
-----------
Finishing touches on multi-manroot man.cgi. If more than one root is
specified, write them out using a SELECT box. Else write nothing (the
manroot will still be checked if it's specified).
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.26
retrieving revision 1.27
diff -Lcgi.c -Lcgi.c -u -p -r1.26 -r1.27
--- cgi.c
+++ cgi.c
@@ -364,6 +364,7 @@ resp_end_html(void)
static void
resp_searchform(const struct req *req)
{
+ int i;
puts("<!-- Begin search form. //-->");
printf("<FORM ACTION=\"");
@@ -385,7 +386,22 @@ resp_searchform(const struct req *req)
"<INPUT TYPE=\"text\""
" SIZE=\"8\" NAME=\"arch\" VALUE=\"");
html_print(req->q.arch ? req->q.arch : "");
- puts("\">.\n"
+ printf("\">");
+ if (req->psz > 1) {
+ puts(", <SELECT NAME=\"manpath\">");
+ for (i = 0; i < (int)req->psz; i++) {
+ printf("<OPTION %s VALUE=\"",
+ (i == req->q.manroot) ||
+ (0 == i && -1 == req->q.manroot) ?
+ "SELECTED=\"selected\"" : "");
+ html_print(req->p[i].name);
+ printf("\">");
+ html_print(req->p[i].name);
+ puts("</OPTION>");
+ }
+ puts("</SELECT>");
+ }
+ puts(".\n"
"<INPUT TYPE=\"reset\" VALUE=\"Reset\">\n"
"</FIELDSET>\n"
"</FORM>");
@@ -1100,14 +1116,17 @@ pathgen(DIR *dir, char *path, struct req
if (rc > 0) {
/* This also strips the trailing slash. */
- path[(int)sz - 1] = '\0';
+ path[(int)--sz] = '\0';
req->p = mandoc_realloc
(req->p,
(req->psz + 1) * sizeof(struct paths));
+ /*
+ * Strip out the leading "./" unless we're just a ".",
+ * in which case use an empty string as our name.
+ */
req->p[(int)req->psz].path = mandoc_strdup(path);
- /* And this strips out the leading "./". */
req->p[(int)req->psz].name =
- cp = mandoc_strdup(path + 2);
+ cp = mandoc_strdup(path + (1 == sz ? 1 : 2));
req->psz++;
/*
* The name is just the path with all the slashes taken
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
reply other threads:[~2011-12-10 23:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=201112102304.pBAN4VkQ014558@krisdoz.my.domain \
--to=kristaps@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).