[man2html/el6] initial import
T.C. Hollingsworth
patches at fedoraproject.org
Fri May 18 07:34:40 UTC 2012
commit 8e298af3ec54e621079cf1dcd5f27a4e64dfb46c
Author: T.C. Hollingsworth <tchollingsworth at gmail.com>
Date: Fri May 18 03:16:09 2012 -0400
initial import
.gitignore | 2 +
man2html-BR-empty-line.patch | 17 ++
man2html-all-args.patch | 50 +++++
man2html-cgi.patch | 92 +++++++++
man2html-doc.patch | 84 +++++++++
man2html-double-quotes.patch | 32 ++++
man2html-escape-N.patch | 35 ++++
man2html-file-link.patch | 29 +++
man2html-format.patch | 20 ++
man2html-gcc-warnings.patch | 85 +++++++++
man2html-groff-segfault.patch | 78 ++++++++
man2html-hman-bashism.patch | 14 ++
man2html-hman.patch | 33 ++++
man2html-it-typo.patch | 14 ++
man2html-macro-longnames.patch | 146 +++++++++++++++
man2html-macro-priority.patch | 94 ++++++++++
man2html-new-macros.patch | 389 +++++++++++++++++++++++++++++++++++++++
man2html-noindex-segfault.patch | 24 +++
man2html-paths.patch | 28 +++
man2html-perl.patch | 16 ++
man2html-quotes.patch | 33 ++++
man2html-relative-links.patch | 28 +++
man2html-see-also-hman.patch | 31 +++
man2html-ungzip-makefile.patch | 9 +
man2html-ungzip.patch | 257 ++++++++++++++++++++++++++
man2html.conf | 7 +
man2html.spec | 227 +++++++++++++++++++++++
sources | 2 +
28 files changed, 1876 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..6bdd0f6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1,2 @@
+/man-1.6g.tar.gz
+/man2html_1.6g-6.debian.tar.gz
diff --git a/man2html-BR-empty-line.patch b/man2html-BR-empty-line.patch
new file mode 100644
index 0000000..189d263
--- /dev/null
+++ b/man2html-BR-empty-line.patch
@@ -0,0 +1,17 @@
+Ignore font change requests that are note followed by any words (closes: #489181).
+
+diff -ruN -x '*.rej' -x '*.orig' man-1.6f-old/man2html/man2html.c man-1.6f/man2html/man2html.c
+--- man-1.6f-old/man2html/man2html.c 2008-09-07 10:56:00.000000000 +0200
++++ man-1.6f/man2html/man2html.c 2008-09-07 10:56:54.000000000 +0200
+@@ -2131,7 +2131,10 @@
+ char font[2];
+ font[0] = c[0]; font[1] = c[1];
+ c = c+j;
+- if (*c == '\n') c++;
++ if (*c == '\n') {
++ c++;
++ break;
++ }
+ sl = fill_words(c, wordlist, SIZE(wordlist), &words, '\n');
+ c = sl+1;
+ /* .BR name (section)
diff --git a/man2html-all-args.patch b/man2html-all-args.patch
new file mode 100644
index 0000000..638e199
--- /dev/null
+++ b/man2html-all-args.patch
@@ -0,0 +1,50 @@
+Handle \$* and \$@ escapes.
+
+diff -ruN -x '*.rej' -x '*.orig' man-1.6e-old/man2html/man2html.c man-1.6e/man2html/man2html.c
+--- man-1.6e-old/man2html/man2html.c 2007-04-17 00:34:40.000000000 +0200
++++ man-1.6e/man2html/man2html.c 2007-04-17 00:29:47.000000000 +0200
+@@ -615,6 +615,7 @@
+ static char *
+ scan_escape(char *c) {
+ char *h=NULL;
++ char *tmp = NULL;
+ char b[10];
+ INTDEF *intd;
+ int exoutputp,exskipescape;
+@@ -630,8 +631,26 @@
+ case '$':
+ if (argument) {
+ c++;
+- i=(*c -'1');
+- if (!(h=argument[i])) h="";
++ if (*c == '*' || *c == '@') {
++ int len = 0;
++ int quote = (*c == '@') ? 2 : 0;
++
++ for (i = 0; ((h = argument[i])); i++)
++ len += strlen(h) + 1 + quote;
++ tmp = (char*) xmalloc(len + 1);
++ *tmp = 0;
++
++ for (i = 0; ((h = argument[i])); i++) {
++ sprintf(tmp, "%s %s%s%s", tmp,
++ quote ? "\"" : "",
++ h,
++ quote ? "\"" : "");
++ };
++ h = tmp + 1;
++ } else {
++ i=(*c -'1');
++ if (!(h=argument[i])) h="";
++ }
+ }
+ break;
+ case 'z':
+@@ -791,6 +810,7 @@
+ }
+ c++;
+ if (!skip_escape) out_html(h);
++ if (tmp) free(tmp);
+ return c;
+ }
+
diff --git a/man2html-cgi.patch b/man2html-cgi.patch
new file mode 100644
index 0000000..f4c9db6
--- /dev/null
+++ b/man2html-cgi.patch
@@ -0,0 +1,92 @@
+Only in ./debian/patches: man2html-double-quotes.patch
+diff -ur ../man2html-deb.orig/debian/sources/Makefile ./debian/sources/Makefile
+--- ../man2html-deb.orig/debian/sources/Makefile 2011-11-02 12:45:37.000000000 -0700
++++ ./debian/sources/Makefile 2011-12-15 05:31:23.702465064 -0700
+@@ -2,15 +2,15 @@
+ # $Id: Makefile 241 2011-01-09 20:55:40Z robert $
+ #
+ CC = gcc
+-CGI_DIR = $(PREFIX)/usr/lib/cgi-bin/man
++CGI_DIR = $(PREFIX)/usr/lib/man2html/cgi-bin/man
+ SHARE_DIR = $(PREFIX)/usr/share/man2html
+-DOC_DIR = $(PREFIX)/usr/share/doc/man2html-base
++DOC_DIR = $(PREFIX)/usr/share/doc/man2html
+
+-CGIBASE = /cgi-bin/man
+-MAN_CONFIG = /etc/manpath.config
++CGIBASE = /man
++MAN_CONFIG = /etc/man_db.conf
+
+ DEFINES = -DMAN_CONFIG='"$(MAN_CONFIG)"'
+-CFLAGS = -pipe -g -Wall -Wextra $(DEFINES) $(DEBIAN_CFLAGS)
++CFLAGS += -pipe -g -Wall -Wextra $(DEFINES)
+
+ #
+ # Installer program:
+@@ -32,13 +32,12 @@
+ $(CC) $(CFLAGS) $^ -o $@
+
+ install: targets
++ mkdir -p $(CGI_DIR)
++ mkdir -p $(SHARE_DIR)
++ mkdir -p $(DOC_DIR)
+ $(INSTALL) -p -m 0755 man2html.cgi $(CGI_DIR)/man2html
+- $(INSTALL) -p -m 0755 mansearch $(CGI_DIR)
+ $(INSTALL) -p -m 0755 manwhatis $(CGI_DIR)
+ ln $(CGI_DIR)/manwhatis $(CGI_DIR)/mansec
+- $(INSTALL) -p -m0644 swish++.conf $(SHARE_DIR)
+- $(INSTALL) -p -m0644 man.html $(DOC_DIR)/html
+-
+
+ clean:
+ rm -f *.o *~ core manwhatis mansec man2html.cgi
+Only in ./debian/sources: Makefile~
+diff -ur ../man2html-deb.orig/debian/sources/man2html.cgi.c ./debian/sources/man2html.cgi.c
+--- ../man2html-deb.orig/debian/sources/man2html.cgi.c 2011-11-02 12:45:37.000000000 -0700
++++ ./debian/sources/man2html.cgi.c 2011-12-15 05:23:34.806269725 -0700
+@@ -41,11 +41,11 @@
+ #endif
+
+ #ifndef CGIBASE
+-#define CGIBASE "/cgi-bin/man"
++#define CGIBASE "/man"
+ #endif
+
+ #ifndef LYNXCGIBASE
+-#define LYNXCGIBASE "lynxcgi:/usr/lib/cgi-bin/man"
++#define LYNXCGIBASE "lynxcgi:/usr/lib/man2html/cgi-bin/man"
+ #endif
+
+
+diff -ur ../man2html-deb.orig/debian/sources/man.html ./debian/sources/man.html
+--- ../man2html-deb.orig/debian/sources/man.html 2011-11-02 12:45:37.000000000 -0700
++++ ./debian/sources/man.html 2011-12-15 05:13:46.492823889 -0700
+@@ -13,12 +13,10 @@
+ Depending on how you are accessing this file you are now reading, at least one of
+ the following URL should work:
+ <UL>
+-<LI><A HREF="http://localhost/cgi-bin/man/man2html">http://localhost/cgi-bin/man/man2html</A>
+-<LI><A HREF="/cgi-bin/man/man2html">http:/cgi-bin/man/man2html</A>
++<LI><A HREF="http://localhost/man/man2html">http://localhost/cgi-bin/man/man2html</A>
++<LI><A HREF="/man/man2html">http:/cgi-bin/man/man2html</A>
+ <LI><A HREF="lynxcgi:/usr/lib/cgi-bin/man/man2html">lynxcgi:/usr/lib/cgi-bin/man/man2html</A>
+ (only if you are using <I>lynx</I> with lynxcgi support enabled)
+ </UL>
+-<P>
+-Please see the <A HREF="file:///usr/share/doc/man2html/README.Debian">/usr/share/doc/man2html/README.Debian</A> file for more details.
+ </BODY>
+ </HTML>
+diff -ur ../man2html-deb.orig/debian/sources/manwhatis.c ./debian/sources/manwhatis.c
+--- ../man2html-deb.orig/debian/sources/manwhatis.c 2011-11-02 12:45:37.000000000 -0700
++++ ./debian/sources/manwhatis.c 2011-12-15 05:24:06.484620719 -0700
+@@ -38,8 +38,8 @@
+
+ #define MAX 10000
+
+-#define CGIBASE "/cgi-bin/man"
+-#define LYNXCGIBASE "lynxcgi:/usr/lib/cgi-bin/man"
++#define CGIBASE "/man"
++#define LYNXCGIBASE "lynxcgi:/usr/lib/man2html/cgi-bin/man"
+
+ enum {mansec, manwhatis} called_as=manwhatis;
+ char manpath[200];
diff --git a/man2html-doc.patch b/man2html-doc.patch
new file mode 100644
index 0000000..09a2e86
--- /dev/null
+++ b/man2html-doc.patch
@@ -0,0 +1,84 @@
+diff -ur ../man-1.6g-orig/man2html/hman.1 ./man2html/hman.1
+--- ../man-1.6g-orig/man2html/hman.1 2007-12-31 14:27:36.000000000 -0700
++++ ./man2html/hman.1 2012-05-11 17:19:30.614092335 -0700
+@@ -33,13 +33,15 @@
+ .SH OPTIONS
+ .TP
+ .B \-\^P " browser"
+-Specify which browser (like lynx, xmosaic, arena, chimera,
+-netscape, amaya, ...) to use.
++Specify which browser (like lynx, elinks, firefox, or chromium-browser, ...)
++to use.
+ This option overrides the
+ .B MANHTMLPAGER
+ environment variable.
+-The default is the non-httpd version of
+-.BR lynx .
++Otherwise,
++.B hman
++will use your system's default browser via
++.BR xdg-open (1) .
+ .TP
+ .B \-\^H " host"
+ Specify from what host to get the man pages.
+@@ -60,10 +62,3 @@
+ .SH "SEE ALSO"
+ .BR man (1),
+ .BR man2html (1),
+-.BR arena (1),
+-.BR lynx (1),
+-.BR netscape (1),
+-.BR xmosaic (1),
+-.BR glimpse (1)
+-
+-http://www.mcom.com/newsref/std/x-remote.html
+diff -ur ../man-1.6g-orig/man2html/man2html.1 ./man2html/man2html.1
+--- ../man-1.6g-orig/man2html/man2html.1 2007-12-31 14:27:36.000000000 -0700
++++ ./man2html/man2html.1 2012-05-11 17:13:59.360876849 -0700
+@@ -39,7 +39,7 @@
+ .LP
+ .TS
+ l l.
+-foo(3x) "http://localhost/cgi-bin/man/man2html?3x+foo"
++foo(3x) "http://localhost/man/man2html?3x+foo"
+ method://string "method://string"
+ www.host.name "http://www.host.name"
+ ftp.host.name "ftp://ftp.host.name"
+@@ -87,7 +87,7 @@
+ .TP
+ .B \-\^l
+ Set method:cgipath to
+-.RI lynxcgi: /home/httpd .
++.RI lynxcgi: /usr/lib/man2html .
+ .TP
+ .BI \-\^L " dir"
+ Set method:cgipath to
+@@ -95,7 +95,7 @@
+ .TP
+ .BI \-\^M " man2htmlpath"
+ Set the man2htmlpath to use. The default is
+-.IR /cgi-bin/man/man2html .
++.IR /man/man2html .
+ .TP
+ .B \-\^p
+ Set separator to '/'.
+@@ -114,7 +114,7 @@
+ When some http daemon is running, lynx, or any other browser,
+ can be used to browse the man pages, using the http method.
+ The option \-l (for `lynxcgi') selects the former behaviour.
+-With it, the default cgipath is \fI/home/httpd\fP.
++With it, the default cgipath is \fI/usr/lib/man2html\fP.
+
+ In general, a cgi script can be called by
+ .IP
+@@ -137,8 +137,8 @@
+
+ .SH BUGS
+ There are many heuristics. The output will not always be perfect.
+-The lynxcgi method will not work if lynx was compiled without
+-selecting support for it. There may be problems with security.
++The lynxcgi method will not work if lynx is not configured for it.
++There may be problems with security.
+
+ .SH AUTHOR
+ Richard Verhoeven was the original author of
diff --git a/man2html-double-quotes.patch b/man2html-double-quotes.patch
new file mode 100644
index 0000000..97ee3a4
--- /dev/null
+++ b/man2html-double-quotes.patch
@@ -0,0 +1,32 @@
+Properly decode double quotes inside the quoted text (closes: #406098).
+
+diff -ruN -x '*.rej' -x '*.orig' man-1.6e-old/man2html/man2html.c man-1.6e/man2html/man2html.c
+--- man-1.6e-old/man2html/man2html.c 2007-04-20 10:55:11.000000000 +0200
++++ man-1.6e/man2html/man2html.c 2007-04-20 11:03:54.000000000 +0200
+@@ -1307,7 +1307,7 @@
+ */
+ static char *
+ fill_words(char *str, char *words[], int maxn, int *n, char eow) {
+- char *s = str;
++ char *s = str, *t;
+ int backslash = 0;
+ int skipspace = 0; /* 1 if space is not end-of-word */
+
+@@ -1316,8 +1316,15 @@
+ while (*s && (*s != '\n' || backslash)) {
+ if (!backslash) {
+ if (*s == '"') {
+- *s = '\a';
+- skipspace = !skipspace;
++ if (skipspace && *(s+1) == '"') {
++ /* "" inside the quoted text means " */
++ for (t = s++; t > words[*n]; t--)
++ *t = *(t-1);
++ words[*n]++;
++ } else {
++ *s = '\a';
++ skipspace = !skipspace;
++ }
+ } else if (*s == escapesym) {
+ backslash = 1;
+ } else if ((*s == ' ' || *s == '\t') && !skipspace) {
diff --git a/man2html-escape-N.patch b/man2html-escape-N.patch
new file mode 100644
index 0000000..b5f46ff
--- /dev/null
+++ b/man2html-escape-N.patch
@@ -0,0 +1,35 @@
+Add support for \N'n' groff sequences (closes: #348553).
+
+diff -ruN man-1.6c-old/man2html/man2html.c man-1.6c/man2html/man2html.c
+--- man-1.6c-old/man2html/man2html.c 2006-02-09 19:19:09.000000000 +0100
++++ man-1.6c/man2html/man2html.c 2006-02-09 19:17:53.000000000 +0100
+@@ -511,7 +511,7 @@
+ static char *
+ scan_escape(char *c) {
+ char *h=NULL;
+- char b[5];
++ char b[10];
+ INTDEF *intd;
+ int exoutputp,exskipescape;
+ int i,j;
+@@ -661,6 +661,20 @@
+ output_possible=exoutputp;
+ skip_escape=exskipescape;
+ break;
++ case 'N':
++ /* convert \N'ddd' into &#ddd; */
++ c++;
++ i=*c;
++ j=0;
++ b[j++] = '&';
++ b[j++] = '#';
++ while (*(++c) != i)
++ if (isdigit(*c) && j < sizeof(b) - 2)
++ b[j++] = *c;
++ b[j++] = ';';
++ b[j] = '\0';
++ h = b;
++ break;
+ case 'c': no_newline_output=1; break;
+ case '{': newline_for_fun++; h="";break;
+ case '}': if (newline_for_fun) newline_for_fun--; h="";break;
diff --git a/man2html-file-link.patch b/man2html-file-link.patch
new file mode 100644
index 0000000..5421943
--- /dev/null
+++ b/man2html-file-link.patch
@@ -0,0 +1,29 @@
+diff -Nur ../man-1.6g.orig/man2html/cgibase.c ./man2html/cgibase.c
+--- ../man-1.6g.orig/man2html/cgibase.c 2005-08-20 16:26:06.000000000 -0700
++++ ./man2html/cgibase.c 2011-12-15 02:45:00.826764389 -0700
+@@ -97,7 +97,7 @@
+
+ void
+ include_file_html(char *g) {
+- printf("<A HREF=\"file:/usr/include/%s\">%s</A>>", g,g);
++ printf("<A HREF=\"file:///usr/include/%s\">%s</A>>", g,g);
+ }
+
+ void
+diff -Nur ../man-1.6g.orig/man2html/man2html.c ./man2html/man2html.c
+--- ../man-1.6g.orig/man2html/man2html.c 2007-08-05 12:15:23.000000000 -0700
++++ ./man2html/man2html.c 2011-12-15 02:45:00.837764508 -0700
+@@ -116,11 +116,11 @@
+ ** www.host.name -> http://www.host.name
+ ** ftp.host.name -> ftp://ftp.host.name
+ ** name at host -> mailto:name at host
+- ** <name.h> -> file:/usr/include/name.h (guess)
++ ** <name.h> -> file:///usr/include/name.h (guess)
+ **
+ ** Other possible links to add in the future:
+ **
+- ** /dir/dir/file -> file:/dir/dir/file
++ ** /dir/dir/file -> file:///dir/dir/file
+ */
+ int i,j,nr;
+ char *f, *g, *h;
diff --git a/man2html-format.patch b/man2html-format.patch
new file mode 100644
index 0000000..35ace37
--- /dev/null
+++ b/man2html-format.patch
@@ -0,0 +1,20 @@
+--- ./debian.orig/sources/manwhatis.c 2011-11-02 12:45:37.000000000 -0700
++++ ./debian/sources/manwhatis.c 2012-05-13 15:15:40.690492812 -0700
+@@ -291,7 +291,7 @@
+ fputs("<center>",f);
+ for(j=33; j<sizeof(usedletters); j++)
+ if(usedletters[j])
+- fprintf(f,"<a href=\"#%c\">%c</a>\n",j,j);
++ fprintf(f,"<a href=\"#%c\">%c</a>\n",(char)j,(char)j);
+ fprintf(f,"<br><a href=\"%s/man2html\">Section index</a>\n", cgibase);
+ fputs("</center>\n<hr>\n",f);
+
+@@ -337,7 +337,7 @@
+ fputs("<hr>\n<center>\n",f);
+ for(j=0; j< sizeof(usedletters); j++)
+ if(usedletters[j])
+- fprintf(f,"<a href=\"#%c\">%c</a>\n",j,j);
++ fprintf(f,"<a href=\"#%c\">%c</a>\n",(char)j,(char)j);
+ fputs("</center>\n",f);
+
+ fprintf(f,"</body>\n</html>\n");
diff --git a/man2html-gcc-warnings.patch b/man2html-gcc-warnings.patch
new file mode 100644
index 0000000..8b94928
--- /dev/null
+++ b/man2html-gcc-warnings.patch
@@ -0,0 +1,85 @@
+Fix some gcc warnings.
+
+Index: man-1.6g/man2html/cgibase.c
+===================================================================
+--- man-1.6g.orig/man2html/cgibase.c 2011-01-09 17:49:52.000000000 +0100
++++ man-1.6g/man2html/cgibase.c 2011-01-09 17:51:03.000000000 +0100
+@@ -82,13 +82,13 @@
+ {
+ char timebuf[TIMEBUFSZ];
+ struct tm *timetm;
+- time_t clock;
++ time_t now;
+
+ timebuf[0] = 0;
+ #ifdef TIMEFORMAT
+ sprintf(timebuf, "Time: ");
+- clock=time(NULL);
+- timetm=gmtime(&clock);
++ now=time(NULL);
++ timetm=gmtime(&now);
+ strftime(timebuf+6, TIMEBUFSZ-6, TIMEFORMAT, timetm);
+ timebuf[TIMEBUFSZ-1] = 0;
+ #endif
+Index: man-1.6g/man2html/man2html.c
+===================================================================
+--- man-1.6g.orig/man2html/man2html.c 2011-01-09 17:49:52.000000000 +0100
++++ man-1.6g/man2html/man2html.c 2011-01-09 17:54:37.000000000 +0100
+@@ -644,7 +644,7 @@
+ *tmp = 0;
+
+ for (i = 0; ((h = argument[i])); i++) {
+- sprintf(tmp, "%s %s%s%s", tmp,
++ sprintf(tmp + strlen(tmp), " %s%s%s",
+ quote ? "\"" : "",
+ h,
+ quote ? "\"" : "");
+@@ -1720,12 +1720,12 @@
+ for (i=1; i<words; i++)
+ wordlist[i][-1]=0;
+ for (i=0; i<words; i++) {
+- char *h=NULL;
++ char *hl=NULL;
+ if (mandoc_command)
+- scan_troff_mandoc(wordlist[i],1,&h);
++ scan_troff_mandoc(wordlist[i],1,&hl);
+ else
+- scan_troff(wordlist[i],2,&h);
+- wordlist[i]=h;
++ scan_troff(wordlist[i],2,&hl);
++ wordlist[i]=hl;
+ }
+ for (i=words; i<SIZE(wordlist); i++)
+ wordlist[i]=NULL;
+@@ -1806,24 +1806,24 @@
+ single_escape=1;
+ curpos=0;
+ if (!de) {
+- char *h;
++ char *hl;
+ de=(STRDEF*) xmalloc(sizeof(STRDEF));
+ de->nr=i;
+ de->slen=0;
+ de->next=strdef;
+ de->st=NULL;
+ strdef=de;
+- h=NULL;
+- c=scan_troff(c, 1, &h);
+- de->st=h;
++ hl=NULL;
++ c=scan_troff(c, 1, &hl);
++ de->st=hl;
+ de->slen=curpos;
+ } else {
+ if (mode) { /* .ds */
+- char *h=NULL;
+- c=scan_troff(c, 1, &h);
++ char *hl=NULL;
++ c=scan_troff(c, 1, &hl);
+ free(de->st); /* segfault XXX */
+ de->slen=curpos;
+- de->st=h;
++ de->st=hl;
+ } else { /* .as */
+ c=scan_troff(c,1,&de->st); /* XXX */
+ de->slen+=curpos;
diff --git a/man2html-groff-segfault.patch b/man2html-groff-segfault.patch
new file mode 100644
index 0000000..5ce828b
--- /dev/null
+++ b/man2html-groff-segfault.patch
@@ -0,0 +1,78 @@
+Fix segfault when viewing groff(7) page.
+
+diff -ruN -x '*.rej' -x '*.orig' man-1.6e-old/man2html/man2html.c man-1.6e/man2html/man2html.c
+--- man-1.6e-old/man2html/man2html.c 2007-04-23 17:33:44.000000000 +0200
++++ man-1.6e/man2html/man2html.c 2007-04-23 17:33:45.000000000 +0200
+@@ -1673,7 +1673,7 @@
+
+ int i,j,mode = 0;
+ char *h;
+- char *wordlist[20];
++ char *wordlist[30];
+ int words;
+ char *sl;
+ LONGSTRDEF *owndef;
+@@ -1713,7 +1713,7 @@
+ if (mandoc_command)
+ scan_troff_mandoc(wordlist[i],1,&h);
+ else
+- scan_troff(wordlist[i],1,&h);
++ scan_troff(wordlist[i],2,&h);
+ wordlist[i]=h;
+ }
+ for (i=words; i<SIZE(wordlist); i++)
+@@ -1731,6 +1731,7 @@
+ newline_for_fun=onff;
+ argument=oldargument;
+ for (i=0; i<words; i++) if (wordlist[i]) free(wordlist[i]);
++ owndef->st[deflen+1]=0;
+ *sl='\n';
+ } else switch (i) {
+ case V('a','b'):
+@@ -2426,12 +2427,13 @@
+ j=3;
+ }
+ c=sl+1;
++ *sl=0;
+ sl=c;
+ while (*c && strncmp(c,wordlist[1],j)) c=skip_till_newline(c);
+ de = find_longstrdef(defdef, i, longname, &longname);
+ if (mode && de) olen=strlen(de->st);
+ j=olen+c-sl;
+- h= (char*) xmalloc((j*2+4)*sizeof(char));
++ h= (char*) xmalloc((j*2+5)*sizeof(char));
+ if (h) {
+ for (j=0; j<olen; j++)
+ h[j]=de->st[j];
+@@ -2452,6 +2454,7 @@
+ de = (LONGSTRDEF*) xmalloc(sizeof(LONGSTRDEF));
+ de->nr=i;
+ de->longname=longname;
++ de->slen=0;
+ de->next=defdef;
+ de->st=h;
+ defdef=de;
+@@ -2997,12 +3000,12 @@
+ h++;
+ FLUSHIBP;
+ h = scan_escape(h);
+- } else if (*h == controlsym && h[-1] == '\n') {
++ } else if (san != 2 && *h == controlsym && h[-1] == '\n') {
+ h++;
+ FLUSHIBP;
+ h = scan_request(h);
+ if (san && h[-1] == '\n') h--;
+- } else if (mandoc_line
++ } else if (san != 2 && mandoc_line
+ && *(h) && isupper(*(h))
+ && *(h+1) && islower(*(h+1))
+ && *(h+2) && isspace(*(h+2))) {
+@@ -3010,7 +3013,7 @@
+ FLUSHIBP;
+ h = scan_request(h);
+ if (san && h[-1] == '\n') h--;
+- } else if (*h == nobreaksym && h[-1] == '\n') {
++ } else if (san != 2 && *h == nobreaksym && h[-1] == '\n') {
+ h++;
+ FLUSHIBP;
+ h = scan_request(h);
diff --git a/man2html-hman-bashism.patch b/man2html-hman-bashism.patch
new file mode 100644
index 0000000..3459a4b
--- /dev/null
+++ b/man2html-hman-bashism.patch
@@ -0,0 +1,14 @@
+Remove bashism from hman
+
+diff -ruN man-1.6c-old/man2html/hman.sh man-1.6c/man2html/hman.sh
+--- man-1.6c-old/man2html/hman.sh 2003-03-11 16:53:29.000000000 +0100
++++ man-1.6c/man2html/hman.sh 2004-07-27 22:17:05.000000000 +0200
+@@ -42,7 +42,7 @@
+ fi
+
+ # Interface to a live (already running) netscape browser.
+-function nsfunc () {
++nsfunc () {
+ if ( /bin/ps xc | grep -q 'netscape$' ) ; then
+ if [ -x netscape-remote ] ; then
+ exec netscape-remote -remote "openURL($1,new_window)"
diff --git a/man2html-hman.patch b/man2html-hman.patch
new file mode 100644
index 0000000..0196284
--- /dev/null
+++ b/man2html-hman.patch
@@ -0,0 +1,33 @@
+--- ../man-1.6g-orig/man2html/hman.sh 2005-08-20 16:26:06.000000000 -0700
++++ ./man2html/hman.sh 2012-05-11 17:04:07.750683958 -0700
+@@ -22,9 +22,9 @@
+ exit 0
+ fi
+
+-# The user has to set MANHTMLPAGER (or he will get httpd-free lynx).
+-# Pick your favorite browser: lynx, xmosaic, netscape, arena, amaya, grail, ...
+-BROWSER=${MANHTMLPAGER-lynxcgi}
++# The user has to set MANHTMLPAGER (or they will get default via `xdg-open`).
++# Pick your favorite browser: lynx, elinks, firefox, chromium, etc. ...
++BROWSER=${MANHTMLPAGER-xdg-open}
+ #
+ # If the man pages are on a remote host, specify it in MANHTMLHOST.
+ HOST=${MANHTMLHOST-localhost}
+@@ -57,14 +57,14 @@
+ case $BROWSER in
+ lynxcgi)
+ BROWSER=lynx
+- CG="lynxcgi:/home/httpd/cgi-bin/man"
++ CG="lynxcgi:/usr/lib/man2html/cgi-bin/man"
+ ;;
+ netscape)
+ BROWSER=nsfunc
+- CG="http://$HOST/cgi-bin/man"
++ CG="http://$HOST/man"
+ ;;
+ *)
+- CG="http://$HOST/cgi-bin/man"
++ CG="http://$HOST/man"
+ ;;
+ esac
+
diff --git a/man2html-it-typo.patch b/man2html-it-typo.patch
new file mode 100644
index 0000000..7a80c1a
--- /dev/null
+++ b/man2html-it-typo.patch
@@ -0,0 +1,14 @@
+Fix syntax error in the Italian man2html(1) page.
+
+diff -ruN -x '*.rej' -x '*.orig' man-1.6e-old/man2html/locales/it/man2html.1 man-1.6e/man2html/locales/it/man2html.1
+--- man-1.6e-old/man2html/locales/it/man2html.1 2006-08-02 20:33:41.000000000 +0200
++++ man-1.6e/man2html/locales/it/man2html.1 2007-02-01 22:34:53.000000000 +0100
+@@ -62,7 +62,7 @@
+
+ .SH OPZIONI
+ Quando si legge da stdin non è sempre chiaro come effettuare l'espansione
+-.so . L'opzione \-D permette a uno script di definire la
++\&.so . L'opzione \-D permette a uno script di definire la
+ directory di lavoro.
+ .LP
+ .TP
diff --git a/man2html-macro-longnames.patch b/man2html-macro-longnames.patch
new file mode 100644
index 0000000..e6ff217
--- /dev/null
+++ b/man2html-macro-longnames.patch
@@ -0,0 +1,146 @@
+Support macro names longer than two chars (closes: #408232).
+
+diff -ruN -x '*.rej' -x '*.orig' man-1.6e-old/man2html/defs.h man-1.6e/man2html/defs.h
+--- man-1.6e-old/man2html/defs.h 2005-08-21 01:26:06.000000000 +0200
++++ man-1.6e/man2html/defs.h 2007-04-20 11:41:55.000000000 +0200
+@@ -8,6 +8,15 @@
+ STRDEF *next;
+ };
+
++typedef struct LONGSTRDEF LONGSTRDEF;
++struct LONGSTRDEF {
++ int nr,slen;
++ char *longname;
++ char *st;
++ LONGSTRDEF *next;
++};
++
++
+ typedef struct INTDEF INTDEF;
+ struct INTDEF {
+ int nr;
+@@ -16,12 +25,14 @@
+ INTDEF *next;
+ };
+
+-extern STRDEF *chardef, *strdef, *defdef;
++extern STRDEF *chardef, *strdef;
++extern LONGSTRDEF *defdef;
+ extern INTDEF *intdef;
+
+ #define V(A,B) ((A)*256+(B))
+
+ #include <sys/types.h>
++extern LONGSTRDEF *find_longstrdef(LONGSTRDEF* head, int nr, char * longname, char ** out_longname);
+ extern void stdinit(void);
+ extern void print_sig(void);
+ extern char *lookup_abbrev(char *);
+diff -ruN -x '*.rej' -x '*.orig' man-1.6e-old/man2html/man2html.c man-1.6e/man2html/man2html.c
+--- man-1.6e-old/man2html/man2html.c 2007-04-20 11:40:27.000000000 +0200
++++ man-1.6e/man2html/man2html.c 2007-04-20 11:43:40.000000000 +0200
+@@ -1676,7 +1676,7 @@
+ char *wordlist[20];
+ int words;
+ char *sl;
+- STRDEF *owndef;
++ LONGSTRDEF *owndef;
+
+ while (*c == ' ' || *c == '\t')
+ c++;
+@@ -2378,11 +2378,13 @@
+ /* .de xx yy : define or redefine macro xx; end at .yy (..) */
+ /* define or handle as .ig yy */
+ {
+- STRDEF *de;
++ LONGSTRDEF *de;
++ char *longname;
+ int olen=0;
+ c=c+j;
+ sl=fill_words(c, wordlist, SIZE(wordlist), &words, '\n');
+ i=V(c[0],c[1]);j=2;
++ longname = c;
+ if (words == 1) wordlist[1]=".."; else {
+ wordlist[1]--;
+ wordlist[1][0]='.';
+@@ -2391,8 +2393,7 @@
+ c=sl+1;
+ sl=c;
+ while (*c && strncmp(c,wordlist[1],j)) c=skip_till_newline(c);
+- de=defdef;
+- while (de && de->nr!= i) de=de->next;
++ de = find_longstrdef(defdef, i, longname, &longname);
+ if (mode && de) olen=strlen(de->st);
+ j=olen+c-sl;
+ h= (char*) xmalloc((j*2+4)*sizeof(char));
+@@ -2413,8 +2414,9 @@
+ if (de->st) free(de->st);
+ de->st=h;
+ } else {
+- de = (STRDEF*) xmalloc(sizeof(STRDEF));
++ de = (LONGSTRDEF*) xmalloc(sizeof(LONGSTRDEF));
+ de->nr=i;
++ de->longname=longname;
+ de->next=defdef;
+ de->st=h;
+ defdef=de;
+@@ -2893,13 +2895,12 @@
+
+ default:
+ /* search macro database of self-defined macros */
+- owndef = defdef;
+- while (owndef && owndef->nr!=i) owndef=owndef->next;
++ owndef = find_longstrdef(defdef, i, c, NULL);
+ if (owndef) {
+ char **oldargument;
+ int deflen;
+ int onff;
+- sl=fill_words(c+j, wordlist, SIZE(wordlist), &words, '\n');
++ sl=fill_words(c+strlen(owndef->longname), wordlist, SIZE(wordlist), &words, '\n');
+ c=sl+1;
+ *sl=0;
+ for (i=1; i<words; i++)
+diff -ruN -x '*.rej' -x '*.orig' man-1.6e-old/man2html/strdefs.c man-1.6e/man2html/strdefs.c
+--- man-1.6e-old/man2html/strdefs.c 2007-04-20 11:40:27.000000000 +0200
++++ man-1.6e/man2html/strdefs.c 2007-04-20 11:43:55.000000000 +0200
+@@ -1,4 +1,6 @@
+ #include "defs.h"
++#include <ctype.h>
++#include <string.h>
+
+ #ifndef NULL
+ #define NULL ((void *) 0)
+@@ -9,7 +11,8 @@
+ #define NROFF (-666)
+ #define TROFF (-667)
+
+-STRDEF *chardef, *strdef, *defdef;
++STRDEF *chardef, *strdef;
++LONGSTRDEF *defdef;
+ INTDEF *intdef;
+
+ static INTDEF standardint[] = {
+@@ -178,3 +181,24 @@
+ intdef = &standardint[0];
+ defdef = NULL;
+ }
++
++
++LONGSTRDEF* find_longstrdef(LONGSTRDEF * head, int nr, char * longname, char ** out_longname)
++{
++ char *p, c;
++ LONGSTRDEF *de;
++
++ p = longname;
++ while (p && !isspace(*p)) p++;
++ c = *p;
++ *p = 0;
++
++ de = head;
++ while (de && (de->nr != nr || (de->longname && strcmp(longname, de->longname))))
++ de = de->next;
++
++ if (out_longname)
++ *out_longname = de ? de->longname : xstrdup(longname);
++ *p = c;
++ return de;
++}
diff --git a/man2html-macro-priority.patch b/man2html-macro-priority.patch
new file mode 100644
index 0000000..40c7cf1
--- /dev/null
+++ b/man2html-macro-priority.patch
@@ -0,0 +1,94 @@
+Parse user-defined macros before the global ones (closes: #5587).
+
+Index: man-1.6g/man2html/man2html.c
+===================================================================
+--- man-1.6g.orig/man2html/man2html.c 2011-01-09 11:20:58.000000000 +0100
++++ man-1.6g/man2html/man2html.c 2011-01-09 11:21:22.000000000 +0100
+@@ -1697,7 +1697,42 @@
+ c = scan_escape(c+1);
+ } else {
+ i=V(c[0],c[1]);
+- switch (i) {
++ /* search macro database of self-defined macros */
++ owndef = find_longstrdef(defdef, i, c, NULL);
++ if (owndef) {
++ char **oldargument;
++ int deflen;
++ int onff;
++ sl=fill_words(c+strlen(owndef->longname), wordlist, SIZE(wordlist), &words, '\n');
++ c=sl+1;
++ *sl=0;
++ for (i=1; i<words; i++)
++ wordlist[i][-1]=0;
++ for (i=0; i<words; i++) {
++ char *h=NULL;
++ if (mandoc_command)
++ scan_troff_mandoc(wordlist[i],1,&h);
++ else
++ scan_troff(wordlist[i],1,&h);
++ wordlist[i]=h;
++ }
++ for (i=words; i<SIZE(wordlist); i++)
++ wordlist[i]=NULL;
++ deflen = strlen(owndef->st);
++ owndef->st[deflen+1]='a';
++ for (i=0; (owndef->st[deflen+2+i] = owndef->st[i]); i++);
++ oldargument=argument;
++ argument=wordlist;
++ onff=newline_for_fun;
++ if (mandoc_command)
++ scan_troff_mandoc(owndef->st+deflen+2, 0, NULL);
++ else
++ scan_troff(owndef->st+deflen+2, 0, NULL);
++ newline_for_fun=onff;
++ argument=oldargument;
++ for (i=0; i<words; i++) if (wordlist[i]) free(wordlist[i]);
++ *sl='\n';
++ } else switch (i) {
+ case V('a','b'):
+ h=c+j;
+ while (*h && *h !='\n') h++;
+@@ -2894,42 +2929,7 @@
+ /* ----- end of BSD mandoc stuff ----- */
+
+ default:
+- /* search macro database of self-defined macros */
+- owndef = find_longstrdef(defdef, i, c, NULL);
+- if (owndef) {
+- char **oldargument;
+- int deflen;
+- int onff;
+- sl=fill_words(c+strlen(owndef->longname), wordlist, SIZE(wordlist), &words, '\n');
+- c=sl+1;
+- *sl=0;
+- for (i=1; i<words; i++)
+- wordlist[i][-1]=0;
+- for (i=0; i<words; i++) {
+- char *h=NULL;
+- if (mandoc_command)
+- scan_troff_mandoc(wordlist[i],1,&h);
+- else
+- scan_troff(wordlist[i],1,&h);
+- wordlist[i]=h;
+- }
+- for (i=words; i<SIZE(wordlist); i++)
+- wordlist[i]=NULL;
+- deflen = strlen(owndef->st);
+- owndef->st[deflen+1]='a';
+- for (i=0; (owndef->st[deflen+2+i] = owndef->st[i]); i++);
+- oldargument=argument;
+- argument=wordlist;
+- onff=newline_for_fun;
+- if (mandoc_command)
+- scan_troff_mandoc(owndef->st+deflen+2, 0, NULL);
+- else
+- scan_troff(owndef->st+deflen+2, 0, NULL);
+- newline_for_fun=onff;
+- argument=oldargument;
+- for (i=0; i<words; i++) if (wordlist[i]) free(wordlist[i]);
+- *sl='\n';
+- } else if (mandoc_command &&
++ if (mandoc_command &&
+ ((isupper(*c) && islower(c[1]))
+ || (islower(*c) && isupper(c[1])))) {
+ /*
diff --git a/man2html-new-macros.patch b/man2html-new-macros.patch
new file mode 100644
index 0000000..0ba9a8d
--- /dev/null
+++ b/man2html-new-macros.patch
@@ -0,0 +1,389 @@
+Handle \[xx] escapes and add a few commonly used char/string definitions.
+
+diff -ruN -x '*.rej' -x '*.orig' man-1.6e-old/man2html/man2html.c man-1.6e/man2html/man2html.c
+--- man-1.6e-old/man2html/man2html.c 2007-04-24 22:19:45.000000000 +0200
++++ man-1.6e/man2html/man2html.c 2007-04-24 22:20:15.000000000 +0200
+@@ -612,6 +612,9 @@
+ static int skip_escape=0;
+ static int single_escape=0;
+
++
++#define EXPAND_BRACKET for (c++, i=0; *c != ']'; c++) i = i * 256 + *c; if (i < 256) i = i * 256 + ' '
++
+ static char *
+ scan_escape(char *c) {
+ char *h=NULL;
+@@ -678,13 +681,19 @@
+ c++;
+ h = expand_char(i);
+ break;
++ case '[':
++ EXPAND_BRACKET;
++ h = expand_char(i);
++ break;
+ case '*':
+ c++;
+ if (*c=='(') {
+ c++;
+ i= c[0]*256+c[1];
+ c++;
+- } else
++ } else if (*c == '[') {
++ EXPAND_BRACKET;
++ } else
+ i= *c *256+' ';
+ h = expand_string(i);
+ break;
+@@ -695,6 +704,8 @@
+ c=scan_escape(c);
+ c--;
+ i=intresult;
++ } else if (*c == '[') {
++ EXPAND_BRACKET;
+ } else if (*c != '(')
+ i=*c;
+ else {
+@@ -2189,6 +2200,8 @@
+ */
+ out_html("\"></A>");
+ break;
++ case V('P',' '):
++ case V('P','\n'):
+ case V('L','P'):
+ case V('P','P'):
+ dl_end();
+diff -ruN -x '*.rej' -x '*.orig' man-1.6e-old/man2html/strdefs.c man-1.6e/man2html/strdefs.c
+--- man-1.6e-old/man2html/strdefs.c 2007-04-24 22:19:45.000000000 +0200
++++ man-1.6e/man2html/strdefs.c 2007-04-25 00:42:09.000000000 +0200
+@@ -28,119 +28,265 @@
+ { 0, 0, 0, NULL } };
+
+ static STRDEF standardstring[] = {
++ { V('<','='), 2, "<=", NULL }, /* less equal */
++ { V('>','='), 2, ">=;", NULL }, /* greather equal */
++ { V('A','m'), 1, "&", NULL }, /* infinity */
++ { V('B','a'), 1, "|", NULL }, /* vartical bar */
++ { V('G','e'), 2, ">=;", NULL }, /* greather equal */
++ { V('G','t'), 1, ">", NULL }, /* greather than */
++ { V('I','f'), 1, "∞", NULL }, /* infinity */
++ { V('L','e'), 2, "<=", NULL }, /* less equal */
++ { V('L','q'), 1, "“", NULL }, /* left double quote */
++ { V('L','t'), 1, "<", NULL }, /* less than */
++ { V('N','a'), 3, "NaN", NULL }, /* not a number */
++ { V('N','e'), 2, "!=", NULL }, /* not equal */
++ { V('P','i'), 2, "Pi", NULL }, /* pi */
++ { V('P','m'), 1, "±", NULL }, /* plus minus */
+ { V('R',' '), 1, "®", NULL },
++ { V('R','q'), 1, "”", NULL }, /* right double quote */
++ { V('a','a'), 1, "'", NULL }, /* accute accent */
++ { V('g','a'), 1, "`", NULL }, /* grave accent */
+ { V('l','q'), 2, "``", NULL },
++ { V('q',' '), 1, """, NULL }, /* straight double quote */
+ { V('r','q'), 2, "''", NULL },
++ { V('u','a'), 1, "^", NULL }, /* upwards arrow */
+ { 0, 0, NULL, NULL}
+ };
+
+-
+ static STRDEF standardchar[] = {
+ { V('*','*'), 1, "*", NULL }, /* math star */
+- { V('*','A'), 1, "A", NULL },
+- { V('*','B'), 1, "B", NULL },
+- { V('*','C'), 2, "Xi", NULL },
+- { V('*','D'), 5, "Delta", NULL },
+- { V('*','E'), 1, "E", NULL },
+- { V('*','F'), 3, "Phi", NULL },
+- { V('*','G'), 5, "Gamma", NULL },
+- { V('*','H'), 5, "Theta", NULL },
+- { V('*','I'), 1, "I", NULL },
+- { V('*','K'), 1, "K", NULL },
+- { V('*','L'), 6, "Lambda", NULL },
+- { V('*','M'), 1, "M", NULL },
+- { V('*','N'), 1, "N", NULL },
+- { V('*','O'), 1, "O", NULL },
+- { V('*','P'), 2, "Pi", NULL },
+- { V('*','Q'), 3, "Psi", NULL },
+- { V('*','R'), 1, "P", NULL },
+- { V('*','S'), 5, "Sigma", NULL },
+- { V('*','T'), 1, "T", NULL },
+- { V('*','U'), 1, "Y", NULL },
+- { V('*','W'), 5, "Omega", NULL },
+- { V('*','X'), 1, "X", NULL },
+- { V('*','Y'), 1, "H", NULL },
+- { V('*','Z'), 1, "Z", NULL },
+- { V('*','a'), 5, "alpha", NULL },
+- { V('*','b'), 4, "beta", NULL },
+- { V('*','c'), 2, "xi", NULL },
+- { V('*','d'), 5, "delta", NULL },
+- { V('*','e'), 7, "epsilon", NULL },
+- { V('*','f'), 3, "phi", NULL },
+- { V('*','g'), 5, "gamma", NULL },
+- { V('*','h'), 5, "theta", NULL },
+- { V('*','i'), 4, "iota", NULL },
+- { V('*','k'), 5, "kappa", NULL },
+- { V('*','l'), 6, "lambda", NULL },
+- { V('*','m'), 1, "µ", NULL },
+- { V('*','n'), 2, "nu", NULL },
+- { V('*','o'), 1, "o", NULL },
+- { V('*','p'), 2, "pi", NULL },
+- { V('*','q'), 3, "psi", NULL },
+- { V('*','r'), 3, "rho", NULL },
+- { V('*','s'), 5, "sigma", NULL },
+- { V('*','t'), 3, "tau", NULL },
+- { V('*','u'), 7, "upsilon", NULL },
+- { V('*','w'), 5, "omega", NULL },
+- { V('*','x'), 3, "chi", NULL },
+- { V('*','y'), 3, "eta", NULL },
+- { V('*','z'), 4, "zeta", NULL },
+- { V('+','-'), 1, "±", NULL },
++ { V('*','A'), 1, "Α", NULL },
++ { V('*','B'), 1, "Β", NULL },
++ { V('*','C'), 1, "Ξ", NULL },
++ { V('*','D'), 1, "Δ", NULL },
++ { V('*','E'), 1, "Ε", NULL },
++ { V('*','F'), 1, "Φ", NULL },
++ { V('*','G'), 1, "Γ", NULL },
++ { V('*','H'), 1, "Θ", NULL },
++ { V('*','I'), 1, "Ι", NULL },
++ { V('*','K'), 1, "Κ", NULL },
++ { V('*','L'), 1, "Λ", NULL },
++ { V('*','M'), 1, "Μ", NULL },
++ { V('*','N'), 1, "Ν", NULL },
++ { V('*','O'), 1, "Ο", NULL },
++ { V('*','P'), 1, "Π", NULL },
++ { V('*','Q'), 1, "Ψ", NULL },
++ { V('*','R'), 1, "Ρ", NULL },
++ { V('*','S'), 1, "Σ", NULL },
++ { V('*','T'), 1, "Τ", NULL },
++ { V('*','U'), 1, "Υ", NULL },
++ { V('*','W'), 1, "Ω", NULL },
++ { V('*','X'), 1, "Χ", NULL },
++ { V('*','Y'), 1, "Η", NULL },
++ { V('*','Z'), 1, "Ζ", NULL },
++ { V('*','a'), 1, "α", NULL },
++ { V('*','b'), 1, "β", NULL },
++ { V('*','c'), 1, "ξ", NULL },
++ { V('*','d'), 1, "δ", NULL },
++ { V('*','e'), 1, "ε", NULL },
++ { V('*','f'), 1, "φ", NULL },
++ { V('*','g'), 1, "γ", NULL },
++ { V('*','h'), 1, "θ", NULL },
++ { V('*','i'), 1, "ι", NULL },
++ { V('*','k'), 1, "κ", NULL },
++ { V('*','l'), 1, "λ", NULL },
++ { V('*','m'), 1, "μ", NULL },
++ { V('*','n'), 1, "ν", NULL },
++ { V('*','o'), 1, "ο", NULL },
++ { V('*','p'), 1, "π", NULL },
++ { V('*','q'), 1, "ψ", NULL },
++ { V('*','r'), 1, "ρ", NULL },
++ { V('*','s'), 1, "σ", NULL },
++ { V('*','t'), 1, "τ", NULL },
++ { V('*','u'), 1, "υ", NULL },
++ { V('*','w'), 1, "ω", NULL },
++ { V('*','x'), 1, "χ", NULL },
++ { V('*','y'), 1, "η", NULL },
++ { V('*','z'), 1, "ζ", NULL },
++ { V('\'','A'), 1, "Á", NULL },
++ { V('\'','E'), 1, "É", NULL },
++ { V('\'','I'), 1, "Í", NULL },
++ { V('\'','O'), 1, "Ó", NULL },
++ { V('\'','U'), 1, "Ú", NULL },
++ { V('\'','Y'), 1, "Ý", NULL },
++ { V('\'','a'), 1, "á", NULL },
++ { V('\'','e'), 1, "é", NULL },
++ { V('\'','i'), 1, "í", NULL },
++ { V('\'','o'), 1, "ó", NULL },
++ { V('\'','u'), 1, "ú", NULL },
++ { V('\'','y'), 1, "ý", NULL },
++ { V('!','='), 1, "≠", NULL },
++ { V('%','0'), 1, "‰", NULL },
++ { V('+','-'), 1, "±", NULL },
++ { V(',','C'), 1, "Ç", NULL },
++ { V(',','c'), 1, "ç", NULL },
++ { V('-','>'), 1, "→", NULL },
++ { V('-','D'), 1, "Ð", NULL },
++ { V('.','i'), 1, "ı", NULL },
++ { V('/','L'), 1, "Ł", NULL },
++ { V('/','O'), 1, "Ø", NULL },
++ { V('/','l'), 1, "ł", NULL },
++ { V('/','o'), 1, "ø", NULL },
+ { V('1','2'), 1, "½", NULL },
+ { V('1','4'), 1, "¼", NULL },
+ { V('3','4'), 1, "¾", NULL },
++ { V(':','A'), 1, "Ä", NULL },
++ { V(':','E'), 1, "Ë", NULL },
++ { V(':','I'), 1, "Ï", NULL },
++ { V(':','O'), 1, "Ö", NULL },
++ { V(':','U'), 1, "Ü", NULL },
++ { V(':','a'), 1, "ä", NULL },
++ { V(':','e'), 1, "ë", NULL },
++ { V(':','i'), 1, "ï", NULL },
++ { V(':','o'), 1, "ö", NULL },
++ { V(':','u'), 1, "ü", NULL },
++ { V(':','y'), 1, "ÿ", NULL },
++ { V('<','-'), 1, "←", NULL },
++ { V('<','='), 1, "≤", NULL },
++ { V('<','>'), 1, "↔", NULL },
++ { V('=','='), 1, "≡", NULL },
++ { V('=','~'), 1, "≅", NULL },
++ { V('>','='), 1, "≥", NULL },
++ { V('A','E'), 1, "Æ", NULL },
++ { V('A','h'), 1, "&alepfsym;", NULL },
++ { V('C','R'), 1, "␍", NULL },
++ { V('C','s'), 1, "¤", NULL },
++ { V('D','o'), 1, "$", NULL },
++ { V('E','u'), 1, "€", NULL },
++ { V('F','c'), 1, "»", NULL },
+ { V('F','i'), 3, "ffi", NULL },
+ { V('F','l'), 3, "ffl", NULL },
+- { V('a','a'), 1, "´", NULL },
+- { V('a','p'), 1, "~", NULL },
++ { V('F','o'), 1, "«", NULL },
++ { V('O','E'), 1, "Œ", NULL },
++ { V('P','o'), 1, "£", NULL },
++ { V('S','1'), 1, "¹", NULL },
++ { V('S','2'), 1, "²", NULL },
++ { V('S','3'), 1, "³", NULL },
++ { V('S','d'), 1, "ð", NULL },
++ { V('T','P'), 1, "Þ", NULL },
++ { V('T','p'), 1, "þ", NULL },
++ { V('Y','e'), 1, "¥", NULL },
++ { V('^','A'), 1, "Â", NULL },
++ { V('^','E'), 1, "Ê", NULL },
++ { V('^','I'), 1, "Î", NULL },
++ { V('^','O'), 1, "Ô", NULL },
++ { V('^','U'), 1, "Û", NULL },
++ { V('^','a'), 1, "â", NULL },
++ { V('^','e'), 1, "ê", NULL },
++ { V('^','i'), 1, "î", NULL },
++ { V('^','o'), 1, "ô", NULL },
++ { V('^','u'), 1, "û", NULL },
++ { V('`','A'), 1, "À", NULL },
++ { V('`','E'), 1, "È", NULL },
++ { V('`','I'), 1, "Ì", NULL },
++ { V('`','O'), 1, "Ò", NULL },
++ { V('`','U'), 1, "Ù", NULL },
++ { V('`','a'), 1, "à", NULL },
++ { V('`','e'), 1, "è", NULL },
++ { V('`','i'), 1, "ì", NULL },
++ { V('`','o'), 1, "ò", NULL },
++ { V('`','u'), 1, "ù", NULL },
++ { V('a','a'), 1, "´", NULL },
++ { V('a','e'), 1, "æ", NULL },
++ { V('a','p'), 1, "≈", NULL },
++ { V('a','q'), 1, "'", NULL },
++ { V('a','t'), 1, "@", NULL },
++ { V('a','~'), 1, "~", NULL },
++ { V('b','a'), 1, "|", NULL },
++ { V('b','b'), 1, "|", NULL },
+ { V('b','r'), 1, "|", NULL },
+- { V('b','u'), 1, "*", NULL }, /* bullet */
++ { V('b','r'), 1, "|", NULL },
++ { V('b','u'), 1, "•", NULL },
+ { V('b','v'), 1, "|", NULL },
+- { V('c','i'), 1, "o", NULL }, /* circle */
++ { V('c','*'), 1, "⊗", NULL },
++ { V('c','+'), 1, "⊕", NULL },
++ { V('c','i'), 1, "○", NULL },
+ { V('c','o'), 1, "©", NULL },
+ { V('c','q'), 1, "'", NULL },
+ { V('c','t'), 1, "¢", NULL },
++ { V('d','A'), 1, "⇓", NULL },
++ { V('d','a'), 1, "↓", NULL },
++ { V('d','d'), 1, "=", NULL },
+ { V('d','e'), 1, "°", NULL },
+- { V('d','g'), 1, "+", NULL }, /* dagger */
++ { V('d','g'), 1, "-", NULL },
+ { V('d','i'), 1, "÷", NULL },
++ { V('d','q'), 1, """, NULL },
+ { V('e','m'), 3, "---", NULL }, /* em dash */
+ { V('e','n'), 1, "-", NULL }, /* en dash */
+- { V('e','q'), 1, "=", NULL },
++ { V('e','q'), 1, "=", NULL },
+ { V('e','s'), 1, "Ø", NULL },
++ { V('e','u'), 1, "€", NULL },
++ { V('f','/'), 1, "⁄", NULL },
++ { V('f','c'), 1, "›", NULL },
+ { V('f','f'), 2, "ff", NULL },
+ { V('f','i'), 2, "fi", NULL },
+ { V('f','l'), 2, "fl", NULL },
+ { V('f','m'), 1, "´", NULL },
++ { V('f','o'), 1, "‹", NULL },
+ { V('g','a'), 1, "`", NULL },
++ { V('h','A'), 1, "⇔", NULL },
+ { V('h','y'), 1, "-", NULL },
+- { V('l','c'), 2, "|¯", NULL },
+- { V('i','f'), 8, "Infinity", NULL }, /* infinity sign */
++ { V('i','f'), 1, "∞", NULL },
+ { V('i','s'), 8, "Integral", NULL }, /* integral sign */
++ { V('l','A'), 1, "⇐", NULL },
++ { V('l','B'), 1, "[", NULL },
++ { V('l','C'), 1, "{", NULL },
++ { V('l','a'), 1, "<", NULL },
++ { V('l','b'), 1, "[", NULL },
++ { V('l','c'), 2, "|¯", NULL },
+ { V('l','f'), 2, "|_", NULL },
++ { V('l','h'), 1, "☚", NULL },
+ { V('l','k'), 1, "<FONT SIZE=\"+2\">{</FONT>", NULL },
+ { V('l','q'), 1, "\"", NULL },
++ { V('l','z'), 1, "◊", NULL },
++ { V('m','c'), 1, "µ", NULL },
+ { V('m','i'), 1, "-", NULL },
+ { V('m','u'), 1, "×", NULL },
+ { V('n','o'), 1, "¬", NULL },
++ { V('o','A'), 1, "Å", NULL },
++ { V('o','a'), 1, "å", NULL },
++ { V('o','e'), 1, "œ", NULL },
+ { V('o','q'), 1, "'", NULL },
+- { V('o','r'), 1, "|", NULL },
++ { V('o','r'), 1, "|", NULL },
+ { V('p','d'), 1, "d", NULL }, /* partial derivative */
+- { V('p','l'), 1, "+", NULL },
++ { V('p','l'), 1, "+", NULL },
++ { V('p','s'), 1, "¶", NULL },
++ { V('r','!'), 1, "¡", NULL },
++ { V('r','?'), 1, "¿", NULL },
++ { V('r','A'), 1, "⇒", NULL },
++ { V('r','B'), 1, "]", NULL },
++ { V('r','C'), 1, "}", NULL },
++ { V('r','a'), 1, ">", NULL },
+ { V('r','c'), 2, "¯|", NULL },
+ { V('r','f'), 2, "_|", NULL },
+ { V('r','g'), 1, "®", NULL },
++ { V('r','h'), 1, "☛", NULL },
+ { V('r','k'), 1, "<FONT SIZE=\"+2\">}</FONT>", NULL },
+ { V('r','n'), 1, "¯", NULL },
+ { V('r','q'), 1, "\"", NULL },
+- { V('r','u'), 1, "_", NULL },
++ { V('r','s'), 1, "\\", NULL },
++ { V('r','u'), 1, "_", NULL },
+ { V('s','c'), 1, "§", NULL },
+- { V('s','l'), 1, "/", NULL },
+- { V('s','q'), 2, "[]", NULL },
++ { V('s','h'), 1, "#", NULL },
++ { V('s','l'), 1, "/", NULL },
++ { V('s','q'), 1, "□", NULL },
++ { V('s','s'), 1, "ß", NULL },
++ { V('t','f'), 1, "∴", NULL },
++ { V('t','i'), 1, "~", NULL },
++ { V('t','m'), 1, "™", NULL },
+ { V('t','s'), 1, "s", NULL }, /* should be terminal sigma */
+- { V('u','l'), 1, "_", NULL },
+- { V('>','='), 1, ">", NULL },
+- { V('<','='), 1, "<", NULL },
++ { V('u','A'), 1, "⇑", NULL },
++ { V('u','a'), 1, "↑", NULL },
++ { V('u','l'), 1, "_", NULL },
++ { V('~','A'), 1, "Ã", NULL },
++ { V('~','N'), 1, "Ñ", NULL },
++ { V('~','O'), 1, "Õ", NULL },
++ { V('~','a'), 1, "ã", NULL },
++ { V('~','n'), 1, "ñ", NULL },
++ { V('~','o'), 1, "õ", NULL },
+ { 0, 0, NULL, NULL }
++
++
+ };
+
+ void stdinit(void) {
diff --git a/man2html-noindex-segfault.patch b/man2html-noindex-segfault.patch
new file mode 100644
index 0000000..9689d19
--- /dev/null
+++ b/man2html-noindex-segfault.patch
@@ -0,0 +1,24 @@
+Fix segfault on man pages with no sections (see bug #349907).
+
+diff -ruN -x config.guess -x config.sub man-1.6e-old/man2html/man2html.c man-1.6e/man2html/man2html.c
+--- man-1.6e-old/man2html/man2html.c 2007-01-31 01:30:17.000000000 +0100
++++ man-1.6e/man2html/man2html.c 2007-01-31 01:30:18.000000000 +0100
+@@ -3256,11 +3256,13 @@
+ out_html(NEWLINE);
+ if (output_possible) {
+ /* for mosaic users */
+- printf("<HR>\n<A NAME=\"index\"> </A><H2>Index</H2>\n<DL>\n");
+- manidx[mip]=0;
+- printf("%s", manidx);
+- if (subs) printf("</DL>\n");
+- printf("</DL>\n");
++ if (manidx) {
++ printf("<HR>\n<A NAME=\"index\"> </A><H2>Index</H2>\n<DL>\n");
++ manidx[mip]=0;
++ printf("%s", manidx);
++ if (subs) printf("</DL>\n");
++ printf("</DL>\n");
++ }
+ print_sig();
+ printf("</BODY>\n</HTML>\n");
+ } else {
diff --git a/man2html-paths.patch b/man2html-paths.patch
new file mode 100644
index 0000000..c377eb5
--- /dev/null
+++ b/man2html-paths.patch
@@ -0,0 +1,28 @@
+diff -ur ../man-1.6g-orig/man2html/cgibase.c ./man2html/cgibase.c
+--- ../man-1.6g-orig/man2html/cgibase.c 2005-08-20 16:26:06.000000000 -0700
++++ ./man2html/cgibase.c 2012-05-11 16:44:18.842807125 -0700
+@@ -18,10 +18,10 @@
+ /*
+ * Either the user is non-local (or local, but using httpd),
+ * in which case we use http:/cgi-bin, or the user is local
+- * and uses lynx, and we use lynxcgi:/home/httpd/cgi-bin.
++ * and uses lynx, and we use lynxcgi:/usr/lib/man2html/cgi-bin.
+ */
+
+-static char *man2htmlpath = "/cgi-bin/man/man2html"; /* default */
++static char *man2htmlpath = "/man/man2html"; /* default */
+ static char *cgibase_format = "http://%s"; /* host.domain:port */
+ static char *cgibase_ll_format = "lynxcgi:%s"; /* directory */
+ static char *cgibase = "http://localhost"; /* default */
+diff -ur ../man-1.6g-orig/man2html/man2html.c ./man2html/man2html.c
+--- ../man-1.6g-orig/man2html/man2html.c 2007-08-05 12:15:23.000000000 -0700
++++ ./man2html/man2html.c 2012-05-11 16:47:46.057231585 -0700
+@@ -3109,7 +3109,7 @@
+ case 'H':
+ set_cgibase(optarg); break;
+ case 'l':
+- set_lynxcgibase("/home/httpd"); break;
++ set_lynxcgibase("/usr/lib/man2html"); break;
+ case 'L':
+ set_lynxcgibase(optarg); break;
+ case 'M':
diff --git a/man2html-perl.patch b/man2html-perl.patch
new file mode 100644
index 0000000..67cd215
--- /dev/null
+++ b/man2html-perl.patch
@@ -0,0 +1,16 @@
+Add support for Perl modules (closes: #363384).
+Patch by Nicolas François.
+
+diff -ruN -x config.guess -x config.sub man-1.6e-old/man2html/man2html.c man-1.6e/man2html/man2html.c
+--- man-1.6e-old/man2html/man2html.c 2007-01-31 01:21:06.000000000 +0100
++++ man-1.6e/man2html/man2html.c 2007-01-31 01:21:07.000000000 +0100
+@@ -173,7 +173,8 @@
+ /* section is n or l or starts with a digit */
+ && strchr("123456789nl", f[1])
+ && (g-f == 2 || (g-f == 3 && isdigit(f[1]) && isalpha(f[2]))
+- || (f[2] == 'X' && isdigit(f[1])))
++ || (f[2] == 'X' && isdigit(f[1]))
++ || (strncmp(f+1,"3pm",g-f-1) == 0))
+ ) {
+ /* this might be a link */
+ h=f-1;
diff --git a/man2html-quotes.patch b/man2html-quotes.patch
new file mode 100644
index 0000000..587bba4
--- /dev/null
+++ b/man2html-quotes.patch
@@ -0,0 +1,33 @@
+Add support for \(lq and \(rq escape sequences (closes: #338339).
+
+diff -Nru3 man-1.6c/man2html/strdefs.c man-1.6c/man2html/strdefs.c
+--- man-1.6c/man2html/strdefs.c 2005-06-21 03:29:59.000000000 +0200
++++ man-1.6/cman2html/strdefs.c 2005-11-09 12:34:28.000000000 +0100
+@@ -95,6 +95,7 @@
+ { V('b','v'), 1, "|", NULL },
+ { V('c','i'), 1, "o", NULL }, /* circle */
+ { V('c','o'), 1, "©", NULL },
++ { V('c','q'), 1, "'", NULL },
+ { V('c','t'), 1, "¢", NULL },
+ { V('d','e'), 1, "°", NULL },
+ { V('d','g'), 1, "+", NULL }, /* dagger */
+@@ -114,9 +115,11 @@
+ { V('i','s'), 8, "Integral", NULL }, /* integral sign */
+ { V('l','f'), 2, "|_", NULL },
+ { V('l','k'), 1, "<FONT SIZE=\"+2\">{</FONT>", NULL },
++ { V('l','q'), 1, "\"", NULL },
+ { V('m','i'), 1, "-", NULL },
+ { V('m','u'), 1, "×", NULL },
+ { V('n','o'), 1, "¬", NULL },
++ { V('o','q'), 1, "'", NULL },
+ { V('o','r'), 1, "|", NULL },
+ { V('p','d'), 1, "d", NULL }, /* partial derivative */
+ { V('p','l'), 1, "+", NULL },
+@@ -125,6 +128,7 @@
+ { V('r','g'), 1, "®", NULL },
+ { V('r','k'), 1, "<FONT SIZE=\"+2\">}</FONT>", NULL },
+ { V('r','n'), 1, "¯", NULL },
++ { V('r','q'), 1, "\"", NULL },
+ { V('r','u'), 1, "_", NULL },
+ { V('s','c'), 1, "§", NULL },
+ { V('s','l'), 1, "/", NULL },
diff --git a/man2html-relative-links.patch b/man2html-relative-links.patch
new file mode 100644
index 0000000..e2745dc
--- /dev/null
+++ b/man2html-relative-links.patch
@@ -0,0 +1,28 @@
+Set default cgibase for man2html to an empty string, so hyperlinks
+will be like `href="/cgi-bin/..."'
+
+diff -ruN man-1.6c-old/man2html/cgibase.c man-1.6c/man2html/cgibase.c
+--- man-1.6c-old/man2html/cgibase.c 2003-03-11 16:53:29.000000000 +0100
++++ man-1.6c/man2html/cgibase.c 2004-07-27 22:17:28.000000000 +0200
+@@ -24,7 +24,7 @@
+ static char *man2htmlpath = "/cgi-bin/man/man2html"; /* default */
+ static char *cgibase_format = "http://%s"; /* host.domain:port */
+ static char *cgibase_ll_format = "lynxcgi:%s"; /* directory */
+-static char *cgibase = "http://localhost"; /* default */
++static char *cgibase = ""; /* default */
+
+ /*
+ * Separator between URL and argument string.
+diff -ruN man-1.6c-old/man2html/man2html.1 man-1.6c/man2html/man2html.1
+--- man-1.6c-old/man2html/man2html.1 2003-03-11 16:53:30.000000000 +0100
++++ man-1.6c/man2html/man2html.1 2004-07-27 22:17:28.000000000 +0200
+@@ -79,7 +79,8 @@
+ are set using the various options.
+ .TP
+ .B \-\^h
+-Set method:cgipath to http://localhost. This is the default.
++Set method:cgipath to http://localhost.
++.\" This is the default.
+ .TP
+ .BI \-\^H " host[.domain][:port]"
+ Set method:cgipath to
diff --git a/man2html-see-also-hman.patch b/man2html-see-also-hman.patch
new file mode 100644
index 0000000..8ed6ede
--- /dev/null
+++ b/man2html-see-also-hman.patch
@@ -0,0 +1,31 @@
+Add SEE ALSO hman to man2html man page (closes: #285401).
+
+diff -ruN -x '*.rej' -x '*.orig' man-1.6e-old/man2html/man2html.1 man-1.6e/man2html/man2html.1
+--- man-1.6e-old/man2html/man2html.1 2007-04-24 22:07:56.000000000 +0200
++++ man-1.6e/man2html/man2html.1 2007-04-24 22:08:39.000000000 +0200
+@@ -25,12 +25,12 @@
+ .BR xmosaic (1)
+ or
+ .BR netscape (1).
+-./" (See
+-./" .BR man (1)
+-./" for info on how to browse man pages via
+-./" .BR man2html .
+-./" Usually it would suffice to put "MANHTMLPAGER=/usr/bin/lynx"
+-./" in the environment.)
++.\" (See
++.\" .BR man (1)
++.\" for info on how to browse man pages via
++.\" .BR man2html .
++.\" Usually it would suffice to put "MANHTMLPAGER=/usr/bin/lynx"
++.\" in the environment.)
+
+ The main part of
+ .B man2html
+@@ -149,4 +149,5 @@
+
+ .SH "SEE ALSO"
+ .BR lynx (1),
+-.BR man (1)
++.BR man (1),
++.BR hman (1)
diff --git a/man2html-ungzip-makefile.patch b/man2html-ungzip-makefile.patch
new file mode 100644
index 0000000..2183c8a
--- /dev/null
+++ b/man2html-ungzip-makefile.patch
@@ -0,0 +1,9 @@
+--- ../man-1.6g-orig/man2html/Makefile.in 2010-12-31 13:28:46.000000000 -0700
++++ ./man2html/Makefile.in 2012-05-11 16:53:03.947983881 -0700
+@@ -1,5 +1,5 @@
+ CC = @CC@
+-CFLAGS += -Wall -Wstrict-prototypes -Wmissing-prototypes
++CFLAGS += -Wall -Wstrict-prototypes -Wmissing-prototypes -DGUNZIP='"@gunzip@"'
+ OBJECTS = man2html.o cgibase.o abbrev.o strdefs.o
+ EXEEXT = @EXEEXT@
+ bindir = $(DESTDIR)$(PREFIX)/usr/bin
diff --git a/man2html-ungzip.patch b/man2html-ungzip.patch
new file mode 100644
index 0000000..12dc6f2
--- /dev/null
+++ b/man2html-ungzip.patch
@@ -0,0 +1,257 @@
+diff -ur ../man-1.6g.orig/man2html/man2html.c ./man2html/man2html.c
+--- ../man-1.6g.orig/man2html/man2html.c 2007-08-05 12:15:23.000000000 -0700
++++ ./man2html/man2html.c 2011-12-15 03:28:57.605162107 -0700
+@@ -15,6 +15,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <unistd.h>
++#include <errno.h>
+ #include <stdarg.h>
+ #include <string.h>
+ #include <ctype.h>
+@@ -55,6 +56,108 @@
+
+ static char charb[3];
+
++#ifdef GUNZIP
++/* from src/utils.c */
++static int
++is_shell_safe(const char *ss, int quoted) {
++ char *bad = " ;'\\\"<>|";
++ char *p;
++
++ if (quoted)
++ bad++; /* allow a space inside quotes */
++ for (p = bad; *p; p++)
++ if (strchr(ss, *p))
++ return 0;
++ return 1;
++}
++#endif
++
++/* reads the entire manpage into buffer *buf and returns number of chars read */
++static int
++read_manpage_into_buffer(char *path, char **buf) {
++ int compressed = 0;
++ FILE * f = NULL;
++ char * ext;
++ int l = 0;
++ struct stat stbuf;
++
++ *buf = NULL;
++ if (!path)
++ return -1;
++
++ if (!strcmp(path, "-"))
++ f = stdin;
++ else /* strcmp(path, "-") */
++ {
++ char * tmp = NULL;
++ char * command = NULL;
++ char * openpath = path;
++#ifdef GUNZIP
++
++ if (is_shell_safe(openpath, 1)) {
++ ext = strrchr(openpath, '.');
++ compressed = (ext && !strcmp(ext, ".gz"));
++
++ if (!compressed && stat(openpath, &stbuf)) {
++ tmp = (char*) xmalloc(strlen(path) + 4);
++ sprintf(tmp, "%s.gz", path);
++ if ((compressed = !stat(tmp, &stbuf)))
++ openpath = tmp;
++ }
++ }
++
++ if (compressed) {
++ command = (char*) xmalloc(strlen(openpath) + sizeof(GUNZIP) + 4);
++ sprintf(command, GUNZIP " '%s'", openpath);
++ f = popen(command, "r");
++ } else
++#endif
++ f = fopen(openpath, "r");
++
++ if (tmp) free(tmp);
++ if (command) free(command);
++
++ if (!f)
++ return -1;
++
++ } /* strcmp(path, "-") */
++
++
++ /* Read entire file into buf[1..l] */
++#define XTRA 5
++ /* buf has 1 extra byte at the start, and XTRA extra bytes at the end */
++ if (compressed || f == stdin) {
++ int sz = 1024;
++ int ct = 1, tot = 0;
++ char *p = NULL;
++
++ clearerr(f);
++ while (ct > 0) {
++ tot += ct;
++ if (feof(f))
++ break;
++ sz = 2*sz+tot;
++ p = xrealloc(p, sz);
++ ct = fread(p+tot,1,sz-tot-XTRA,f);
++ }
++
++ *buf = p;
++ l = tot-1;
++ } else {
++ int ct;
++
++ l = 0;
++ if (fstat(fileno(f), &stbuf) != -1)
++ l = stbuf.st_size;
++ *buf = (char *) xmalloc((l+1+XTRA)*sizeof(char));
++ ct = fread(*buf+1,1,l,f);
++ if (ct < l)
++ l = ct;
++ }
++ fclose(f);
++ return l;
++}
++
+ static char *
+ expand_char(int nr)
+ {
+@@ -1817,8 +1920,6 @@
+ break;
+ case V('s','o'):
+ {
+- FILE *f;
+- struct stat stbuf;
+ int l; char *buf;
+ char *name = NULL;
+
+@@ -1826,21 +1927,21 @@
+ c += j; /* skip .so part and whitespace */
+ if (*c == '/') {
+ h = c;
+- } else { /* .so man3/cpow.3 -> ../man3/cpow.3 */
+- h = c-3;
+- h[0] = '.';
+- h[1] = '.';
+- h[2] = '/';
+- }
++ } else { /* .so man3/cpow.3 -> ../man3/cpow.3 */
++/* h = c-3;
++ h[0] = '.';
++ h[1] = '.';
++ h[2] = '/';
++*/
++ h = c;
++ }
++
+ while (*c != '\n') c++;
+ while (c[-1] == ' ') c--;
+ while (*c != '\n') *c++ = 0;
+ *c = 0;
+ scan_troff(h,1, &name);
+ if (name[3] == '/') h=name+3; else h=name;
+- l = 0;
+- if (stat(h, &stbuf)!=-1) l=stbuf.st_size;
+- buf = (char*) xmalloc((l+4)*sizeof(char));
+ #if NOCGI
+ if (!out_length) {
+ char *t,*s;
+@@ -1857,7 +1958,7 @@
+ #endif
+ {
+ /* this works alright, except for section 3 */
+- if (!l || !(f = fopen(h,"r"))) {
++ if ((l = read_manpage_into_buffer(h, &buf)) < 0) {
+ fprintf(stderr,
+ "man2html: unable to open or read file %s\n", h);
+ out_html("<BLOCKQUOTE>"
+@@ -1865,13 +1966,11 @@
+ out_html(h);
+ out_html("</BLOCKQUOTE>\n");
+ } else {
+- i=fread(buf+1,1,l,f);
+- fclose(f);
+ buf[0]=buf[l]='\n';
+ buf[l+1]=buf[l+2]=0;
+ scan_troff(buf+1,0,NULL);
++ if (buf) free(buf);
+ }
+- if (buf) free(buf);
+ }
+ *c++='\n';
+ break;
+@@ -3073,6 +3172,8 @@
+ }
+ }
+
++
++
+ /*
+ * Call: man2html [-l] [filename]
+ *
+@@ -3083,8 +3184,6 @@
+ */
+ int
+ main(int argc, char **argv) {
+- FILE *f;
+- struct stat stbuf;
+ int l, c;
+ char *buf, *filename, *fnam = NULL;
+
+@@ -3146,50 +3245,16 @@
+
+ /* Open input file */
+ if (!fnam || !strcmp(fnam, "-")) {
+- f = stdin;
++ fnam = "-";
+ fname = "(stdin)";
+ } else {
+ /* do a chdir() first, to get .so expansion right */
+ goto_dir(fnam, &directory, &fnam);
+-
+- f = fopen(fnam, "r");
+- if (f == NULL)
+- error_page("File not found", "Could not open %s\n", filename);
+- fname = fnam;
+ }
+
+- /* Read entire file into buf[1..l] */
+-#define XTRA 5
+- /* buf has 1 extra byte at the start, and XTRA extra bytes at the end */
+- if (f == stdin) {
+- int sz = 1024;
+- int ct = 1, tot = 0;
+- char *p = NULL;
+-
+- clearerr(stdin);
+- while (ct > 0) {
+- tot += ct;
+- if (feof(stdin))
+- break;
+- sz = 2*sz+tot;
+- p = xrealloc(p, sz);
+- ct = fread(p+tot,1,sz-tot-XTRA,stdin);
+- }
+-
+- buf = p;
+- l = tot-1;
+- } else {
+- int ct;
+-
+- l = 0;
+- if (fstat(fileno(f), &stbuf) != -1)
+- l = stbuf.st_size;
+- buf = (char *) xmalloc((l+1+XTRA)*sizeof(char));
+- ct = fread(buf+1,1,l,f);
+- if (ct < l)
+- l = ct;
+- fclose(f);
+- }
++ l = read_manpage_into_buffer(fnam, &buf);
++ if (l < 0)
++ error_page("File not found", "Could not open %s\n", fname);
+
+ buf[0] = '\n';
+ buf[l+1] = '\n';
diff --git a/man2html.conf b/man2html.conf
new file mode 100644
index 0000000..13001e9
--- /dev/null
+++ b/man2html.conf
@@ -0,0 +1,7 @@
+ScriptAlias /man/ "/usr/lib/man2html/cgi-bin/man/"
+<Directory "/usr/lib/man2html/cgi-bin/man">
+ Options None
+ AllowOverride None
+ Order allow,deny
+ Allow from 127.0.0.1
+</Directory>
\ No newline at end of file
diff --git a/man2html.spec b/man2html.spec
new file mode 100644
index 0000000..9ab3842
--- /dev/null
+++ b/man2html.spec
@@ -0,0 +1,227 @@
+%global posttag g
+%global debian_release 6
+
+Name: man2html
+Version: 1.6
+Release: 5.%{posttag}%{?dist}
+Summary: Convert man pages to HTML - CGI scripts
+
+# man2html.c and debian/sources/man2html.cgi.c are Copyright Only
+# utils.c is GPL+
+# everything else is GPLv2
+License: GPLv2+ and GPL+ and Copyright only
+
+URL: http://www.kapiti.co.nz/michael/vhman2html.html
+Source0: http://primates.ximian.com/~flucifredi/man/man-%{version}%{posttag}.tar.gz
+
+# Debian CGI scripts
+Source1: http://ftp.de.debian.org/debian/pool/main/m/man2html/man2html_%{version}%{posttag}-%{debian_release}.debian.tar.gz
+
+# Apache configuration file
+Source2: man2html.conf
+
+# Patch1XXX are from Debian, XXX matches their patch number
+# Copyright (C) Christoph Lameter <clameter at debian.org>, Nicolás Lichtmaier
+# <nick at feedback.net.ar>, and Robert Luberda <robert at debian.org>. GPLv2+
+
+# fix a bashism in %%{_bindir}/hman, allows it to work on other shells
+Patch1001: man2html-hman-bashism.patch
+
+# use relative links instead of http://localhost/
+Patch1002: man2html-relative-links.patch
+
+# use file:/// links instead of file:/ (per RFC 1738)
+Patch1013: man2html-file-link.patch
+
+# show hman(1) in man2html(1) see also section
+Patch1017: man2html-see-also-hman.patch
+
+# *roff parser fix: add support for \(lq and \(rq escape sequences
+Patch1018: man2html-quotes.patch
+
+# fix SEGFAULT on manpages with no sections
+Patch1019: man2html-noindex-segfault.patch
+
+# *roff parser fix: convert \N'123' to {
+Patch1020: man2html-escape-N.patch
+
+# support Perl manpages (1p/3p/etc.)
+Patch1021: man2html-perl.patch
+
+# fix typo in Italian man page
+Patch1022: man2html-it-typo.patch
+
+# *roff parser: properly decode quotes inside quoted text
+Patch1023: man2html-double-quotes.patch
+
+# *roff parser: handle \$* and \$@ escapes.
+Patch1025: man2html-all-args.patch
+
+# *roff parser: support macro names longer than two characters
+Patch1026: man2html-macro-longnames.patch
+
+# *roff parser: parse user defined macros before global ones
+Patch1027: man2html-macro-priority.patch
+
+# fix a segfault that only happens on groff(1) [lol]
+Patch1028: man2html-groff-segfault.patch
+
+# *roff parser: support "\[xx]"
+Patch1029: man2html-new-macros.patch
+
+# ignore font change requests that aren't followed by any words
+Patch1031: man2html-BR-empty-line.patch
+
+# fix some GCC warnings
+Patch1033: man2html-gcc-warnings.patch
+
+# Fedora patches
+
+# use /usr/lib/man2html for CGI
+# originally based on Debian patches 000 and 005
+Patch1: man2html-paths.patch
+
+# support gunzipping manpages
+# modified version of Debian patch 024
+Patch2: man2html-ungzip.patch
+Patch3: man2html-ungzip-makefile.patch
+
+# fix up CGI scripts/Makefile with Fedora paths
+Patch4: man2html-cgi.patch
+
+# hman cleanup: use xdg-open instead of lynxcgi by default and use correct path
+# for lynxcgi when manually requested
+Patch5: man2html-hman.patch
+
+# manpage cleanup: mention Fedora paths as default, use modern browser examples,
+# and describe LYNXCGI issues as runtime, not compile-time
+Patch6: man2html-doc.patch
+
+# fix format string warnings
+# will send back to Debian as soon as I locate the part of my brain that
+# remembers how to use their bugtracker
+Patch7: man2html-format.patch
+
+BuildRequires: recode
+
+Requires: %{name}-core%{?_isa} = %{version}-%{release}
+Requires: httpd
+
+Requires(post): policycoreutils
+Requires(postun): policycoreutils
+
+%description
+man2html is a man page to HTML converter.
+
+This package contains CGI scripts that allow you to view, browse, and search
+man pages using a web server.
+
+
+%package core
+Summary: Convert man pages to HTML
+
+%description core
+man2html is a man page to HTML converter.
+
+This package contains the man2html executable.
+
+
+%prep
+%setup -q -n man-%{version}%{posttag} -a1
+
+for p in %{patches}; do
+ patch -p1 -i $p
+done
+
+
+%build
+CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ;
+
+# Configure and make man2html binary
+# (not autoconf so don't use %%configure)
+./configure -d +fhs
+make %{?_smp_mflags}
+
+# make cgi scripts from debian
+cd debian/sources
+make %{?_smp_mflags}
+
+
+%install
+#install man2html binary
+make -C man2html DESTDIR=%{buildroot} install install-hman
+
+#install CGI scripts
+make -C debian/sources PREFIX=%{buildroot} install
+
+#install localized manpages
+install -Dpm0644 man2html/locales/fr/man2html.1 %{buildroot}%{_mandir}/fr/man1/man2html.1
+install -Dpm0644 man2html/locales/it/man2html.1 %{buildroot}%{_mandir}/it/man1/man2html.1
+install -Dpm0644 man2html/locales/it/hman.1 %{buildroot}%{_mandir}/it/man1/hman.1
+
+#convert localized manpages to UTF-8
+recode latin1..utf8 \
+ %{buildroot}%{_mandir}/fr/man1/man2html.1 \
+ %{buildroot}%{_mandir}/it/man1/man2html.1 \
+ %{buildroot}%{_mandir}/it/man1/hman.1
+
+#install httpd configuration
+install -Dpm0644 %SOURCE2 %{buildroot}%{_sysconfdir}/httpd/conf.d/man2html.conf
+
+#create cache directory for cgi scripts
+mkdir -p %{buildroot}%{_localstatedir}/cache/man2html
+
+
+%post
+#clear out the cache directory so all future pages are regenerated with the new build
+rm -f %{_localstatedir}/cache/man2html/* || :
+
+# unconfine CGI scripts from SELinux until selinux-policy is properly patched
+semanage fcontext -a -t httpd_unconfined_script_exec_t '%{_prefix}/lib/man2html/cgi-bin/man/(.*)?' 2>/dev/null || :
+restorecon -R %{_prefix}/lib/man2html || :
+
+
+%postun
+if [ $1 -eq 0 ] ; then # final removal
+semanage fcontext -d -t httpd_unconfined_script_exec_t '%{_prefix}/lib/man2html/cgi-bin/man/(.*)?' 2>/dev/null || :
+fi
+
+
+%files
+%attr(0755,-,-) %{_bindir}/hman
+%{_prefix}/lib/man2html/
+%attr(0775,root,apache) %{_localstatedir}/cache/man2html
+%config(noreplace) %{_sysconfdir}/httpd/conf.d/man2html.conf
+%{_mandir}/man1/hman.1.*
+%{_mandir}/it/man1/hman.1.*
+
+
+%files core
+%{_bindir}/man2html/
+%{_mandir}/man1/man2html.1.*
+%{_mandir}/*/man1/man2html.1.*
+%doc COPYING HISTORY man2html/README man2html/TODO
+
+
+%changelog
+* Fri May 18 2012 T.C. Hollingsworth <tchollingsworth at gmail.com> - 1.6-5.g
+- fix accidental use of wrong macro in %%post
+
+* Sun May 13 2012 T.C. Hollingsworth <tchollingsworth at gmail.com> - 1.6-4.g
+- clean up old cruft from patches and split them out more logically
+- hman: use xdg-open and proper paths
+- improve manpages
+- temporarily fix SELinux until selinux-policy is patched
+- clarify licensing
+
+* Wed May 09 2012 T.C. Hollingsworth <tchollingsworth at gmail.com> - 1.6-3.g
+- convert localized man page encoding properly
+
+* Mon May 07 2012 T.C. Hollingsworth <tchollingsworth at gmail.com> - 1.6-2.g
+- respect OPTFLAGS
+- fix entries in file list
+- fix links in man2html CGI output
+
+* Fri Dec 15 2011 T.C. Hollingsworth <tchollingsworth at gmail.com> - 1.6-1.g
+- initial RPM package
+
diff --git a/sources b/sources
index e69de29..b4ac719 100644
--- a/sources
+++ b/sources
@@ -0,0 +1,2 @@
+ba154d5796928b841c9c69f0ae376660 man-1.6g.tar.gz
+6f18ce733ec5ee567c361faf84aed323 man2html_1.6g-6.debian.tar.gz
More information about the scm-commits
mailing list