* mdocml: Clamp width and indent settings to sensible values.
@ 2015-02-16 14:12 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2015-02-16 14:12 UTC (permalink / raw)
To: source
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-02-16 14:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-16 14:12 mdocml: Clamp width and indent settings to sensible values schwarze
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).