aboutsummaryrefslogtreecommitdiffstatshomepage
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
commit75b610f7273e99110015abd22311fcb909e0abd3 (patch)
tree1171b69288b6d8040fd7f78f35d9b239237219b3 /roff.c
parentb862a185d00afc5c08a5353e6bc4633818b058cc (diff)
downloadmandoc-75b610f7273e99110015abd22311fcb909e0abd3.tar.gz
mandoc-75b610f7273e99110015abd22311fcb909e0abd3.tar.zst
mandoc-75b610f7273e99110015abd22311fcb909e0abd3.zip
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.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/roff.c b/roff.c
index 7bd7b484..86dc402a 100644
--- a/roff.c
+++ b/roff.c
@@ -1,4 +1,4 @@
-/* $Id: roff.c,v 1.234 2014/10/20 19:04:45 kristaps Exp $ */
+/* $Id: roff.c,v 1.235 2014/10/25 14:35:37 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -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);
}