Re: strtonum(3) in FreeBSD?

From: David Schultz <das_at_FreeBSD.ORG>
Date: Tue, 12 Apr 2005 23:08:15 -0400
On Wed, Apr 13, 2005, Peter Jeremy wrote:
> On Tue, 2005-Apr-12 14:06:02 -0500, R. Tyler Ballance wrote:
> >Quick, sort of, question. Is it worth it to bring strtonum(3) from
> >OpenBSD into FreeBSD-CURRENT.
> 
> Based on the manpage, I'd suggest not.
> 
> >In theory, it should be a better implementation of what atoi(3) and
> >strtol(3) do, but as tg_at_(mirbsd.org) pointed out to the OpenBSD fellows
> >and myself, it doesn't take hexadecimal values well...
> 
> Based on the man page, I see the following deficiencies:
> 1) No support for bases other than 10
> 2) No provision to return the end of the converted string
> 3) No simple way to distinguish errors from a valid zero.

It actually has a sensible way of distinguishing errors (it always
sets errno, even if to 0), but this is unintuitive to anyone who
is used to the broken POSIX way of doing it.  It's a nice attempt,
but consistency is important, too.  So unless we really need it, I
would vote against it as well.
Received on Wed Apr 13 2005 - 01:08:27 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:32 UTC