aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--main.c12
-rw-r--r--man.19
-rw-r--r--mandoc.186
-rw-r--r--mandoc.h21
-rw-r--r--read.c22
-rw-r--r--roff.7778
-rw-r--r--roff.c476
7 files changed, 1282 insertions, 122 deletions
diff --git a/main.c b/main.c
index 30e076f2..d1f9ff92 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.216 2015/01/16 21:15:05 schwarze Exp $ */
+/* $Id: main.c,v 1.217 2015/01/20 21:16:51 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2012, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -889,14 +889,15 @@ static int
woptions(struct curparse *curp, char *arg)
{
char *v, *o;
- const char *toks[6];
+ const char *toks[7];
toks[0] = "stop";
toks[1] = "all";
toks[2] = "warning";
toks[3] = "error";
- toks[4] = "fatal";
- toks[5] = NULL;
+ toks[4] = "unsupp";
+ toks[5] = "fatal";
+ toks[6] = NULL;
while (*arg) {
o = arg;
@@ -913,6 +914,9 @@ woptions(struct curparse *curp, char *arg)
curp->wlevel = MANDOCLEVEL_ERROR;
break;
case 4:
+ curp->wlevel = MANDOCLEVEL_UNSUPP;
+ break;
+ case 5:
curp->wlevel = MANDOCLEVEL_BADARG;
break;
default:
diff --git a/man.1 b/man.1
index 11bc4ad8..95b72042 100644
--- a/man.1
+++ b/man.1
@@ -1,4 +1,4 @@
-.\" $Id: man.1,v 1.11 2015/01/15 04:26:40 schwarze Exp $
+.\" $Id: man.1,v 1.12 2015/01/20 21:16:51 schwarze Exp $
.\"
.\" Copyright (c) 1989, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -31,7 +31,7 @@
.\"
.\" @(#)man.1 8.2 (Berkeley) 1/2/94
.\"
-.Dd $Mdocdate: January 15 2015 $
+.Dd $Mdocdate: January 20 2015 $
.Dt MAN 1
.Os
.Sh NAME
@@ -300,9 +300,10 @@ to be reported on the standard error output and to affect the exit status.
The
.Ar level
can be
-.Cm warning
+.Cm warning ,
+.Cm error ,
or
-.Cm error ;
+.Cm unsupp ;
.Cm all
is an alias for
.Cm warning .
diff --git a/mandoc.1 b/mandoc.1
index 0489f0a3..817ef569 100644
--- a/mandoc.1
+++ b/mandoc.1
@@ -1,4 +1,4 @@
-.\" $Id: mandoc.1,v 1.132 2015/01/15 04:26:40 schwarze Exp $
+.\" $Id: mandoc.1,v 1.133 2015/01/20 21:16:51 schwarze Exp $
.\"
.\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
.\" Copyright (c) 2012, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -15,7 +15,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: January 15 2015 $
+.Dd $Mdocdate: January 20 2015 $
.Dt MANDOC 1
.Os
.Sh NAME
@@ -159,9 +159,10 @@ to be reported on the standard error output and to affect the exit status.
The
.Ar level
can be
-.Cm warning
+.Cm warning ,
+.Cm error ,
or
-.Cm error ;
+.Cm unsupp ;
.Cm all
is an alias for
.Cm warning .
@@ -532,7 +533,15 @@ At least one warning occurred, but no error, and
.Fl W Ns Cm warning
was specified.
.It 3
-At least one parsing error occurred, and
+At least one parsing error occurred,
+but no unsupported feature was encountered, and
+.Fl W Ns Cm error
+or
+.Fl W Ns Cm warning
+was specified.
+.It 4
+At least on unsupported feature was encountered, and
+.Fl W Ns Cm unsupp ,
.Fl W Ns Cm error
or
.Fl W Ns Cm warning
@@ -601,16 +610,28 @@ fields.
.Pp
Message levels have the following meanings:
.Bl -tag -width "warning"
-.It Cm error
-An input file contains syntax that cannot be safely interpreted,
-either because it is invalid or because
+.It Cm unsupp
+An input file uses unsupported low-level
+.Xr roff 7
+features.
+The output may be incomplete and/or misformatted,
+so using GNU troff instead of
.Nm
-does not implement it yet.
+to process the file may be preferable.
+.It Cm error
+An input file contains invalid syntax that cannot be safely interpreted.
By discarding part of the input or inserting missing tokens,
the parser is able to continue, and the error does not prevent
generation of formatted output, but typically, preparing that
output involves information loss, broken document structure
-or unintended formatting.
+or unintended formatting, no matter whether
+.Nm
+or GNU troff is used.
+In many cases, the output of
+.Nm
+and GNU troff is identical, but in some,
+.Nm
+is more resilient than GNU troff with respect to malformed input.
.Pp
Non-existent or unreadable input files are also reported on the
.Cm error
@@ -627,9 +648,10 @@ formatting tools instead of
.El
.Pp
Messages of the
-.Cm warning
+.Cm warning ,
+.Cm error ,
and
-.Cm error
+.Cm unsupp
levels except those about non-existent or unreadable input files
are hidden unless their level, or a lower level, is requested using a
.Fl W
@@ -1260,26 +1282,14 @@ keeps the code more readable.
.El
.Ss "Errors related to tables"
.Bl -inset -compact
-.It "bad table syntax"
-.It "bad table option"
-.It "bad table layout"
.It "no table layout cells specified"
.It "no table data cells specified"
.It "ignore data in cell"
.It "data block still open"
.It "ignoring extra data cells"
-.It "ignoring macro in table"
.El
.Ss "Errors related to roff, mdoc, and man code"
.Bl -ohang
-.It Sy "input too large"
-.Pq mdoc , man
-Currently,
-.Nm
-cannot handle input files larger than its arbitrary size limit
-of 2^31 bytes (2 Gigabytes).
-Since useful manuals are always small, this is not a problem in practice.
-Parsing is aborted as soon as the condition is detected.
.It Sy "input stack limit exceeded, infinite loop?"
.Pq roff
Explicit recursion limits are implemented for the following features,
@@ -1318,6 +1328,11 @@ or
macro.
It may be mistyped or unsupported.
The request or macro is discarded including its arguments.
+.It Sy "skipping insecure request"
+.Pq roff
+An input file attempted to run a shell command
+or to read or write an external file.
+Such attempts are denied for security reasons.
.It Sy "skipping item outside list"
.Pq mdoc , eqn
An
@@ -1530,6 +1545,29 @@ macro is invoked with more than one argument, or a request of the
family is invoked with more than two arguments.
The excess arguments are ignored.
.El
+.Ss Unsupported features
+.Bl -ohang
+.It Sy "input too large"
+.Pq mdoc , man
+Currently,
+.Nm
+cannot handle input files larger than its arbitrary size limit
+of 2^31 bytes (2 Gigabytes).
+Since useful manuals are always small, this is not a problem in practice.
+Parsing is aborted as soon as the condition is detected.
+.It Sy "unsupported roff request"
+.Pq roff
+An input file contains a
+.Xr roff 7
+request supported by GNU troff or Heirloom troff but not by
+.Nm ,
+and it is likely that this will cause information loss
+or considerable misformatting.
+.It Sy "bad table syntax"
+.It Sy "bad table option"
+.It Sy "bad table layout"
+.It Sy "ignoring macro in table"
+.El
.Sh COMPATIBILITY
This section summarises
.Nm
diff --git a/mandoc.h b/mandoc.h
index aa9a628b..8c3c8749 100644
--- a/mandoc.h
+++ b/mandoc.h
@@ -1,7 +1,7 @@
-/* $Id: mandoc.h,v 1.182 2015/01/15 04:26:40 schwarze Exp $ */
+/* $Id: mandoc.h,v 1.183 2015/01/20 21:16:51 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -31,7 +31,7 @@ enum mandoclevel {
MANDOCLEVEL_RESERVED,
MANDOCLEVEL_WARNING, /* warnings: syntax, whitespace, etc. */
MANDOCLEVEL_ERROR, /* input has been thrown away */
- MANDOCLEVEL_FATAL, /* input is borked */
+ MANDOCLEVEL_UNSUPP, /* input needs unimplemented features */
MANDOCLEVEL_BADARG, /* bad argument in invocation */
MANDOCLEVEL_SYSERR, /* system error */
MANDOCLEVEL_MAX
@@ -136,22 +136,18 @@ enum mandocerr {
MANDOCERR_EQNEOF, /* unexpected end of equation */
/* related to tables */
- MANDOCERR_TBL, /* bad table syntax */
- MANDOCERR_TBLOPT, /* bad table option */
- MANDOCERR_TBLLAYOUT, /* bad table layout */
MANDOCERR_TBLNOLAYOUT, /* no table layout cells specified */
MANDOCERR_TBLNODATA, /* no table data cells specified */
MANDOCERR_TBLIGNDATA, /* ignore data in cell */
MANDOCERR_TBLBLOCK, /* data block still open */
MANDOCERR_TBLEXTRADAT, /* ignoring extra data cells */
- MANDOCERR_TBLMACRO, /* ignoring macro in table: macro */
/* related to document structure and macros */
MANDOCERR_FILE, /* cannot open file */
- MANDOCERR_TOOLARGE, /* input too large */
MANDOCERR_ROFFLOOP, /* input stack limit exceeded, infinite loop? */
MANDOCERR_BADCHAR, /* skipping bad character: number */
MANDOCERR_MACRO, /* skipping unknown macro: macro */
+ MANDOCERR_REQ_INSEC, /* skipping insecure request: request */
MANDOCERR_IT_STRAY, /* skipping item outside list: It ... */
MANDOCERR_TA_STRAY, /* skipping column outside column list: Ta */
MANDOCERR_BLK_NOTOPEN, /* skipping end of block that is not open */
@@ -173,6 +169,15 @@ enum mandocerr {
MANDOCERR_ARG_EXCESS, /* skipping excess arguments: macro ... args */
MANDOCERR_DIVZERO, /* divide by zero */
+ MANDOCERR_UNSUPP, /* ===== start of unsupported features ===== */
+
+ MANDOCERR_TOOLARGE, /* input too large */
+ MANDOCERR_REQ_UNSUPP, /* unsupported roff request: request */
+ MANDOCERR_TBL, /* unsupported table syntax */
+ MANDOCERR_TBLOPT, /* unsupported table option */
+ MANDOCERR_TBLLAYOUT, /* unsupported table layout */
+ MANDOCERR_TBLMACRO, /* ignoring macro in table: macro */
+
MANDOCERR_MAX
};
diff --git a/read.c b/read.c
index 3b127aa1..67c0027d 100644
--- a/read.c
+++ b/read.c
@@ -1,4 +1,4 @@
-/* $Id: read.c,v 1.111 2015/01/15 04:26:40 schwarze Exp $ */
+/* $Id: read.c,v 1.112 2015/01/20 21:16:51 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -80,7 +80,7 @@ static const enum mandocerr mandoclimits[MANDOCLEVEL_MAX] = {
MANDOCERR_WARNING,
MANDOCERR_WARNING,
MANDOCERR_ERROR,
- MANDOCERR_MAX,
+ MANDOCERR_UNSUPP,
MANDOCERR_MAX,
MANDOCERR_MAX
};
@@ -180,22 +180,18 @@ static const char * const mandocerrs[MANDOCERR_MAX] = {
"unexpected end of equation",
/* related to tables */
- "bad table syntax",
- "bad table option",
- "bad table layout",
"no table layout cells specified",
"no table data cells specified",
"ignore data in cell",
"data block still open",
"ignoring extra data cells",
- "ignoring macro in table",
/* related to document structure and macros */
NULL,
- "input too large",
"input stack limit exceeded, infinite loop?",
"skipping bad character",
"skipping unknown macro",
+ "skipping insecure request",
"skipping item outside list",
"skipping column outside column list",
"skipping end of block that is not open",
@@ -216,6 +212,14 @@ static const char * const mandocerrs[MANDOCERR_MAX] = {
"skipping all arguments",
"skipping excess arguments",
"divide by zero",
+
+ "unsupported feature",
+ "input too large",
+ "unsupported roff request",
+ "unsupported table syntax",
+ "unsupported table option",
+ "unsupported table layout",
+ "ignoring macro in table",
};
static const char * const mandoclevels[MANDOCLEVEL_MAX] = {
@@ -223,7 +227,7 @@ static const char * const mandoclevels[MANDOCLEVEL_MAX] = {
"RESERVED",
"WARNING",
"ERROR",
- "FATAL",
+ "UNSUPP",
"BADARG",
"SYSERR"
};
@@ -958,7 +962,7 @@ mandoc_msg(enum mandocerr er, struct mparse *m,
{
enum mandoclevel level;
- level = MANDOCLEVEL_ERROR;
+ level = MANDOCLEVEL_UNSUPP;
while (er < mandoclimits[level])
level--;
diff --git a/roff.7 b/roff.7
index 68ed4d89..b50d8f74 100644
--- a/roff.7
+++ b/roff.7
@@ -1,4 +1,4 @@
-.\" $Id: roff.7,v 1.62 2015/01/20 19:39:34 schwarze Exp $
+.\" $Id: roff.7,v 1.63 2015/01/20 21:16:51 schwarze Exp $
.\"
.\" Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
.\" Copyright (c) 2010, 2011, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -395,27 +395,32 @@ The
.Xr mandoc 1
.Nm
parser recognises the following requests.
-Note that the
-.Nm
-language defines many more requests not implemented in
-.Xr mandoc 1 .
+For requests marked as "ignored" or "unsupported", any arguments are
+ignored, and the number of arguments is not checked.
+.Ss \&ab
+Abort processing.
+Currently unsupported.
.Ss \&ad
Set line adjustment mode.
-This line-scoped request is intended to have one argument to select
-normal, left, right, or center adjustment for subsequent text.
-Currently, it is ignored including its arguments,
-and the number of arguments is not checked.
+It takes one argument to select normal, left, right,
+or center adjustment for subsequent text.
+Currently ignored.
+.Ss \&af
+Assign an output format to a number register.
+Currently ignored.
+.Ss \&aln
+Create an alias for a number register.
+Currently unsupported.
+.Ss \&als
+Create an alias for a request, string, macro, or diversion.
+Currently unsupported.
.Ss \&am
Append to a macro definition.
The syntax of this request is the same as that of
.Sx \&de .
-.Ss \&ami
-Append to a macro definition, specifying the macro name indirectly.
-The syntax of this request is the same as that of
-.Sx \&dei .
.Ss \&am1
Append to a macro definition, switching roff compatibility mode off
-during macro execution.
+during macro execution (groff extension).
The syntax of this request is the same as that of
.Sx \&de1 .
Since
@@ -424,14 +429,96 @@ does not implement
.Nm
compatibility mode at all, it handles this request as an alias for
.Sx \&am .
+.Ss \&ami
+Append to a macro definition, specifying the macro name indirectly
+(groff extension).
+The syntax of this request is the same as that of
+.Sx \&dei .
+.Ss \&ami1
+Append to a macro definition, specifying the macro name indirectly
+and switching roff compatibility mode off during macro execution
+(groff extension).
+The syntax of this request is the same as that of
+.Sx \&dei1 .
+Since
+.Xr mandoc 1
+does not implement
+.Nm
+compatibility mode at all, it handles this request as an alias for
+.Sx \&ami .
.Ss \&as
Append to a user-defined string.
The syntax of this request is the same as that of
.Sx \&ds .
If a user-defined string with the specified name does not yet exist,
it is set to the empty string before appending.
+.Ss \&as1
+Append to a user-defined string, switching roff compatibility mode off
+during macro execution (groff extension).
+The syntax of this request is the same as that of
+.Sx \&ds1 .
+Since
+.Xr mandoc 1
+does not implement
+.Nm
+compatibility mode at all, it handles this request as an alias for
+.Sx \&as .
+.Ss \&asciify
+Fully unformat a diversion.
+Currently unsupported.
+.Ss \&backtrace
+Print a backtrace of the input stack.
+This is a groff extension and currently ignored.
+.Ss \&bd
+Artificially embolden by repeated printing with small shifts.
+Currently ignored.
+.Ss \&bleedat
+Set the BleedBox page parameter for PDF generation.
+This is a Heirloom extension and currently ignored.
+.Ss \&blm
+Set a blank line trap.
+Currently unsupported.
+.Ss \&box
+Begin a diversion without including a partially filled line.
+Currently unsupported.
+.Ss \&boxa
+Add to a diversion without including a partially filled line.
+Currently unsupported.
+.Ss \&bp
+Begin new page.
+Currently ignored.
+.Ss \&BP
+Define a frame and place a picture in it.
+This is a Heirloom extension and currently unsupported.
+.Ss \&br
+Break the output line.
+See
+.Xr man 7
+and
+.Xr mdoc 7 .
+.Ss \&break
+Break out of a
+.Sx \&while
+loop.
+Currently unsupported.
+.Ss \&breakchar
+Optional line break characters.
+This is a Heirloom extension and currently ignored.
+.Ss \&brnl
+Break output line after next N input lines.
+This is a Heirloom extension and currently ignored.
+.Ss \&brp
+Break and spread output line.
+Currently, this is implemented as an alias for
+.Sx \&br .
+.Ss \&brpnl
+Break and spread output line after next N input lines.
+This is a Heirloom extension and currently ignored.
+.Ss \&c2
+Change the no-break control character.
+Currently unsupported.
.Ss \&cc
-Changes the control character.
+Change the control character.
Its syntax is as follows:
.Bd -literal -offset indent
.Pf . Cm \&cc Op Ar c
@@ -444,10 +531,63 @@ is not specified, the control character is reset to
Trailing characters are ignored.
.Ss \&ce
Center some lines.
-This line-scoped request is intended to take one integer argument,
-specifying how many lines to center.
-Currently, it is ignored including its arguments, and the number
-of arguments is not checked.
+It takes one integer argument, specifying how many lines to center.
+Currently ignored.
+.Ss \&cf
+Output the contents of a file.
+Ignored because insecure.
+.Ss \&cflags
+Set character flags.
+This is a groff extension and currently ignored.
+.Ss \&ch
+Change a trap location.
+Currently ignored.
+.Ss \&char
+Define a new glyph.
+Currently unsupported.
+.Ss \&chop
+Remove the last character from a macro, string, or diversion.
+Currently unsupported.
+.Ss \&class
+Define a character class.
+This is a groff extension and currently ignored.
+.Ss \&close
+Close an open file.
+Ignored because insecure.
+.Ss \&CL
+Print text in color.
+This is a Heirloom extension and currently unsupported.
+.Ss \&color
+Activate or deactivate colors.
+This is a groff extension and currently ignored.
+.Ss \&composite
+Define a name component for composite glyph names.
+This is a groff extension and currently unsupported.
+.Ss \&continue
+Immediately start the next iteration of a
+.Sx \&while
+loop.
+Currently unsupported.
+.Ss \&cp
+Switch
+.Nm
+compatibility mode on or off.
+Currently ignored.
+.Ss \&cropat
+Set the CropBox page parameter for PDF generation.
+This is a Heirloom extension and currently ignored.
+.Ss \&cs
+Constant character spacing mode.
+Currently ignored.
+.Ss \&cu
+Underline including whitespace.
+Currently ignored.
+.Ss \&da
+Append to a diversion.
+Currently unsupported.
+.Ss \&dch
+Change a trap location in the current diversion.
+This is a Heirloom extension and currently unsupported.
.Ss \&de
Define a
.Nm
@@ -547,10 +687,26 @@ to a large, but finite number, and
.Xr mandoc 1
also limits the length of the expanded input line.
Do not rely on the exact values of these limits.
+.Ss \&de1
+Define a
+.Nm
+macro that will be executed with
+.Nm
+compatibility mode switched off during macro execution.
+This is a groff extension.
+Since
+.Xr mandoc 1
+does not implement
+.Nm
+compatibility mode at all, it handles this request as an alias for
+.Sx \&de .
+.Ss \&defcolor
+Define a color name.
+This is a groff extension and currently ignored.
.Ss \&dei
Define a
.Nm
-macro, specifying the macro name indirectly.
+macro, specifying the macro name indirectly (groff extension).
The syntax of this request is the same as that of
.Sx \&de .
The request
@@ -560,21 +716,33 @@ The request
has the same effect as:
.Pp
.D1 Pf . Cm \&de No \e* Ns Bo Ar name Bc Op \e* Ns Bq Ar end
-.Ss \&de1
+.Ss \&dei1
Define a
.Nm
macro that will be executed with
.Nm
-compatibility mode switched off during macro execution.
-This is a GNU extension not available in traditional
-.Nm
-implementations and not even in older versions of groff.
+compatibility mode switched off during macro execution,
+specifying the macro name indirectly (groff extension).
Since
.Xr mandoc 1
does not implement
.Nm
compatibility mode at all, it handles this request as an alias for
-.Sx \&de .
+.Sx \&dei .
+.Ss \&device
+This request only makes sense with the groff-specific intermediate
+output format and is unsupported.
+.Ss \&devicem
+This request only makes sense with the groff-specific intermediate
+output format and is unsupported.
+.Ss \&di
+Begin a diversion.
+Currently unsupported.
+.Ss \&do
+Execute
+.Nm
+request or macro line with compatibility mode disabled.
+Currently unsupported.
.Ss \&ds
Define a user-defined string.
Its syntax is as follows:
@@ -633,6 +801,32 @@ macro when used in a
.Xr man 7
document.
Such abuse is of course strongly discouraged.
+.Ss \&ds1
+Define a user-defined string that will be expanded with
+.Nm
+compatibility mode switched off during string expansion.
+This is a groff extension.
+Since
+.Xr mandoc 1
+does not implement
+.Nm
+compatibility mode at all, it handles this request as an alias for
+.Sx \&ds .
+.Ss \&dwh
+Set a location trap in the current diversion.
+This is a Heirloom extension and currently unsupported.
+.Ss \&dt
+Set a trap within a diversion.
+Currently unsupported.
+.Ss \&ec
+Change the escape character.
+Currently unsupported.
+.Ss \&ecs
+Restore the escape character.
+Currently unsupported.
+.Ss \&ecr
+Save the escape character.
+Currently unsupported.
.Ss \&el
The
.Qq else
@@ -647,21 +841,89 @@ then false is assumed.
The syntax of this request is similar to
.Sx \&if
except that the conditional is missing.
+.Ss \&em
+Set a trap at the end of input.
+Currently unsupported.
.Ss \&EN
End an equation block.
See
.Sx \&EQ .
+.Ss \&eo
+Disable the escape mechanism completely.
+Currently unsupported.
+.Ss \&EP
+End a picture started by
+.Sx \&BP .
+This is a Heirloom extension and currently unsupported.
.Ss \&EQ
Begin an equation block.
See
.Xr eqn 7
for a description of the equation language.
+.Ss \&errprint
+Print a string like an error message.
+This is a Heirloom extension and currently ignored.
+.Ss \&ev
+Switch to another environment.
+Currently unsupported.
+.Ss \&evc
+Copy an environment into the current environment.
+Currently unsupported.
+.Ss \&ex
+Abort processing and exit.
+Currently unsupported.
+.Ss \&fallback
+Select the fallback sequence for a font.
+This is a Heirloom extension and currently ignored.
.Ss \&fam
Change the font family.
-This line-scoped request is intended to have one argument specifying
-the font family to be selected.
-It is a groff extension, and currently, it is ignored including its
-arguments, and the number of arguments is not checked.
+Takes one argument specifying the font family to be selected.
+It is a groff extension and currently ignored.
+.Ss \&fc
+Define a delimiting and a padding character for fields.
+Currently unsupported.
+.Ss \&fchar
+Define a fallback glyph.
+Currently unsupported.
+.Ss \&fcolor
+Set the fill color for \eD objects.
+This is a groff extension and currently ignored.
+.Ss \&fdeferlig
+Defer ligature building.
+This is a Heirloom extension and currently ignored.
+.Ss \&feature
+Enable or disable an OpenType feature.
+This is a Heirloom extension and currently ignored.
+.Ss \&fi
+Switch to fill mode.
+See
+.Xr man 7 .
+Ignored in
+.Xr mdoc 7 .
+.Ss \&fkern
+Control the use of kerning tables for a font.
+This is a Heirloom extension and currently ignored.
+.Ss \&fl
+Flush output.
+Currently ignored.
+.Ss \&flig
+Define ligatures.
+This is a Heirloom extension and currently ignored.
+.Ss \&fp
+Assign font position.
+Currently ignored.
+.Ss \&fps
+Mount a font with a special character map.
+This is a Heirloom extension and currently ignored.
+.Ss \&fschar
+Define a font-specific fallback glyph.
+This is a groff extension and currently unsupported.
+.Ss \&fspacewidth
+Set a font-specific width for the space character.
+This is a Heirloom extension and currently ignored.
+.Ss \&fspecial
+Conditionally define a special font.
+This is a groff extension and currently ignored.
.Ss \&ft
Change the font.
Its syntax is as follows:
@@ -690,12 +952,60 @@ This request takes effect only locally, may be overridden by macros
and escape sequences, and is only supported in
.Xr man 7
for now.
+.Ss \&ftr
+Translate font name.
+This is a groff extension and currently ignored.
+.Ss \&fzoom
+Zoom font size.
+Currently ignored.
+.Ss \&gcolor
+Set glyph color.
+This is a groff extension and currently ignored.
+.Ss \&hc
+Set the hyphenation character.
+Currently ignored.
+.Ss \&hcode
+Set hyphenation codes of characters.
+Currently ignored.
+.Ss \&hidechar
+Hide characters in a font.
+This is a Heirloom extension and currently ignored.
+.Ss \&hla
+Set hyphenation language.
+This is a groff extension and currently ignored.
+.Ss \&hlm
+Set maximum number of consecutive hyphenated lines.
+Currently ignored.
+.Ss \&hpf
+Load hyphenation pattern file.
+This is a groff extension and currently ignored.
+.Ss \&hpfa
+Load hyphenation pattern file, appending to the current patterns.
+This is a groff extension and currently ignored.
+.Ss \&hpfcode
+Define mapping values for character codes in hyphenation patterns.
+This is a groff extension and currently ignored.
.Ss \&hw
Specify hyphenation points in words.
-This line-scoped request is currently ignored.
+Currently ignored.
.Ss \&hy
Set automatic hyphenation mode.
-This line-scoped request is currently ignored.
+Currently ignored.
+.Ss \&hylang
+Set hyphenation language.
+This is a Heirloom extension and currently ignored.
+.Ss \&hylen
+Minimum word length for hyphenation.
+This is a Heirloom extension and currently ignored.
+.Ss \&hym
+Set hyphenation margin.
+This is a groff extension and currently ignored.
+.Ss \&hypp
+Define hyphenation penalties.
+This is a Heirloom extension and currently ignored.
+.Ss \&hys
+Set hyphenation space.
+This is a groff extension and currently ignored.
.Ss \&ie
The
.Qq if
@@ -873,6 +1183,77 @@ Otherwise, it only terminates the
and arguments following it or the
.Sq \&..
request are discarded.
+.Ss \&in
+Change indentation.
+See
+.Xr man 7 .
+Ignored in
+.Xr mdoc 7 .
+.Ss \&index
+Find a substring in a string.
+This is a Heirloom extension and currently unsupported.
+.Ss \&it
+Set an input line trap.
+Its syntax is as follows:
+.Pp
+.D1 Pf . Cm it Ar number macro
+.Pp
+The named
+.Ar macro
+will be invoked after processing the specified
+.Ar number
+of input text lines.
+.Ss \&itc
+Set an input line trap, not counting lines ending with \ec.
+Currently unsupported.
+.Ss \&IX
+To support the generation of a table of contents,
+.Xr pod2man 1
+emits this user-defined macro, usually without defining it.
+To avoid reporting large numbers of spurious errors,
+.Xr mandoc 1
+ignores it.
+.Ss \&kern
+Switch kerning on or off.
+Currently ignored.
+.Ss \&kernafter
+Increase kerning after some characters.
+This is a Heirloom extension and currently ignored.
+.Ss \&kernbefore
+Increase kerning before some characters.
+This is a Heirloom extension and currently ignored.
+.Ss \&kernpair
+Add a kerning pair to the kerning table.
+This is a Heirloom extension and currently ignored.
+.Ss \&lc
+Define a leader repetition character.
+Currently unsupported.
+.Ss \&lc_ctype
+Set the
+.Dv LC_CTYPE
+locale.
+This is a Heirloom extension and currently unsupported.
+.Ss \&lds
+Define a local string.
+This is a Heirloom extension and currently unsupported.
+.Ss \&length
+Count the number of input characters in a user-defined string.
+Currently unsupported.
+.Ss \&letadj
+Dynamic letter spacing and reshaping.
+This is a Heirloom extension and currently ignored.
+.Ss \&lf
+Change the line number for error messages.
+Ignored because insecure.
+.Ss \&lg
+Switch the ligature mechanism on or off.
+Currently ignored.
+.Ss \&lhang
+Hang characters at left margin.
+This is a Heirloom extension and currently ignored.
+.Ss \&linetabs
+Enable or disable line-tabs mode.
+This is a groff extension and currently unsupported.
.Ss \&ll
Change the output line length.
Its syntax is as follows:
@@ -890,13 +1271,69 @@ among others because it overrides the
.Xr mandoc 1
.Fl O Cm width
command line option.
+.Ss \&lnr
+Set local number register.
+This is a Heirloom extension and currently unsupported.
+.Ss \&lnrf
+Set local floating-point register.
+This is a Heirloom extension and currently unsupported.
+.Ss \&lpfx
+Set a line prefix.
+This is a Heirloom extension and currently unsupported.
+.Ss \&ls
+Set line spacing.
+It takes one integer argument specifying the vertical distance of
+subsequent output text lines measured in v units.
+Currently ignored.
+.Ss \&lsm
+Set a leading spaces trap.
+This is a groff extension and currently unsupported.
+.Ss \&lt
+Set title line length.
+Currently ignored.
+.Ss \&mc
+Print margin character in the right margin.
+Currently ignored.
+.Ss \&mediasize
+Set the device media size.
+This is a Heirloom extension and currently ignored.
+.Ss \&minss
+Set minimum word space.
+This is a Heirloom extension and currently ignored.
+.Ss \&mk
+Mark vertical position.
+Currently ignored.
+.Ss \&mso
+Load a macro file.
+Ignored because insecure.
+.Ss \&na
+Disable adjusting without changing the adjustment mode.
+Currently ignored.
.Ss \&ne
Declare the need for the specified minimum vertical space
before the next trap or the bottom of the page.
-This line-scoped request is currently ignored.
+Currently ignored.
+.Ss \&nf
+Switch to no-fill mode.
+See
+.Xr man 7 .
+Ignored by
+.Xr mdoc 7.
.Ss \&nh
Turn off automatic hyphenation mode.
-This line-scoped request is currently ignored.
+Currently ignored.
+.Ss \&nhychar
+Define hyphenation-inhibiting characters.
+This is a Heirloom extension and currently ignored.
+.Ss \&nm
+Print line numbers.
+Currently unsupported.
+.Ss \&nn
+Temporarily turn off line numbering.
+Currently unsupported.
+.Ss \&nop
+Exexute the rest of the input line as a request or macro line.
+Currently unsupported.
.Ss \&nr
Define or change a register.
A register is an arbitrary string value that defines some sort of state,
@@ -934,31 +1371,142 @@ section with the
.Cm \&Sh
macro will reset this register.
.El
+.Ss \&nrf
+Define or change a floating-point register.
+This is a Heirloom extension and currently unsupported.
+.Ss \&nroff
+Force nroff mode.
+This is a groff extension and currently ignored.
.Ss \&ns
Turn on no-space mode.
-This line-scoped request is intended to take no arguments.
-Currently, it is ignored including its arguments,
-and the number of arguments is not checked.
+Currently ignored.
+.Ss \&nx
+Abort processing of the current input file and process another one.
+Ignored because insecure.
+.Ss \&open
+Open a file for writing.
+Ignored because insecure.
+.Ss \&opena
+Open a file for appending.
+Ignored because insecure.
+.Ss \&os
+Output saved vertical space.
+Currently ignored.
+.Ss \&output
+Output directly to intermediate output.
+Not supported.
+.Ss \&padj
+Globally control paragraph-at-once adjustment.
+This is a Heirloom extension and currently ignored.
+.Ss \&papersize
+Set the paper size.
+This is a Heirloom extension and currently ignored.
+.Ss \&pc
+Change the page number character.
+Currently ignored.
+.Ss \&pev
+Print environments.
+This is a groff extension and currently ignored.
+.Ss \&pi
+Pipe output to a shell command.
+Ignored because insecure.
+.Ss \&PI
+Low-level request used by
+.Sx \&BP .
+This is a Heirloom extension and currently unsupported.
.Ss \&pl
Change page length.
-This line-scoped request is intended to take one height argument.
-Currently, it is ignored including its arguments,
-and the number of arguments is not checked.
+Takes one height argument.
+Currently ignored.
+.Ss \&pm
+Print names and sizes of macros, strings, and diversions.
+Currently ignored.
+.Ss \&pn
+Change page number of the next page.
+Currently ignored.
+.Ss \&pnr
+Print all number registers.
+Currently ignored.
+.Ss \&po
+Set horizontal page offset.
+Currently ignored.
.Ss \&ps
Change point size.
-This line-scoped request is intended to take one numerical argument.
-Currently, it is ignored including its arguments,
-and the number of arguments is not checked.
+Takes one numerical argument.
+Currently ignored.
+.Ss \&psbb
+Retrieve the bounding box of a PostScript file.
+Currently unsupported.
+.Ss \&pshape
+Set a special shape for the current paragraph.
+This is a Heirloom extension and currently ignored.
+.Ss \&pso
+Include output of a shell command.
+Ignored because insecure.
+.Ss \&ptr
+Print the names and positions of all traps.
+This is a groff extension and currently ignored.
+.Ss \&pvs
+Change post-vertical spacing.
+This is a groff extension and currently ignored.
+.Ss \&rchar
+Remove glyph definitions.
+Currently unsupported.
+.Ss \&rd
+Read from standard input.
+Currently ignored.
+.Ss \&recursionlimit
+Set the maximum stack depth for recursive macros.
+This is a Heirloom extension and currently ignored.
+.Ss \&return
+Exit a macro and return to the caller.
+Currently unsupported.
+.Ss \&rfschar
+Remove font-specific fallback glyph definitions.
+Currently unsupported.
+.Ss \&rhang
+Hang characters at right margin.
+This is a Heirloom extension and currently ignored.
+.Ss \&rj
+Justify unfilled text to the right margin.
+Currently ignored.
.Ss \&rm
Remove a request, macro or string.
Its syntax is as follows:
.Pp
.D1 Pf \. Cm \&rm Ar name
+.Ss \&rn
+Rename a request, macro, diversion, or string.
+Currently unsupported.
+.Ss \&rnn
+Rename a number register.
+Currently unsupported.
.Ss \&rr
Remove a register.
Its syntax is as follows:
.Pp
.D1 Pf \. Cm \&rr Ar name
+.Ss \&rs
+End no-space mode.
+Currently ignored.
+.Ss \&rt
+Return to marked vertical position.
+Currently ignored.
+.Ss \&schar
+Define global fallback glyph.
+This is a groff extension and currently unsupported.
+.Ss \&sentchar
+Define sentence-ending characters.
+This is a Heirloom extension and currently ignored.
+.Ss \&shc
+Change the soft hyphen character.
+Currently ignored.
+.Ss \&shift
+Shift macro arguments.
+Currently unsupported.
+.Ss \&sizes
+Define permissible point sizes.
+This is a groff extension and currently ignored.
.Ss \&so
Include a source file.
Its syntax is as follows:
@@ -992,10 +1540,64 @@ is discouraged.
Use
.Xr ln 1
instead.
+.Ss \&spacewidth
+Set the space width from the font metrics file.
+This is a Heirloom extension and currently ignored.
+.Ss \&special
+Define a special font.
+This is a groff extension and currently ignored.
+.Ss \&spreadwarn
+Warn about wide spacing between words.
+Currently ignored.
+.Ss \&ss
+Set space character size.
+Currently ignored.
+.Ss \&sty
+Associate style with a font position.
+This is a groff extension and currently ignored.
+.Ss \&substring
+Replace a user-defined string with a substring.
+Currently unsupported.
+.Ss \&sv
+Save vertical space.
+Currently ignored.
+.Ss \&sy
+Execute shell command.
+Ignored because insecure.
+.Ss \&T&
+Re-start a table layout, retaining the options of the prior table
+invocation.
+See
+.Sx \&TS .
.Ss \&ta
Set tab stops.
-This line-scoped request can take an arbitrary number of arguments.
-Currently, it is ignored including its arguments.
+Takes an arbitrary number of arguments.
+Currently ignored.
+.Ss \&tc
+Change tab repetion character.
+Currently unsupported.
+.Ss \&TE
+End a table context.
+See
+.Sx \&TS .
+.Ss \&ti
+Temporary indent.
+Currently ignored.
+.Ss \&tkf
+Enable track kerning for a font.
+Currently ignored.
+.Ss \&tl
+Print a title line.
+Currently unsupported.
+.Ss \&tm
+Print to standard error output.
+Currently ignored.
+.Ss \&tm1
+Print to standard error output, allowing leading blanks.
+This is a groff extension and currently ignored.
+.Ss \&tmc
+Print to standard error output without a trailing newline.
+This is a groff extension and currently ignored.
.Ss \&tr
Output character translation.
Its syntax is as follows:
@@ -1013,20 +1615,88 @@ Replacement (or origin) characters may also be character escapes; thus,
.Dl tr \e(xx\e(yy
.Pp
replaces all invocations of \e(xx with \e(yy.
-.Ss \&T&
-Re-start a table layout, retaining the options of the prior table
-invocation.
-See
-.Sx \&TS .
-.Ss \&TE
-End a table context.
-See
-.Sx \&TS .
+.Ss \&track
+Static letter space tracking.
+This is a Heirloom extension and currently ignored.
+.Ss \&transchar
+Define transparent characters for sentence-ending.
+This is a Heirloom extension and currently ignored.
+.Ss \&trf
+Output the contents of a file, disallowing invalid characters.
+This is a groff extension and ignored because insecure.
+.Ss \&trimat
+Set the TrimBox page parameter for PDF generation.
+This is a Heirloom extension and currently ignored.
+.Ss \&trin
+Output character translation, ignored by
+.Cm \&asciify .
+Currently unsupported.
+.Ss \&trnt
+Output character translation, ignored by \e!.
+Currently unsupported.
+.Ss \&troff
+Force troff mode.
+This is a groff extension and currently ignored.
.Ss \&TS
Begin a table, which formats input in aligned rows and columns.
See
.Xr tbl 7
for a description of the tbl language.
+.Ss \&uf
+Globally set the underline font.
+Currently ignored.
+.Ss \&ul
+Underline.
+Currently ignored.
+.Ss \&unformat
+Unformat spaces and tabs in a diversion.
+Currently unsupported.
+.Ss \&unwatch
+Disable notification for string or macro.
+This is a Heirloom extension and currently ignored.
+.Ss \&unwatchn
+Disable notification for register.
+This is a Heirloom extension and currently ignored.
+.Ss \&vpt
+Enable or disable vertical position traps.
+This is a groff extension and currently ignored.
+.Ss \&vs
+Change vertical spacing.
+Currently ignored.
+.Ss \&warn
+Set warning level.
+Currently ignored.
+.Ss \&warnscale
+Set the scaling indicator used in warnings.
+This is a groff extension and currently ignored.
+.Ss \&watch
+Notify on change of string or macro.
+This is a Heirloom extension and currently ignored.
+.Ss \&watchlength
+On change, report the contents of macros and strings
+up to the sepcified length.
+This is a Heirloom extension and currently ignored.
+.Ss \&watchn
+Notify on change of register.
+This is a Heirloom extension and currently ignored.
+.Ss \&wh
+Set a page location trap.
+Currently unsupported.
+.Ss \&while
+Repeated execution while a condition is true.
+Currently unsupported.
+.Ss \&write
+Write to an open file.
+Ignored because insecure.
+.Ss \&writec
+Write to an open file without appending a newline.
+Ignored because insecure.
+.Ss \&writem
+Write macro or string to an open file.
+Ignored because insecure.
+.Ss \&xflag
+Set the extension level.
+This is a Heirloom extension and currently ignored.
.Ss Numerical expressions
The
.Sx \&nr ,
diff --git a/roff.c b/roff.c
index a554c843..87caa47b 100644
--- a/roff.c
+++ b/roff.c
@@ -1,4 +1,4 @@
-/* $Id: roff.c,v 1.250 2015/01/16 16:53:49 schwarze Exp $ */
+/* $Id: roff.c,v 1.251 2015/01/20 21:16:51 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011, 2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -38,44 +38,247 @@
#define EXPAND_LIMIT 1000
enum rofft {
+ ROFF_ab,
ROFF_ad,
+ ROFF_af,
+ ROFF_aln,
+ ROFF_als,
ROFF_am,
- ROFF_ami,
ROFF_am1,
+ ROFF_ami,
+ ROFF_ami1,
ROFF_as,
+ ROFF_as1,
+ ROFF_asciify,
+ ROFF_backtrace,
+ ROFF_bd,
+ ROFF_bleedat,
+ ROFF_blm,
+ ROFF_box,
+ ROFF_boxa,
+ ROFF_bp,
+ ROFF_BP,
+ /* MAN_br, MDOC_br */
+ ROFF_break,
+ ROFF_breakchar,
+ ROFF_brnl,
+ ROFF_brp,
+ ROFF_brpnl,
+ ROFF_c2,
ROFF_cc,
ROFF_ce,
+ ROFF_cf,
+ ROFF_cflags,
+ ROFF_ch,
+ ROFF_char,
+ ROFF_chop,
+ ROFF_class,
+ ROFF_close,
+ ROFF_CL,
+ ROFF_color,
+ ROFF_composite,
+ ROFF_continue,
+ ROFF_cp,
+ ROFF_cropat,
+ ROFF_cs,
+ ROFF_cu,
+ ROFF_da,
+ ROFF_dch,
+ ROFF_Dd,
ROFF_de,
- ROFF_dei,
ROFF_de1,
+ ROFF_defcolor,
+ ROFF_dei,
+ ROFF_dei1,
+ ROFF_device,
+ ROFF_devicem,
+ ROFF_di,
+ ROFF_do,
ROFF_ds,
+ ROFF_ds1,
+ ROFF_dwh,
+ ROFF_dt,
+ ROFF_ec,
+ ROFF_ecr,
+ ROFF_ecs,
ROFF_el,
+ ROFF_em,
+ ROFF_EN,
+ ROFF_eo,
+ ROFF_EP,
+ ROFF_EQ,
+ ROFF_errprint,
+ ROFF_ev,
+ ROFF_evc,
+ ROFF_ex,
+ ROFF_fallback,
ROFF_fam,
+ ROFF_fc,
+ ROFF_fchar,
+ ROFF_fcolor,
+ ROFF_fdeferlig,
+ ROFF_feature,
+ /* MAN_fi; ignored in mdoc(7) */
+ ROFF_fkern,
+ ROFF_fl,
+ ROFF_flig,
+ ROFF_fp,
+ ROFF_fps,
+ ROFF_fschar,
+ ROFF_fspacewidth,
+ ROFF_fspecial,
+ /* MAN_ft; ignored in mdoc(7) */
+ ROFF_ftr,
+ ROFF_fzoom,
+ ROFF_gcolor,
+ ROFF_hc,
+ ROFF_hcode,
+ ROFF_hidechar,
+ ROFF_hla,
+ ROFF_hlm,
+ ROFF_hpf,
+ ROFF_hpfa,
+ ROFF_hpfcode,
ROFF_hw,
ROFF_hy,
+ ROFF_hylang,
+ ROFF_hylen,
+ ROFF_hym,
+ ROFF_hypp,
+ ROFF_hys,
ROFF_ie,
ROFF_if,
ROFF_ig,
+ /* MAN_in; ignored in mdoc(7) */
+ ROFF_index,
ROFF_it,
+ ROFF_itc,
+ ROFF_IX,
+ ROFF_kern,
+ ROFF_kernafter,
+ ROFF_kernbefore,
+ ROFF_kernpair,
+ ROFF_lc,
+ ROFF_lc_ctype,
+ ROFF_lds,
+ ROFF_length,
+ ROFF_letadj,
+ ROFF_lf,
+ ROFF_lg,
+ ROFF_lhang,
+ ROFF_linetabs,
+ /* MAN_ll, MDOC_ll */
+ ROFF_lnr,
+ ROFF_lnrf,
+ ROFF_lpfx,
+ ROFF_ls,
+ ROFF_lsm,
+ ROFF_lt,
+ ROFF_mc,
+ ROFF_mediasize,
+ ROFF_minss,
+ ROFF_mk,
+ ROFF_mso,
+ /* MAN_na; ignored in mdoc(7) */
ROFF_ne,
+ /* MAN_nf; ignored in mdoc(7) */
ROFF_nh,
+ ROFF_nhychar,
+ ROFF_nm,
+ ROFF_nn,
+ ROFF_nop,
ROFF_nr,
+ ROFF_nrf,
+ ROFF_nroff,
ROFF_ns,
+ ROFF_nx,
+ ROFF_open,
+ ROFF_opena,
+ ROFF_os,
+ ROFF_output,
+ ROFF_padj,
+ ROFF_papersize,
+ ROFF_pc,
+ ROFF_pev,
+ ROFF_pi,
+ ROFF_PI,
ROFF_pl,
+ ROFF_pm,
+ ROFF_pn,
+ ROFF_pnr,
+ ROFF_po,
ROFF_ps,
+ ROFF_psbb,
+ ROFF_pshape,
+ ROFF_pso,
+ ROFF_ptr,
+ ROFF_pvs,
+ ROFF_rchar,
+ ROFF_rd,
+ ROFF_recursionlimit,
+ ROFF_return,
+ ROFF_rfschar,
+ ROFF_rhang,
+ ROFF_rj,
ROFF_rm,
+ ROFF_rn,
+ ROFF_rnn,
ROFF_rr,
+ ROFF_rs,
+ ROFF_rt,
+ ROFF_schar,
+ ROFF_sentchar,
+ ROFF_shc,
+ ROFF_shift,
+ ROFF_sizes,
ROFF_so,
+ /* MAN_sp, MDOC_sp */
+ ROFF_spacewidth,
+ ROFF_special,
+ ROFF_spreadwarn,
+ ROFF_ss,
+ ROFF_sty,
+ ROFF_substring,
+ ROFF_sv,
+ ROFF_sy,
+ ROFF_T_,
ROFF_ta,
- ROFF_tr,
- ROFF_Dd,
+ ROFF_tc,
+ ROFF_TE,
ROFF_TH,
+ ROFF_ti,
+ ROFF_tkf,
+ ROFF_tl,
+ ROFF_tm,
+ ROFF_tm1,
+ ROFF_tmc,
+ ROFF_tr,
+ ROFF_track,
+ ROFF_transchar,
+ ROFF_trf,
+ ROFF_trimat,
+ ROFF_trin,
+ ROFF_trnt,
+ ROFF_troff,
ROFF_TS,
- ROFF_TE,
- ROFF_T_,
- ROFF_EQ,
- ROFF_EN,
- ROFF_IX,
+ ROFF_uf,
+ ROFF_ul,
+ ROFF_unformat,
+ ROFF_unwatch,
+ ROFF_unwatchn,
+ ROFF_vpt,
+ ROFF_vs,
+ ROFF_warn,
+ ROFF_warnscale,
+ ROFF_watch,
+ ROFF_watchlength,
+ ROFF_watchn,
+ ROFF_wh,
+ ROFF_while,
+ ROFF_write,
+ ROFF_writec,
+ ROFF_writem,
+ ROFF_xflag,
ROFF_cblock,
ROFF_USERDEF,
ROFF_MAX
@@ -179,6 +382,7 @@ static void roffnode_push(struct roff *, enum rofft,
static enum rofferr roff_block(ROFF_ARGS);
static enum rofferr roff_block_text(ROFF_ARGS);
static enum rofferr roff_block_sub(ROFF_ARGS);
+static enum rofferr roff_brp(ROFF_ARGS);
static enum rofferr roff_cblock(ROFF_ARGS);
static enum rofferr roff_cc(ROFF_ARGS);
static void roff_ccond(struct roff *, int, int);
@@ -205,6 +409,7 @@ static int roff_getregn(const struct roff *,
static int roff_getregro(const char *name);
static const char *roff_getstrn(const struct roff *,
const char *, size_t);
+static enum rofferr roff_insec(ROFF_ARGS);
static enum rofferr roff_it(ROFF_ARGS);
static enum rofferr roff_line_ignore(ROFF_ARGS);
static enum rofferr roff_nr(ROFF_ARGS);
@@ -227,6 +432,7 @@ static enum rofferr roff_TS(ROFF_ARGS);
static enum rofferr roff_EQ(ROFF_ARGS);
static enum rofferr roff_EN(ROFF_ARGS);
static enum rofferr roff_T_(ROFF_ARGS);
+static enum rofferr roff_unsupp(ROFF_ARGS);
static enum rofferr roff_userdef(ROFF_ARGS);
/* See roffhash_find() */
@@ -238,44 +444,239 @@ static enum rofferr roff_userdef(ROFF_ARGS);
static struct roffmac *hash[HASHWIDTH];
static struct roffmac roffs[ROFF_MAX] = {
+ { "ab", roff_unsupp, NULL, NULL, 0, NULL },
{ "ad", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "af", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "aln", roff_unsupp, NULL, NULL, 0, NULL },
+ { "als", roff_unsupp, NULL, NULL, 0, NULL },
{ "am", roff_block, roff_block_text, roff_block_sub, 0, NULL },
- { "ami", roff_block, roff_block_text, roff_block_sub, 0, NULL },
{ "am1", roff_block, roff_block_text, roff_block_sub, 0, NULL },
+ { "ami", roff_block, roff_block_text, roff_block_sub, 0, NULL },
+ { "ami1", roff_block, roff_block_text, roff_block_sub, 0, NULL },
{ "as", roff_ds, NULL, NULL, 0, NULL },
+ { "as1", roff_ds, NULL, NULL, 0, NULL },
+ { "asciify", roff_unsupp, NULL, NULL, 0, NULL },
+ { "backtrace", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "bd", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "bleedat", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "blm", roff_unsupp, NULL, NULL, 0, NULL },
+ { "box", roff_unsupp, NULL, NULL, 0, NULL },
+ { "boxa", roff_unsupp, NULL, NULL, 0, NULL },
+ { "bp", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "BP", roff_unsupp, NULL, NULL, 0, NULL },
+ { "break", roff_unsupp, NULL, NULL, 0, NULL },
+ { "breakchar", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "brnl", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "brp", roff_brp, NULL, NULL, 0, NULL },
+ { "brpnl", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "c2", roff_unsupp, NULL, NULL, 0, NULL },
{ "cc", roff_cc, NULL, NULL, 0, NULL },
{ "ce", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "cf", roff_insec, NULL, NULL, 0, NULL },
+ { "cflags", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "ch", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "char", roff_unsupp, NULL, NULL, 0, NULL },
+ { "chop", roff_unsupp, NULL, NULL, 0, NULL },
+ { "class", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "close", roff_insec, NULL, NULL, 0, NULL },
+ { "CL", roff_unsupp, NULL, NULL, 0, NULL },
+ { "color", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "composite", roff_unsupp, NULL, NULL, 0, NULL },
+ { "continue", roff_unsupp, NULL, NULL, 0, NULL },
+ { "cp", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "cropat", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "cs", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "cu", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "da", roff_unsupp, NULL, NULL, 0, NULL },
+ { "dch", roff_unsupp, NULL, NULL, 0, NULL },
+ { "Dd", roff_Dd, NULL, NULL, 0, NULL },
{ "de", roff_block, roff_block_text, roff_block_sub, 0, NULL },
- { "dei", roff_block, roff_block_text, roff_block_sub, 0, NULL },
{ "de1", roff_block, roff_block_text, roff_block_sub, 0, NULL },
+ { "defcolor", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "dei", roff_block, roff_block_text, roff_block_sub, 0, NULL },
+ { "dei1", roff_block, roff_block_text, roff_block_sub, 0, NULL },
+ { "device", roff_unsupp, NULL, NULL, 0, NULL },
+ { "devicem", roff_unsupp, NULL, NULL, 0, NULL },
+ { "di", roff_unsupp, NULL, NULL, 0, NULL },
+ { "do", roff_unsupp, NULL, NULL, 0, NULL },
{ "ds", roff_ds, NULL, NULL, 0, NULL },
+ { "ds1", roff_ds, NULL, NULL, 0, NULL },
+ { "dwh", roff_unsupp, NULL, NULL, 0, NULL },
+ { "dt", roff_unsupp, NULL, NULL, 0, NULL },
+ { "ec", roff_unsupp, NULL, NULL, 0, NULL },
+ { "ecr", roff_unsupp, NULL, NULL, 0, NULL },
+ { "ecs", roff_unsupp, NULL, NULL, 0, NULL },
{ "el", roff_cond, roff_cond_text, roff_cond_sub, ROFFMAC_STRUCT, NULL },
+ { "em", roff_unsupp, NULL, NULL, 0, NULL },
+ { "EN", roff_EN, NULL, NULL, 0, NULL },
+ { "eo", roff_unsupp, NULL, NULL, 0, NULL },
+ { "EP", roff_unsupp, NULL, NULL, 0, NULL },
+ { "EQ", roff_EQ, NULL, NULL, 0, NULL },
+ { "errprint", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "ev", roff_unsupp, NULL, NULL, 0, NULL },
+ { "evc", roff_unsupp, NULL, NULL, 0, NULL },
+ { "ex", roff_unsupp, NULL, NULL, 0, NULL },
+ { "fallback", roff_line_ignore, NULL, NULL, 0, NULL },
{ "fam", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "fc", roff_unsupp, NULL, NULL, 0, NULL },
+ { "fchar", roff_unsupp, NULL, NULL, 0, NULL },
+ { "fcolor", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "fdeferlig", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "feature", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "fkern", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "fl", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "flig", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "fp", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "fps", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "fschar", roff_unsupp, NULL, NULL, 0, NULL },
+ { "fspacewidth", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "fspecial", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "ftr", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "fzoom", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "gcolor", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "hc", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "hcode", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "hidechar", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "hla", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "hlm", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "hpf", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "hpfa", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "hpfcode", roff_line_ignore, NULL, NULL, 0, NULL },
{ "hw", roff_line_ignore, NULL, NULL, 0, NULL },
{ "hy", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "hylang", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "hylen", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "hym", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "hypp", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "hys", roff_line_ignore, NULL, NULL, 0, NULL },
{ "ie", roff_cond, roff_cond_text, roff_cond_sub, ROFFMAC_STRUCT, NULL },
{ "if", roff_cond, roff_cond_text, roff_cond_sub, ROFFMAC_STRUCT, NULL },
{ "ig", roff_block, roff_block_text, roff_block_sub, 0, NULL },
+ { "index", roff_unsupp, NULL, NULL, 0, NULL },
{ "it", roff_it, NULL, NULL, 0, NULL },
+ { "itc", roff_unsupp, NULL, NULL, 0, NULL },
+ { "IX", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "kern", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "kernafter", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "kernbefore", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "kernpair", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "lc", roff_unsupp, NULL, NULL, 0, NULL },
+ { "lc_ctype", roff_unsupp, NULL, NULL, 0, NULL },
+ { "lds", roff_unsupp, NULL, NULL, 0, NULL },
+ { "length", roff_unsupp, NULL, NULL, 0, NULL },
+ { "letadj", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "lf", roff_insec, NULL, NULL, 0, NULL },
+ { "lg", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "lhang", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "linetabs", roff_unsupp, NULL, NULL, 0, NULL },
+ { "lnr", roff_unsupp, NULL, NULL, 0, NULL },
+ { "lnrf", roff_unsupp, NULL, NULL, 0, NULL },
+ { "lpfx", roff_unsupp, NULL, NULL, 0, NULL },
+ { "ls", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "lsm", roff_unsupp, NULL, NULL, 0, NULL },
+ { "lt", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "mc", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "mediasize", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "minss", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "mk", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "mso", roff_insec, NULL, NULL, 0, NULL },
{ "ne", roff_line_ignore, NULL, NULL, 0, NULL },
{ "nh", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "nhychar", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "nm", roff_unsupp, NULL, NULL, 0, NULL },
+ { "nn", roff_unsupp, NULL, NULL, 0, NULL },
+ { "nop", roff_unsupp, NULL, NULL, 0, NULL },
{ "nr", roff_nr, NULL, NULL, 0, NULL },
+ { "nrf", roff_unsupp, NULL, NULL, 0, NULL },
+ { "nroff", roff_line_ignore, NULL, NULL, 0, NULL },
{ "ns", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "nx", roff_insec, NULL, NULL, 0, NULL },
+ { "open", roff_insec, NULL, NULL, 0, NULL },
+ { "opena", roff_insec, NULL, NULL, 0, NULL },
+ { "os", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "output", roff_unsupp, NULL, NULL, 0, NULL },
+ { "padj", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "papersize", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "pc", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "pev", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "pi", roff_insec, NULL, NULL, 0, NULL },
+ { "PI", roff_unsupp, NULL, NULL, 0, NULL },
{ "pl", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "pm", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "pn", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "pnr", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "po", roff_line_ignore, NULL, NULL, 0, NULL },
{ "ps", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "psbb", roff_unsupp, NULL, NULL, 0, NULL },
+ { "pshape", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "pso", roff_insec, NULL, NULL, 0, NULL },
+ { "ptr", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "pvs", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "rchar", roff_unsupp, NULL, NULL, 0, NULL },
+ { "rd", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "recursionlimit", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "return", roff_unsupp, NULL, NULL, 0, NULL },
+ { "rfschar", roff_unsupp, NULL, NULL, 0, NULL },
+ { "rhang", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "rj", roff_line_ignore, NULL, NULL, 0, NULL },
{ "rm", roff_rm, NULL, NULL, 0, NULL },
+ { "rn", roff_unsupp, NULL, NULL, 0, NULL },
+ { "rnn", roff_unsupp, NULL, NULL, 0, NULL },
{ "rr", roff_rr, NULL, NULL, 0, NULL },
+ { "rs", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "rt", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "schar", roff_unsupp, NULL, NULL, 0, NULL },
+ { "sentchar", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "shc", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "shift", roff_unsupp, NULL, NULL, 0, NULL },
+ { "sizes", roff_line_ignore, NULL, NULL, 0, NULL },
{ "so", roff_so, NULL, NULL, 0, NULL },
+ { "spacewidth", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "special", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "spreadwarn", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "ss", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "sty", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "substring", roff_unsupp, NULL, NULL, 0, NULL },
+ { "sv", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "sy", roff_insec, NULL, NULL, 0, NULL },
+ { "T&", roff_T_, NULL, NULL, 0, NULL },
{ "ta", roff_line_ignore, NULL, NULL, 0, NULL },
- { "tr", roff_tr, NULL, NULL, 0, NULL },
- { "Dd", roff_Dd, NULL, NULL, 0, NULL },
+ { "tc", roff_unsupp, NULL, NULL, 0, NULL },
+ { "TE", roff_TE, NULL, NULL, 0, NULL },
{ "TH", roff_TH, NULL, NULL, 0, NULL },
+ { "ti", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "tkf", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "tl", roff_unsupp, NULL, NULL, 0, NULL },
+ { "tm", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "tm1", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "tmc", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "tr", roff_tr, NULL, NULL, 0, NULL },
+ { "track", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "transchar", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "trf", roff_insec, NULL, NULL, 0, NULL },
+ { "trimat", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "trin", roff_unsupp, NULL, NULL, 0, NULL },
+ { "trnt", roff_unsupp, NULL, NULL, 0, NULL },
+ { "troff", roff_line_ignore, NULL, NULL, 0, NULL },
{ "TS", roff_TS, NULL, NULL, 0, NULL },
- { "TE", roff_TE, NULL, NULL, 0, NULL },
- { "T&", roff_T_, NULL, NULL, 0, NULL },
- { "EQ", roff_EQ, NULL, NULL, 0, NULL },
- { "EN", roff_EN, NULL, NULL, 0, NULL },
- { "IX", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "uf", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "ul", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "unformat", roff_unsupp, NULL, NULL, 0, NULL },
+ { "unwatch", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "unwatchn", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "vpt", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "vs", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "warn", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "warnscale", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "watch", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "watchlength", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "watchn", roff_line_ignore, NULL, NULL, 0, NULL },
+ { "wh", roff_unsupp, NULL, NULL, 0, NULL },
+ { "while", roff_unsupp, NULL, NULL, 0, NULL },
+ { "write", roff_insec, NULL, NULL, 0, NULL },
+ { "writec", roff_insec, NULL, NULL, 0, NULL },
+ { "writem", roff_insec, NULL, NULL, 0, NULL },
+ { "xflag", roff_line_ignore, NULL, NULL, 0, NULL },
{ ".", roff_cblock, NULL, NULL, 0, NULL },
{ NULL, roff_userdef, NULL, NULL, 0, NULL },
};
@@ -986,8 +1387,12 @@ roff_block(ROFF_ARGS)
if (tok == ROFF_de1)
tok = ROFF_de;
+ else if (tok == ROFF_dei1)
+ tok = ROFF_dei;
else if (tok == ROFF_am1)
tok = ROFF_am;
+ else if (tok == ROFF_ami1)
+ tok = ROFF_ami;
/* Parse the macro name argument. */
@@ -1323,6 +1728,24 @@ roff_line_ignore(ROFF_ARGS)
}
static enum rofferr
+roff_insec(ROFF_ARGS)
+{
+
+ mandoc_msg(MANDOCERR_REQ_INSEC, r->parse,
+ ln, ppos, roffs[tok].name);
+ return(ROFF_IGN);
+}
+
+static enum rofferr
+roff_unsupp(ROFF_ARGS)
+{
+
+ mandoc_msg(MANDOCERR_REQ_UNSUPP, r->parse,
+ ln, ppos, roffs[tok].name);
+ return(ROFF_IGN);
+}
+
+static enum rofferr
roff_cond(ROFF_ARGS)
{
@@ -1405,6 +1828,13 @@ roff_ds(ROFF_ARGS)
const char *name;
size_t namesz;
+ /* Ignore groff compatibility mode for now. */
+
+ if (tok == ROFF_ds1)
+ tok = ROFF_ds;
+ else if (tok == ROFF_as1)
+ tok = ROFF_as;
+
/*
* The first word is the name of the string.
* If it is empty or terminated by an escape sequence,
@@ -2025,6 +2455,14 @@ roff_TS(ROFF_ARGS)
}
static enum rofferr
+roff_brp(ROFF_ARGS)
+{
+
+ buf->buf[pos - 1] = '\0';
+ return(ROFF_CONT);
+}
+
+static enum rofferr
roff_cc(ROFF_ARGS)
{
const char *p;