File: 012-man2html-TH.patch

package info (click to toggle)
man2html 1.6f%2Brepack-1%2Bsqueeze1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 3,416 kB
  • ctags: 2,894
  • sloc: ansic: 9,558; sh: 2,301; makefile: 343; perl: 335; awk: 305; lisp: 171; cs: 170
file content (56 lines) | stat: -rw-r--r-- 1,751 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
Accept troff macros in .TH line (closes: #180335).

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:29:38.000000000 +0100
+++ man-1.6e/man2html/man2html.c	2007-01-31 01:29:38.000000000 +0100
@@ -2102,21 +2102,46 @@
 	case V('T','H'):
 	    if (!output_possible) {
 		sl = fill_words(c+j, wordlist, SIZE(wordlist), &words, 0);
+		/* 
+		 * fill_words changes `"' into `\a', 
+		 * remove all `\a' now
+		 * robert@debian.org, Jan 2003
+		 */
+		for (i=0; i<words; i++) {
+			if (wordlist[i][0] == '\a') {
+				char *tmp;
+				(wordlist[i])++;
+				if ((tmp = strchr(wordlist[i], '\a')))
+					*tmp = '\0';
+			}
+		}
 		*sl = 0;
 		if (words > 1) {
+		    char *t = NULL;
+		    char *s, *q;
+		    int skip=0;
 		    output_possible=1;
 		    printf(CONTENTTYPE DOCTYPE);
 		    out_html("<HTML><HEAD><TITLE>Man page of ");
-		    out_html(wordlist[0]);
+		    scan_troff(wordlist[0], 0, &t);
+		    /* we need to remove all html tags */
+		    for (s=q=t; *s; s++) {
+	              if (skip && *s == '>') skip=0;
+		      else if (!skip && *s == '<') skip=1;
+		      else if (!skip) *q++ = *s;
+		    }
+		    *q = '\0';
+		    out_html(t);
+		    free(t);
 		    out_html("</TITLE>\n</HEAD><BODY>\n<H1>");
-		    out_html(wordlist[0]);
+		    scan_troff(wordlist[0], 0, NULL);
 		    out_html("</H1>\nSection: ");
 		    if (words>4)
-			out_html(wordlist[4]);
+		    	scan_troff(wordlist[4], 0, NULL);
 		    else
 			out_html(section_name(wordlist[1]));
 		    out_html(" (");
-		    out_html(wordlist[1]);
+		    scan_troff(wordlist[1], 0, NULL);
 		    if (words>2) {
 			out_html(")<BR>Updated: ");
 			scan_troff(wordlist[2], 1, NULL);