* mdocml: If we have to reparse the text line because we spring an input
@ 2015-08-29 23:56 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2015-08-29 23:56 UTC (permalink / raw)
To: source
Log Message:
-----------
If we have to reparse the text line because we spring an input line trap,
we must not escape breakable hyphens yet, or mparse_buf_r() in read.c
will complain and replace the escaped hyphens with question marks.
Bug found in ocserv(8) following a report from Kurt Jaeger <pi at FreeBSD>.
Modified Files:
--------------
mdocml:
roff.c
Revision Data
-------------
Index: roff.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/roff.c,v
retrieving revision 1.274
retrieving revision 1.275
diff -Lroff.c -Lroff.c -u -p -r1.274 -r1.275
--- roff.c
+++ roff.c
@@ -1484,9 +1484,7 @@ roff_res(struct roff *r, struct buf *buf
}
/*
- * Process text streams:
- * Convert all breakable hyphens into ASCII_HYPH.
- * Decrement and spring input line trap.
+ * Process text streams.
*/
static enum rofferr
roff_parsetext(struct buf *buf, int pos, int *offs)
@@ -1497,6 +1495,22 @@ roff_parsetext(struct buf *buf, int pos,
int isz;
enum mandoc_esc esc;
+ /* Spring the input line trap. */
+
+ if (roffit_lines == 1) {
+ isz = mandoc_asprintf(&p, "%s\n.%s", buf->buf, roffit_macro);
+ free(buf->buf);
+ buf->buf = p;
+ buf->sz = isz + 1;
+ *offs = 0;
+ free(roffit_macro);
+ roffit_lines = 0;
+ return(ROFF_REPARSE);
+ } else if (roffit_lines > 1)
+ --roffit_lines;
+
+ /* Convert all breakable hyphens into ASCII_HYPH. */
+
start = p = buf->buf + pos;
while (*p != '\0') {
@@ -1525,19 +1539,6 @@ roff_parsetext(struct buf *buf, int pos,
*p = ASCII_HYPH;
p++;
}
-
- /* Spring the input line trap. */
- if (roffit_lines == 1) {
- isz = mandoc_asprintf(&p, "%s\n.%s", buf->buf, roffit_macro);
- free(buf->buf);
- buf->buf = p;
- buf->sz = isz + 1;
- *offs = 0;
- free(roffit_macro);
- roffit_lines = 0;
- return(ROFF_REPARSE);
- } else if (roffit_lines > 1)
- --roffit_lines;
return(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:[~2015-08-29 23:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-29 23:56 mdocml: If we have to reparse the text line because we spring an input 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).