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:
parent
764907187e
commit
e84091cb52
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user