Re: strtonum(3) in FreeBSD?

From: Peter Jeremy <PeterJeremy_at_optushome.com.au>
Date: Thu, 14 Apr 2005 04:35:24 +1000
On Tue, 2005-Apr-12 20:08:19 +0000, Thorsten Glaser wrote:
>>2) No provision to return the end of the converted string
>>3) No simple way to distinguish errors from a valid zero.
>
>The OpenBSD people said (when I proposed to change #1) that
>they want an uncomplicated interface, and I think #3 is not
>necessary, and I can live without #2.

#3 is the only real justification for creating strtonum(3) - if you
don't care about determining whether the conversion failed then you
might as well use atoi().  I think the intent is that strtonum()
should provide an easy to use mechanism for distinguishing between
valid and invalid inputs (this is implied by the digs at atoi() and
strtol() in the man page).  The actual implementation does provide
an easy way to identify invalid inputs but it isn't documented.

And as others have mentioned, the return type is wrong and the OpenBSD
project isn't interested in correcting it.

-- 
Peter Jeremy
Received on Wed Apr 13 2005 - 16:35:32 UTC

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