diff options
Diffstat (limited to 'roff_escape.c')
-rw-r--r-- | roff_escape.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/roff_escape.c b/roff_escape.c index 98138f95..12aa252b 100644 --- a/roff_escape.c +++ b/roff_escape.c @@ -272,6 +272,7 @@ roff_escape(const char *buf, const int ln, const int aesc, if (term == '\b') { if (strchr("BDHLRSvxNhl", buf[inam]) != NULL && strchr(" %&()*+-./0123456789:<=>", buf[iarg]) != NULL) { + err = MANDOCERR_ESC_DELIM; if (rval != ESCAPE_EXPAND) rval = ESCAPE_ERROR; if (buf[inam] != 'D') { @@ -291,6 +292,7 @@ roff_escape(const char *buf, const int ln, const int aesc, case '[': if (buf[++iarg] == ' ') { iendarg = iend = iarg + 1; + err = MANDOCERR_ESC_ARG; rval = ESCAPE_ERROR; goto out; } @@ -368,13 +370,23 @@ roff_escape(const char *buf, const int ln, const int aesc, case '2': case '3': case '4': - rval = argl == 1 ? ESCAPE_IGNORE : ESCAPE_ERROR; + if (argl == 1) + rval = ESCAPE_IGNORE; + else { + err = MANDOCERR_ESC_ARG; + rval = ESCAPE_ERROR; + } break; case '5': - rval = buf[iarg - 1] == '[' ? ESCAPE_UNSUPP : - ESCAPE_ERROR; + if (buf[iarg - 1] == '[') + rval = ESCAPE_UNSUPP; + else { + err = MANDOCERR_ESC_ARG; + rval = ESCAPE_ERROR; + } break; default: + err = MANDOCERR_ESC_ARG; rval = ESCAPE_ERROR; break; } @@ -386,6 +398,8 @@ roff_escape(const char *buf, const int ln, const int aesc, switch (rval) { case ESCAPE_FONT: rval = mandoc_font(buf + iarg, argl); + if (rval == ESCAPE_ERROR) + err = MANDOCERR_ESC_ARG; break; case ESCAPE_SPECIAL: @@ -487,10 +501,6 @@ out: *resc = iesc; switch (rval) { - case ESCAPE_ERROR: - if (err == MANDOCERR_OK) - err = MANDOCERR_ESC_BAD; - break; case ESCAPE_UNSUPP: err = MANDOCERR_ESC_UNSUPP; break; |