diff options
author | Chet Ramey <chet.ramey@case.edu> | 2011-12-03 13:52:14 -0500 |
---|---|---|
committer | Chet Ramey <chet.ramey@case.edu> | 2011-12-03 13:52:14 -0500 |
commit | e225d5a981b8102f9a5eda28861a19af7195def2 (patch) | |
tree | 892cb9dd74a37728beedc5335a32824496da83fb /support | |
parent | 1c72c0cd9221e759c16c1d4543d68188d6854032 (diff) | |
download | bash-e225d5a981b8102f9a5eda28861a19af7195def2.tar.gz |
commit bash-20051013 snapshot
Diffstat (limited to 'support')
-rw-r--r-- | support/man2html.c | 63 |
1 files changed, 47 insertions, 16 deletions
diff --git a/support/man2html.c b/support/man2html.c index d1ed8bc5..2432c13f 100644 --- a/support/man2html.c +++ b/support/man2html.c @@ -102,6 +102,10 @@ static char location_base[NULL_TERMINATED(MED_STR_MAX)] = ""; +static char th_page_and_sec[128] = { '\0' }; +static char th_datestr[128] = { '\0' }; +static char th_version[128] = { '\0' }; + char *signature = "<HR>\nThis document was created by man2html from %s.<BR>\nTime: %s\n"; /* timeformat for signature */ @@ -2148,6 +2152,26 @@ skip_till_newline(char *c) return c; } +static void +outputPageHeader(char *l, char *c, char *r) +{ + out_html("<TABLE WIDTH=100%>\n<TR>\n"); + out_html("<TH ALIGN=LEFT width=33%>"); + out_html(l); + out_html("<TH ALIGN=CENTER width=33%>"); + out_html(c); + out_html("<TH ALIGN=RIGHT width=33%>"); + out_html(r); + out_html("\n</TR>\n</TABLE>\n"); +} + +static void +outputPageFooter(char *l, char *c, char *r) +{ + out_html("<HR>\n"); + outputPageHeader(l, c, r); +} + static int ifelseval = 0; static char * @@ -2836,15 +2860,15 @@ scan_request(char *c) out_html(label); /* for mosaic users */ if (mode) - out_html("\"> </A>\n<H3>"); + out_html("\"> </A>\n<H4>"); else - out_html("\"> </A>\n<H2>"); + out_html("\"> </A>\n<H3>"); mandoc_synopsis = strncmp(c, "SYNOPSIS", 8) == 0; c = mandoc_command ? scan_troff_mandoc(c, 1, NULL) : scan_troff(c, 1, NULL); if (mode) - out_html("</H3>\n"); + out_html("</H4>\n"); else - out_html("</H2>\n"); + out_html("</H3>\n"); curpos = 0; break; case V('T', 'S'): @@ -2856,25 +2880,31 @@ scan_request(char *c) if (!output_possible) { sl = fill_words(c + j, wordlist, &words); if (words > 1) { - char page_and_sec[128]; - + char *t; for (i = 1; i < words; i++) wordlist[i][-1] = '\0'; *sl = '\0'; output_possible = 1; - sprintf(page_and_sec, "%s(%s)", wordlist[0], wordlist[1]); + sprintf(th_page_and_sec, "%s(%s)", wordlist[0], wordlist[1]); + if (words > 2) { + t = unescape(wordlist[2]); + strncpy(th_datestr, t, sizeof(th_datestr)); + th_datestr[sizeof(th_datestr) - 1] = '\0'; + } else + th_datestr[0] = '\0'; + if (words > 3) { + t = unescape(wordlist[3]); + strncpy(th_version, t, sizeof(th_version)); + th_version[sizeof(th_version) - 1] = '\0'; + } else + th_version[0] = '\0'; out_html("<HTML><HEAD>\n<TITLE>"); - out_html(page_and_sec); + out_html(th_page_and_sec); out_html(" Manual Page"); out_html("</TITLE>\n</HEAD>\n<BODY>"); - out_html("<TABLE WIDTH=100%>\n"); - out_html("<TH ALIGN=LEFT>"); - out_html(page_and_sec); - out_html("<TH ALIGN=CENTER>"); - out_html(unescape(wordlist[2])); - out_html("<TH ALIGN=RIGHT>"); - out_html(page_and_sec); - out_html("\n</TABLE>\n"); + + outputPageHeader(th_page_and_sec, th_datestr, th_page_and_sec); + out_html("<BR><A HREF=\"#index\">Index</A>\n"); *sl = '\n'; out_html("<HR>\n"); @@ -4023,6 +4053,7 @@ main(int argc, char **argv) out_html(NEWLINE); if (output_possible) { + outputPageFooter(th_version, th_datestr, th_page_and_sec); /* for mosaic users */ fputs("<HR>\n<A NAME=\"index\"> </A><H2>Index</H2>\n<DL>\n", stdout); manidx[mip] = 0; |