For arguments declared as numbers always use expand_number(3).

This allows to use numbers in human-readable form in many geom(8)
utilities. Such a simple change and makes live so much nicer.
Some examples:

	gstripe label -s 16k
	gmirror label -s 4k
	gnop create -o 1g -s 128m -S 2k
	gjournal label -s 2g
	geli label -i 128k -s 4k

Approved by:	re (kensmith)
This commit is contained in:
Pawel Jakub Dawidek 2007-09-21 10:00:05 +00:00
parent 764907187e
commit e84091cb52
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=172273

View File

@ -224,9 +224,7 @@ set_option(struct gctl_req *req, struct g_option *opt, const char *val)
if (G_OPT_TYPE(opt) == G_TYPE_NUMBER) {
intmax_t number;
errno = 0;
number = strtoimax(val, NULL, 0);
if (errno != 0) {
if (expand_number(val, &number) == -1) {
err(EXIT_FAILURE, "Invalid value for '%c' argument.",
opt->go_char);
}