From owner-freebsd-current@FreeBSD.ORG Wed Apr 13 03:08:27 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 AF54816A4CE for ; Wed, 13 Apr 2005 03:08:27 +0000 (GMT) Received: from VARK.MIT.EDU (VARK.MIT.EDU [18.95.3.179]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4FEE043D1D for ; Wed, 13 Apr 2005 03:08:27 +0000 (GMT) (envelope-from das@FreeBSD.ORG) Received: from VARK.MIT.EDU (localhost [127.0.0.1]) by VARK.MIT.EDU (8.13.3/8.13.1) with ESMTP id j3D38FHO021429; Tue, 12 Apr 2005 23:08:15 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by VARK.MIT.EDU (8.13.3/8.13.1/Submit) id j3D38FAN021428; Tue, 12 Apr 2005 23:08:15 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Date: Tue, 12 Apr 2005 23:08:15 -0400 From: David Schultz To: Peter Jeremy Message-ID: <20050413030814.GA21318@VARK.MIT.EDU> Mail-Followup-To: Peter Jeremy , "R. Tyler Ballance" , FreeBSD Current References: <1113332762.27362.29.camel@localhost.localdomain> <20050412195700.GN89047@cirb503493.alcatel.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050412195700.GN89047@cirb503493.alcatel.com.au> cc: "R. Tyler Ballance" cc: FreeBSD Current 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 03:08:27 -0000 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@(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.