summaryrefslogtreecommitdiffstats
path: root/roff.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-10-25 14:35:37 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-10-25 14:35:37 +0000
commit7b96ff8a068bfd465f5368284af0ef9bdd35797a (patch)
tree564893946a11db66d93277f3c1cf4d62ba6d5a2d /roff.c
parentdd148a56f3f3e29132148b8f2bace859b7590d34 (diff)
downloadmandoc-7b96ff8a068bfd465f5368284af0ef9bdd35797a.tar.gz
Report arguments to .EQ as an error, and simplify the code:
* drop trivial wrapper function roff_openeqn() * drop unused first arg of function eqn_alloc() * drop usused member "name" of struct eqn_node While here, sync to OpenBSD by killing some trailing blanks.
Diffstat (limited to 'roff.c')
-rw-r--r--roff.c29
1 files changed, 9 insertions, 20 deletions
diff --git a/roff.c b/roff.c
index b556ed21..b7b31800 100644
--- a/roff.c
+++ b/roff.c
@@ -207,8 +207,6 @@ static const char *roff_getstrn(const struct roff *,
static enum rofferr roff_it(ROFF_ARGS);
static enum rofferr roff_line_ignore(ROFF_ARGS);
static enum rofferr roff_nr(ROFF_ARGS);
-static void roff_openeqn(struct roff *, const char *,
- int, int, const char *);
static enum rofft roff_parse(struct roff *, char *, int *,
int, int);
static enum rofferr roff_parsetext(char **, size_t *, int, int *);
@@ -1469,7 +1467,7 @@ roff_getop(const char *v, int *pos, char *res)
* or a single signed integer number.
*/
static int
-roff_evalpar(struct roff *r, int ln,
+roff_evalpar(struct roff *r, int ln,
const char *v, int *pos, int *res)
{
@@ -1499,7 +1497,7 @@ roff_evalpar(struct roff *r, int ln,
* Proceed left to right, there is no concept of precedence.
*/
static int
-roff_evalnum(struct roff *r, int ln, const char *v,
+roff_evalnum(struct roff *r, int ln, const char *v,
int *pos, int *res, int skipwhite)
{
int mypos, operand2;
@@ -1551,7 +1549,7 @@ roff_evalnum(struct roff *r, int ln, const char *v,
break;
case '/':
if (0 == operand2) {
- mandoc_msg(MANDOCERR_DIVZERO,
+ mandoc_msg(MANDOCERR_DIVZERO,
r->parse, ln, *pos, v);
*res = 0;
break;
@@ -1928,15 +1926,13 @@ roff_eqndelim(struct roff *r, char **bufp, size_t *szp, int pos)
return(ROFF_REPARSE);
}
-static void
-roff_openeqn(struct roff *r, const char *name, int line,
- int offs, const char *buf)
+static enum rofferr
+roff_EQ(ROFF_ARGS)
{
struct eqn_node *e;
- int poff;
assert(NULL == r->eqn);
- e = eqn_alloc(name, offs, line, r->parse);
+ e = eqn_alloc(ppos, ln, r->parse);
if (r->last_eqn) {
r->last_eqn->next = e;
@@ -1948,17 +1944,10 @@ roff_openeqn(struct roff *r, const char *name, int line,
r->eqn = r->last_eqn = e;
- if (buf) {
- poff = 0;
- eqn_read(&r->eqn, line, buf, offs, &poff);
- }
-}
-
-static enum rofferr
-roff_EQ(ROFF_ARGS)
-{
+ if ((*bufp)[pos])
+ mandoc_vmsg(MANDOCERR_ARG_SKIP, r->parse, ln, pos,
+ ".EQ %s", *bufp + pos);
- roff_openeqn(r, *bufp + pos, ln, ppos, NULL);
return(ROFF_IGN);
}