andre at digirati.com.br
Sat Jul 24 22:17:46 PDT 2004
The patches at  add the strtonum(3) function (an OpenBSD extension) to
DragonFly. It is meant to be an easy and safe to use replacement for
strtoul(3) and the like. From the manual page:
"Using strtonum() correctly is meant to be simpler than the alternative
const char *errstr;
iterations = strtonum(optarg, 1, 64, &errstr);
errx(1, "number of iterations is %s: %s", errstr, optarg);
The above example will guarantee that the value of iterations is between 1
The existing alternatives, such as atoi(3) and strtol(3) are either
impossible or difficult to use safely."
The code from OpenBSD was not modified apart from really minor style changes.
I'll submit patches for some userland programs to use this function later
if it is commited.
More information about the Submit