From: kristaps@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: "Groff allows the initial macro on a line to be delimited by a
Date: Sat, 7 Aug 2010 16:33:55 -0400 (EDT) [thread overview]
Message-ID: <201008072033.o77KXtE8017883@krisdoz.my.domain> (raw)
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
reply other threads:[~2010-08-07 20:33 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201008072033.o77KXtE8017883@krisdoz.my.domain \
--to=kristaps@mdocml.bsd.lv \
--cc=source@mdocml.bsd.lv \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).