strtonum(3) in FreeBSD?

Ballance, Robert T tyler at neo.tamu.edu
Tue Apr 12 20:20:15 PDT 2005


> > 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.

I agree with both of the latter two problems...I am wondering if it'd be
possible to talk to Theo about changing strtonum(3) in OpenBSD as well...we
(the MirOS Project) asked Theo about the intmax_t idea, and he simply replied
"No" (in classic Theo fashion, sans flames) 

Having no way to distinguish a valid zero is slightly retarded; in general, I
think it's a decent idea, but needs some polishing up. I'm not pushing real
hard for it though, since some other utilities exist (atoi(), strtol(), etc),
but it would be something handy to have around...

-R. Tyler Ballance



More information about the freebsd-current mailing list