From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from localhost (fantadrom.bsd.lv [local]); by fantadrom.bsd.lv (OpenSMTPD) with ESMTPA id d1d6fc9b; for ; Mon, 16 Feb 2015 09:12:11 -0500 (EST) Date: Mon, 16 Feb 2015 09:12:11 -0500 (EST) Message-Id: <16328960230438596857.enqueue@fantadrom.bsd.lv> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: schwarze@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: Clamp width and indent settings to sensible values. X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- Clamp width and indent settings to sensible values. Ignore errors for now. Patch from tedu@. Modified Files: -------------- mdocml: term_ascii.c Revision Data ------------- Index: term_ascii.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/term_ascii.c,v retrieving revision 1.42 retrieving revision 1.43 diff -Lterm_ascii.c -Lterm_ascii.c -u -p -r1.42 -r1.43 --- term_ascii.c +++ term_ascii.c @@ -63,6 +63,8 @@ ascii_init(enum termenc enc, const struc 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 struc 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: /* -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv