diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2015-02-16 14:11:41 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2015-02-16 14:11:41 +0000 |
commit | 72d5f8b30454867ff67650d9d828d741044534d7 (patch) | |
tree | c93637b345f51ab9fa73afc46ef9d89b4fa9ea88 /term_ascii.c | |
parent | 07e910c7f0a91b83d7bc7889766bbb9ca685b001 (diff) | |
download | mandoc-72d5f8b30454867ff67650d9d828d741044534d7.tar.gz |
Clamp width and indent settings to sensible values.
Ignore errors for now.
Patch from tedu@.
Diffstat (limited to 'term_ascii.c')
-rw-r--r-- | term_ascii.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/term_ascii.c b/term_ascii.c index ee630493..77a3d591 100644 --- a/term_ascii.c +++ b/term_ascii.c @@ -63,6 +63,8 @@ ascii_init(enum termenc enc, const struct mchars *mchars, char *outopts) const char *toks[5]; char *v; struct termp *p; + const char *errstr; + int num; p = mandoc_calloc(1, sizeof(struct termp)); @@ -109,10 +111,14 @@ ascii_init(enum termenc enc, const struct mchars *mchars, char *outopts) while (outopts && *outopts) switch (getsubopt(&outopts, UNCONST(toks), &v)) { case 0: - p->defindent = (size_t)atoi(v); + num = strtonum(v, 0, 1000, &errstr); + if (!errstr) + p->defindent = num; break; case 1: - p->defrmargin = (size_t)atoi(v); + num = strtonum(v, 0, 1000, &errstr); + if (!errstr) + p->defrmargin = num; break; case 2: /* |