You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
man2html/SOURCES/man2html-all-args.patch

51 lines
1.1 KiB

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;
}