summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TODO3
-rw-r--r--roff.711
-rw-r--r--roff.c12
3 files changed, 18 insertions, 8 deletions
diff --git a/TODO b/TODO
index 2ba832c2..90815dff 100644
--- a/TODO
+++ b/TODO
@@ -38,9 +38,6 @@ are mere guesses, and some may be wrong.
--- missing roff features ----------------------------------------------
-- .nop prints its arguments as text,
- see groff(7) for an example
-
- .ft CB selects constant-width bold font
see groff_out(7) for examples
diff --git a/roff.7 b/roff.7
index b7f499d9..f7036ef4 100644
--- a/roff.7
+++ b/roff.7
@@ -206,7 +206,7 @@ Unescaped trailing spaces are stripped from text line input unless in a
literal context.
In general, trailing whitespace on any input line is discouraged for
reasons of portability.
-In the rare case that a blank character is needed at the end of an
+In the rare case that a space character is needed at the end of an
input line, it may be forced by
.Sq \e\ \e& .
.Pp
@@ -665,7 +665,7 @@ produces
.Pp
in the input stream, and thus in the output: \fI\^XtFree\^\fP.
Each occurrence of \e\e$* is replaced with all the arguments,
-joined together with single blank characters.
+joined together with single space characters.
.Pp
Since macros and user-defined strings share a common string table,
defining a macro
@@ -1346,8 +1346,11 @@ Currently unsupported.
Temporarily turn off line numbering.
Currently unsupported.
.It Ic \&nop Ar body
-Execute the rest of the input line as a request or macro line.
-Currently unsupported.
+Execute the rest of the input line as a request, macro, or text line,
+skipping the
+.Ic \&nop
+request and any space characters immediately following it.
+This is mostly used to indent text lines inside macro definitions.
.It Ic \&nr Ar register Oo Cm + Ns | Ns Cm - Oc Ns Ar expression Op Ar stepsize
Define or change a register.
A register is an arbitrary string value that defines some sort of state,
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;