From owner-freebsd-current@FreeBSD.ORG Wed Apr 13 18:35:32 2005 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 85FA716A4CE for ; Wed, 13 Apr 2005 18:35:32 +0000 (GMT) Received: from mail09.syd.optusnet.com.au (mail09.syd.optusnet.com.au [211.29.132.190]) by mx1.FreeBSD.org (Postfix) with ESMTP id DA42E43D2D for ; Wed, 13 Apr 2005 18:35:31 +0000 (GMT) (envelope-from PeterJeremy@optushome.com.au) Received: from cirb503493.alcatel.com.au (c211-30-75-229.belrs2.nsw.optusnet.com.au [211.30.75.229]) j3DIZPuf011449 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Thu, 14 Apr 2005 04:35:26 +1000 Received: from cirb503493.alcatel.com.au (localhost.alcatel.com.au [127.0.0.1])j3DIZP7l001784; Thu, 14 Apr 2005 04:35:25 +1000 (EST) (envelope-from pjeremy@cirb503493.alcatel.com.au) Received: (from pjeremy@localhost)j3DIZO5H001783; Thu, 14 Apr 2005 04:35:24 +1000 (EST) (envelope-from pjeremy) Date: Thu, 14 Apr 2005 04:35:24 +1000 From: Peter Jeremy To: Thorsten Glaser Message-ID: <20050413183523.GQ89047@cirb503493.alcatel.com.au> References: <1113336183.27362.37.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2i cc: freebsd-current@freebsd.org Subject: Re: strtonum(3) in FreeBSD? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Apr 2005 18:35:32 -0000 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