eject: use parse_switch()
[kzak@redhat.com: - use extended parse_switch()] Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
30b294c491
commit
47d20536e0
|
@ -202,12 +202,8 @@ static void parse_args(struct eject_control *ctl, int argc, char **argv)
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'a':
|
case 'a':
|
||||||
ctl->a_option = 1;
|
ctl->a_option = 1;
|
||||||
if (!strcmp(optarg, "0") || !strcmp(optarg, "off"))
|
ctl->a_arg = parse_switch(optarg, _("argument error"),
|
||||||
ctl->a_arg = 0;
|
"on", "off", "1", "0", NULL);
|
||||||
else if (!strcmp(optarg, "1") || !strcmp(optarg, "on"))
|
|
||||||
ctl->a_arg = 1;
|
|
||||||
else
|
|
||||||
errx(EXIT_FAILURE, _("invalid argument to --auto/-a option"));
|
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
ctl->c_option = 1;
|
ctl->c_option = 1;
|
||||||
|
@ -231,12 +227,8 @@ static void parse_args(struct eject_control *ctl, int argc, char **argv)
|
||||||
break;
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
ctl->i_option = 1;
|
ctl->i_option = 1;
|
||||||
if (!strcmp(optarg, "0") || !strcmp(optarg, "off"))
|
ctl->i_arg = parse_switch(optarg, _("argument error"),
|
||||||
ctl->i_arg = 0;
|
"on", "off", "1", "0", NULL);
|
||||||
else if (!strcmp(optarg, "1") || !strcmp(optarg, "on"))
|
|
||||||
ctl->i_arg = 1;
|
|
||||||
else
|
|
||||||
errx(EXIT_FAILURE, _("invalid argument to --manualeject/-i option"));
|
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
ctl->m_option = 1;
|
ctl->m_option = 1;
|
||||||
|
|
Loading…
Reference in New Issue