source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Even on macro lines, \} must not cause whitespace.
@ 2014-03-07 18:30 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2014-03-07 18:30 UTC (permalink / raw)
  To: source

Log Message:
-----------
Even on macro lines, \} must not cause whitespace.

Modified Files:
--------------
    mdocml:
        roff.c

Revision Data
-------------
Index: roff.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/roff.c,v
retrieving revision 1.195
retrieving revision 1.196
diff -Lroff.c -Lroff.c -u -p -r1.195 -r1.196
--- roff.c
+++ roff.c
@@ -1070,25 +1070,21 @@ roff_cond_sub(ROFF_ARGS)
 					ln, ppos, pos, offs));
 	}
 
+	/*
+	 * If `\}' occurs on a macro line without a preceding macro,
+	 * drop the line completely.
+	 */
+
+	ep = *bufp + pos;
+	if ('\\' == ep[0] && '}' == ep[1])
+		rr = ROFFRULE_DENY;
+
 	/* Always check for the closing delimiter `\}'. */
 
-	ep = &(*bufp)[pos];
 	while (NULL != (ep = strchr(ep, '\\'))) {
 		if ('}' != *(++ep))
 			continue;
-
-		/*
-		 * If we're at the end of line, then just chop
-		 * off the \} and resize the buffer.
-		 * If we aren't, then convert it to spaces.
-		 */
-
-		if ('\0' == *(ep + 1)) {
-			*--ep = '\0';
-			*szp -= 2;
-		} else
-			*(ep - 1) = *ep = ' ';
-
+		*ep = '&';
 		roff_ccond(r, ln, pos);
 	}
 	return(ROFFRULE_DENY == rr ? ROFF_IGN : ROFF_CONT);
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-03-07 18:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-07 18:30 mdocml: Even on macro lines, \} must not cause whitespace schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).