From b7895d8ec2e29e7f4e5b1cd4519fb56397523b8a Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 18 Sep 2014 08:57:25 -0700 Subject: Fix broken argument delimiting in macro calls. The argument line of a macro must be expanded first, and then broken into words according to the original quotes. For instance .mac \\$* passes multiple arguments, not a single argument containing spaces. And .mac "\\$*" must pass a single argument; moreover, if \\$* expands into stuff that contains double quotes, those should probably not be recognized. --- man2html/man2html.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/man2html/man2html.c b/man2html/man2html.c index 1a9309e..642847c 100644 --- a/man2html/man2html.c +++ b/man2html/man2html.c @@ -2854,19 +2854,19 @@ scan_request(char *c) { int oldnargs; int deflen; int onff; - sl=fill_words(c+j, wordlist, SIZE(wordlist), &words, '\n'); - c=sl+1; - *sl=0; + char *h=NULL; + + /* expand first, then break into words. */ + trans_char(c+j,'"','\b'); + if (mandoc_command) + c=scan_troff_mandoc(c+j,1,&h); + else + c=scan_troff(c+j,1,&h); + trans_char(h,'"','\a'); + trans_char(h,'\b','"'); + fill_words(h, wordlist, SIZE(wordlist), &words, '\n'); for (i=1; ist); @@ -2884,8 +2884,7 @@ scan_request(char *c) { newline_for_fun=onff; argument=oldargument; nargs=oldnargs; - for (i=0; i480) { FLUSHIBP; } } else if (*h == controlsym && h[-1] == '\n') { h++; FLUSHIBP; -- cgit v1.2.3