Commit graph

4 commits

Author SHA1 Message Date
Konstantin Belousov 2db44b8410 Add #include <inttypes.h> for the strtoimax().
Submitted by:	Jilles Tjoelker <jilles stack nl>
MFC after:	3 days
2008-07-07 12:20:34 +00:00
John Birrell 26fc37307b Constify the first argument to expand_number() so that it can
be called with a const without the compiler grisling.
2007-11-18 02:20:02 +00:00
Pawel Jakub Dawidek c0a6ac3ff0 - Fix strange for loop.
Reported by:	phk

- While here, check the unit before calculating the actually number.
  This way we can return EINVAL for invalid unit instead of ERANGE.

Approved by:	re (kensmith)
2007-09-05 14:27:13 +00:00
Pawel Jakub Dawidek bd35b57de2 Implement expand_number(3), which is the opposite of humanize_number(3), ie.
a number in human-readable form is converted to int64_t, for example:
123b -> 123
10k -> 10240
16G -> 17179869184

First version submitted by:	Eric Anderson <anderson@freebsd.org>
Approved by:	re (bmah)
2007-09-01 06:19:11 +00:00