Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Apr 2005 04:35:24 +1000
From:      Peter Jeremy <PeterJeremy@optushome.com.au>
To:        Thorsten Glaser <tg@66h.42h.de>
Cc:        freebsd-current@freebsd.org
Subject:   Re: strtonum(3) in FreeBSD?
Message-ID:  <20050413183523.GQ89047@cirb503493.alcatel.com.au>
In-Reply-To: <Pine.BSO.4.61L.0504122006560.4031@odem.66h.42h.de>
References:  <1113336183.27362.37.camel@localhost.localdomain> <Pine.BSO.4.61L.0504122006560.4031@odem.66h.42h.de>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050413183523.GQ89047>