From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from krisdoz.my.domain (schwarze@localhost [127.0.0.1]) by krisdoz.my.domain (8.14.5/8.14.5) with ESMTP id r5KMdUse012955 for ; Thu, 20 Jun 2013 18:39:30 -0400 (EDT) Received: (from schwarze@localhost) by krisdoz.my.domain (8.14.5/8.14.3/Submit) id r5KMdU3e030560; Thu, 20 Jun 2013 18:39:30 -0400 (EDT) Date: Thu, 20 Jun 2013 18:39:30 -0400 (EDT) Message-Id: <201306202239.r5KMdU3e030560@krisdoz.my.domain> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: schwarze@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: Improve handling of the roff(7) "\t" escape sequence: * Parsing X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- Improve handling of the roff(7) "\t" escape sequence: * Parsing macro arguments has to be done in copy mode, which implies replacing "\t" by a literal tab character. * Otherwise, render "\t" as the empty string, not as a 't' character. This fixes formatting of the distfile example in the oldrdist(1) manual. This also shows up in the unzip(1) manual as one of several issues preventing the removal of USE_GROFF from the archivers/unzip port. Thanks to espie@ for attracting my attention to the unzip(1) manual. Modified Files: -------------- mdocml: chars.c chars.in mandoc.c Revision Data ------------- Index: mandoc.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandoc.c,v retrieving revision 1.66 retrieving revision 1.67 diff -Lmandoc.c -Lmandoc.c -u -p -r1.66 -r1.67 --- mandoc.c +++ mandoc.c @@ -432,17 +432,35 @@ mandoc_getarg(struct mparse *parse, char pairs = 0; white = 0; for (cp = start; '\0' != *cp; cp++) { - /* Move left after quoted quotes and escaped backslashes. */ + + /* + * Move the following text left + * after quoted quotes and after "\\" and "\t". + */ if (pairs) cp[-pairs] = cp[0]; + if ('\\' == cp[0]) { - if ('\\' == cp[1]) { - /* Poor man's copy mode. */ + /* + * In copy mode, translate double to single + * backslashes and backslash-t to literal tabs. + */ + switch (cp[1]) { + case ('t'): + cp[0] = '\t'; + /* FALLTHROUGH */ + case ('\\'): pairs++; cp++; - } else if (0 == quoted && ' ' == cp[1]) + break; + case (' '): /* Skip escaped blanks. */ - cp++; + if (0 == quoted) + cp++; + break; + default: + break; + } } else if (0 == quoted) { if (' ' == cp[0]) { /* Unescaped blanks end unquoted args. */ Index: chars.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/chars.c,v retrieving revision 1.53 retrieving revision 1.54 diff -Lchars.c -Lchars.c -u -p -r1.53 -r1.54 --- chars.c +++ chars.c @@ -37,7 +37,7 @@ struct ln { int unicode; }; -#define LINES_MAX 328 +#define LINES_MAX 329 #define CHAR(in, ch, code) \ { NULL, (in), (ch), (code) }, Index: chars.in =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/chars.in,v retrieving revision 1.42 retrieving revision 1.43 diff -Lchars.in -Lchars.in -u -p -r1.42 -r1.43 --- chars.in +++ chars.in @@ -42,6 +42,7 @@ CHAR("&", "", 0) CHAR("^", "", 0) CHAR("|", "", 0) CHAR("}", "", 0) +CHAR("t", "", 0) /* Accents. */ CHAR("a\"", "\"", 779) -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv