File: 025-man2html-macro-all-args.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 (50 lines) | stat: -rw-r--r-- 1,174 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
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;
 }