strtonum(3) in FreeBSD?

Brooks Davis brooks at one-eyed-alien.net
Tue Apr 12 12:12:09 PDT 2005


On Tue, Apr 12, 2005 at 02:06:02PM -0500, R. Tyler Ballance wrote:
> Quick, sort of, question. Is it worth it to bring strtonum(3) from
> OpenBSD into FreeBSD-CURRENT. I have the diffs if that's the case, I
> know that the newer packet filter code from OPENBSD_3_7 that mlaier@ and
> I are working on uses it in a few places (see: pflogd) but I'm not sure
> of the merits of bringing strtonum(3) into lib/libc/stdlib...
> 
> In theory, it should be a better implementation of what atoi(3) and
> strtol(3) do, but as tg@(mirbsd.org) pointed out to the OpenBSD fellows
> and myself, it doesn't take hexadecimal values well...
> 
> Somebody let me know, i've got diffs ready, sort of ;)
> (or let me know why it's a bad idea)

The lack of base handling argument does make it less appealing, but now
that OpenBSD has used this name, we're stuck with the API.  I would
request that you use intmax_t rather than "long long" for the integers.
Then the API scales cleanly when some future processor adds 128-bit ints.
Since intmax_t is "long long" on all current platforms that wouldn't
cause compatability problems with OpenBSD.

-- Brooks

-- 
Any statement of the form "X is the one, true Y" is FALSE.
PGP fingerprint 655D 519C 26A7 82E7 2529  9BF0 5D8E 8BE9 F238 1AD4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20050412/937f2f84/attachment.bin


More information about the freebsd-current mailing list