summaryrefslogtreecommitdiffstats
path: root/roff.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2018-08-10 04:41:25 +0000
committerIngo Schwarze <schwarze@openbsd.org>2018-08-10 04:41:25 +0000
commit940e1d9d0ef8fd73b06cf6fdbb151d1e49bb9e35 (patch)
treede18483b1de7319316ff7d94fa0639d9f8381061 /roff.c
parent220517fb68d12713ff95882a6d53ead200d12fcf (diff)
downloadmandoc-940e1d9d0ef8fd73b06cf6fdbb151d1e49bb9e35.tar.gz
Implement the roff(7) .nop (no operation) request.
Examples of manual pages (ab)using it include groff(7), chem(1), groff_mom(7), and groff_hdtbl(7).
Diffstat (limited to 'roff.c')
-rw-r--r--roff.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/roff.c b/roff.c
index c6d7dad1..dde46486 100644
--- a/roff.c
+++ b/roff.c
@@ -197,6 +197,7 @@ static enum rofferr roff_line_ignore(ROFF_ARGS);
static void roff_man_alloc1(struct roff_man *);
static void roff_man_free1(struct roff_man *);
static enum rofferr roff_manyarg(ROFF_ARGS);
+static enum rofferr roff_nop(ROFF_ARGS);
static enum rofferr roff_nr(ROFF_ARGS);
static enum rofferr roff_onearg(ROFF_ARGS);
static enum roff_tok roff_parse(struct roff *, char *, int *,
@@ -490,7 +491,7 @@ static struct roffmac roffs[TOKEN_NONE] = {
{ roff_line_ignore, NULL, NULL, 0 }, /* nhychar */
{ roff_unsupp, NULL, NULL, 0 }, /* nm */
{ roff_unsupp, NULL, NULL, 0 }, /* nn */
- { roff_unsupp, NULL, NULL, 0 }, /* nop */
+ { roff_nop, NULL, NULL, 0 }, /* nop */
{ roff_nr, NULL, NULL, 0 }, /* nr */
{ roff_unsupp, NULL, NULL, 0 }, /* nrf */
{ roff_line_ignore, NULL, NULL, 0 }, /* nroff */
@@ -3161,6 +3162,15 @@ roff_eo(ROFF_ARGS)
}
static enum rofferr
+roff_nop(ROFF_ARGS)
+{
+ while (buf->buf[pos] == ' ')
+ pos++;
+ *offs = pos;
+ return ROFF_RERUN;
+}
+
+static enum rofferr
roff_tr(ROFF_ARGS)
{
const char *p, *first, *second;