Date: Fri, 15 Apr 2005 13:08:14 -0600 From: Tobias Weingartner <weingart@tepid.org> To: Peter Jeremy <PeterJeremy@optushome.com.au> Cc: freebsd-current@freebsd.org Subject: Re: strtonum(3) in FreeBSD? Message-ID: <163.1113592094@natasha.tepid.org> In-Reply-To: Message from Peter Jeremy <PeterJeremy@optushome.com.au> <20050414210840.GT89047@cirb503493.alcatel.com.au>
next in thread | previous in thread | raw e-mail | index | archive | help
On Friday, April 15, Peter Jeremy wrote: > > This means you can't use it in a simple parser to handle the user > entering "10k" to mean 10000 or "128m" to mean 128000000. dd(1) needs > this and I've used it on occasion. Again, it's being sold as a > replacement for strtol() but isn't. 10k is 10 * 1024, not 10000. And yes, dd(1) interprets it that way. My pet peave... K, M, G, T are the 2^whatever versions when we're talking about computer quantities. Why do we have to introduce Ki- whatever? If you need the power that strtol() can provide, then yes, you need strtol() and/or it's cousins. Most of the time you do not need that sort of power (or their extensions). The strtonum() function will do what you want just fine. So, pick your poison. Make your choice. Live with them. --Toby.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?163.1113592094>