Use 'val' function argument instead of 'optarg' global variable.

This doesn't fix any real bug, because in those tw ocases we always
passed 'optarg' as 'val'.

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

View File

@ -225,7 +225,7 @@ set_option(struct gctl_req *req, struct g_option *opt, const char *val)
intmax_t number;
errno = 0;
number = strtoimax(optarg, NULL, 0);
number = strtoimax(val, NULL, 0);
if (errno != 0) {
err(EXIT_FAILURE, "Invalid value for '%c' argument.",
opt->go_char);
@ -237,7 +237,7 @@ set_option(struct gctl_req *req, struct g_option *opt, const char *val)
gctl_ro_param(req, opt->go_name, sizeof(intmax_t), opt->go_val);
} else if (G_OPT_TYPE(opt) == G_TYPE_STRING) {
gctl_ro_param(req, opt->go_name, -1, optarg);
gctl_ro_param(req, opt->go_name, -1, val);
} else if (G_OPT_TYPE(opt) == G_TYPE_BOOL) {
opt->go_val = malloc(sizeof(int));
if (opt->go_val == NULL)