* mdocml: "Groff allows the initial macro on a line to be delimited by a
@ 2010-08-07 20:33 kristaps
0 siblings, 0 replies; only message in thread
From: kristaps @ 2010-08-07 20:33 UTC (permalink / raw)
To: source
Log Message:
-----------
"Groff allows the initial macro on a line to be delimited by a space of
by a tab; so allow the tab in mandoc, too." Original problem noted by
schwarze@. Sync with OpenBSD.
Modified Files:
--------------
mdocml:
mdoc.c
Revision Data
-------------
Index: mdoc.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc.c,v
retrieving revision 1.159
retrieving revision 1.160
diff -Lmdoc.c -Lmdoc.c -u -p -r1.159 -r1.160
--- mdoc.c
+++ mdoc.c
@@ -764,11 +764,11 @@ mdoc_pmacro(struct mdoc *m, int ln, char
i = offs;
- /* Accept whitespace after the initial control char. */
+ /* Accept tabs/whitespace after the initial control char. */
- if (' ' == buf[i]) {
+ if (' ' == buf[i] || '\t' == buf[i]) {
i++;
- while (buf[i] && ' ' == buf[i])
+ while (buf[i] && (' ' == buf[i] || '\t' == buf[i]))
i++;
if ('\0' == buf[i])
return(1);
@@ -776,15 +776,19 @@ mdoc_pmacro(struct mdoc *m, int ln, char
sv = i;
- /* Copy the first word into a nil-terminated buffer. */
+ /*
+ * Copy the first word into a nil-terminated buffer. Stop
+ * copying when a tab, space, or eoln is encountered.
+ */
for (j = 0; j < 4; j++, i++) {
if ('\0' == (mac[j] = buf[i]))
break;
- else if (' ' == buf[i])
+ else if (' ' == buf[i] || '\t' == buf[i])
break;
/* Check for invalid characters. */
+ /* TODO: remove me, already done in main.c. */
if (isgraph((u_char)buf[i]))
continue;
@@ -807,7 +811,12 @@ mdoc_pmacro(struct mdoc *m, int ln, char
return(1);
}
- /* The macro is sane. Jump to the next word. */
+ /* Disregard the first trailing tab, if applicable. */
+
+ if ('\t' == buf[i])
+ i++;
+
+ /* Jump to the next non-whitespace word. */
while (buf[i] && ' ' == buf[i])
i++;
--
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:[~2010-08-07 20:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-07 20:33 mdocml: "Groff allows the initial macro on a line to be delimited by a kristaps
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).