From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp1.rz.uni-karlsruhe.de (Debian-exim@smtp1.rz.uni-karlsruhe.de [129.13.185.217]) by krisdoz.my.domain (8.14.3/8.14.3) with ESMTP id oB3LnVCE010878 for ; Fri, 3 Dec 2010 16:49:34 -0500 (EST) Received: from hekate.usta.de (asta-nat.asta.uni-karlsruhe.de [172.22.63.82]) by smtp1.rz.uni-karlsruhe.de with esmtp (Exim 4.63 #1) id 1POdVR-0007w1-QC; Fri, 03 Dec 2010 22:49:29 +0100 Received: from donnerwolke.usta.de ([172.24.96.3]) by hekate.usta.de with esmtp (Exim 4.72) (envelope-from ) id 1POdVR-0003cP-Ot for tech@mdocml.bsd.lv; Fri, 03 Dec 2010 22:49:29 +0100 Received: from iris.usta.de ([172.24.96.5] helo=usta.de) by donnerwolke.usta.de with esmtp (Exim 4.69) (envelope-from ) id 1POdVR-0005Vw-NW for tech@mdocml.bsd.lv; Fri, 03 Dec 2010 22:49:29 +0100 Received: from schwarze by usta.de with local (Exim 4.72) (envelope-from ) id 1POdVR-0003gF-Mo for tech@mdocml.bsd.lv; Fri, 03 Dec 2010 22:49:29 +0100 Date: Fri, 3 Dec 2010 22:49:29 +0100 From: Ingo Schwarze To: tech@mdocml.bsd.lv Subject: Re: roff.c question Message-ID: <20101203214929.GB28384@iris.usta.de> References: <4CF678F0.6020304@bsd.lv> <20101201212834.GA22990@iris.usta.de> <4CF77A2B.6020702@bsd.lv> <4CF79F45.6080105@bsd.lv> <20101202225019.GD12188@iris.usta.de> X-Mailinglist: mdocml-tech Reply-To: tech@mdocml.bsd.lv MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20101202225019.GD12188@iris.usta.de> User-Agent: Mutt/1.5.21 (2010-09-15) Hi Kristaps, > 1) roff_res() should not expand \\* or \\\\*, > but it should expand \* and \\\*. OK for the following patch? It fixes this test case: .TH bsbs 1 "December 3, 2010" .SH NAME bsbs - double backslash in a string definition .SH DESCRIPTION .ds right wrong .ds inner *[right] .ds outer \\*[inner] result: \*[outer] .PP The above line must be "result: *[right]", not "result: wrong". Index: roff.c =================================================================== RCS file: /cvs/src/usr.bin/mandoc/roff.c,v retrieving revision 1.21 diff -u -p -r1.21 roff.c --- roff.c 28 Nov 2010 19:35:33 -0000 1.21 +++ roff.c 3 Dec 2010 21:44:36 -0000 @@ -338,14 +338,19 @@ static int roff_res(struct roff *r, char **bufp, size_t *szp, int pos) { const char *cp, *cpp, *st, *res; - int i, maxl; + int i, bs, maxl; size_t nsz; char *n; - /* LINTED */ - for (cp = &(*bufp)[pos]; (cpp = strstr(cp, "\\*")); cp++) { - cp = cpp + 2; - switch (*cp) { + cp = *bufp + pos; + bs = 0; + while (*cp) { + cpp = cp++; + if ('\\' == *cp) + bs = !bs; + if ( ! (bs && '*' == *cp)) + continue; + switch (*(++cp)) { case ('('): cp++; maxl = 2; -- To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv