eject: add --force option
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
de12e1bba1
commit
8bb4a6cb88
|
@ -9,7 +9,7 @@ eject \- eject removable media
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
eject \-h
|
eject \-h
|
||||||
.br
|
.br
|
||||||
eject [\-vnrsfqp] [<name>]
|
eject [\-vnrsfFqp] [<name>]
|
||||||
.br
|
.br
|
||||||
eject [\-vn] \-d
|
eject [\-vn] \-d
|
||||||
.br
|
.br
|
||||||
|
@ -70,6 +70,10 @@ If invoked with this option,
|
||||||
.B eject
|
.B eject
|
||||||
lists the default device name.
|
lists the default device name.
|
||||||
|
|
||||||
|
.TP 0.5i
|
||||||
|
.B \-F
|
||||||
|
Force eject, don't check device type.
|
||||||
|
|
||||||
.TP 0.5i
|
.TP 0.5i
|
||||||
.B \-a on|1|off|0
|
.B \-a on|1|off|0
|
||||||
This option controls the auto-eject mode, supported by some devices.
|
This option controls the auto-eject mode, supported by some devices.
|
||||||
|
|
|
@ -77,6 +77,7 @@ static int a_option; /* command flags and arguments */
|
||||||
static int c_option;
|
static int c_option;
|
||||||
static int d_option;
|
static int d_option;
|
||||||
static int f_option;
|
static int f_option;
|
||||||
|
static int F_option;
|
||||||
static int n_option;
|
static int n_option;
|
||||||
static int q_option;
|
static int q_option;
|
||||||
static int r_option;
|
static int r_option;
|
||||||
|
@ -137,6 +138,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
|
||||||
" -d, --default display default device\n"
|
" -d, --default display default device\n"
|
||||||
" -a, --auto turn auto-eject feature on or off\n"
|
" -a, --auto turn auto-eject feature on or off\n"
|
||||||
" -c, --changerslot switch discs on a CD-ROM changer\n"
|
" -c, --changerslot switch discs on a CD-ROM changer\n"
|
||||||
|
" -F, --force don't care about device type\n"
|
||||||
" -i, --manualeject <on|off> toggle manual eject protection on/off\n"
|
" -i, --manualeject <on|off> toggle manual eject protection on/off\n"
|
||||||
" -t, --trayclose close tray\n"
|
" -t, --trayclose close tray\n"
|
||||||
" -T, --traytoggle toggle tray\n"
|
" -T, --traytoggle toggle tray\n"
|
||||||
|
@ -168,6 +170,7 @@ static void parse_args(int argc, char **argv, char **device)
|
||||||
{"verbose", no_argument, NULL, 'v'},
|
{"verbose", no_argument, NULL, 'v'},
|
||||||
{"default", no_argument, NULL, 'd'},
|
{"default", no_argument, NULL, 'd'},
|
||||||
{"auto", required_argument, NULL, 'a'},
|
{"auto", required_argument, NULL, 'a'},
|
||||||
|
{"force", no_argument, NULL, 'F'},
|
||||||
{"changerslot", required_argument, NULL, 'c'},
|
{"changerslot", required_argument, NULL, 'c'},
|
||||||
{"manualeject", required_argument, NULL, 'i'},
|
{"manualeject", required_argument, NULL, 'i'},
|
||||||
{"trayclose", no_argument, NULL, 't'},
|
{"trayclose", no_argument, NULL, 't'},
|
||||||
|
@ -187,7 +190,7 @@ static void parse_args(int argc, char **argv, char **device)
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
while ((c = getopt_long(argc, argv,
|
while ((c = getopt_long(argc, argv,
|
||||||
"a:c:i:x:dfhnqrstTXvVpm", long_opts, NULL)) != -1) {
|
"a:c:i:x:dfFhnqrstTXvVpm", long_opts, NULL)) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'a':
|
case 'a':
|
||||||
a_option = 1;
|
a_option = 1;
|
||||||
|
@ -212,6 +215,9 @@ static void parse_args(int argc, char **argv, char **device)
|
||||||
case 'f':
|
case 'f':
|
||||||
f_option = 1;
|
f_option = 1;
|
||||||
break;
|
break;
|
||||||
|
case 'F':
|
||||||
|
F_option = 1;
|
||||||
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
usage(stdout);
|
usage(stdout);
|
||||||
break;
|
break;
|
||||||
|
@ -947,7 +953,7 @@ int main(int argc, char **argv)
|
||||||
} else
|
} else
|
||||||
verbose(_("%s: is whole-disk device"), device);
|
verbose(_("%s: is whole-disk device"), device);
|
||||||
|
|
||||||
if (!is_hotpluggable(device))
|
if (F_option == 0 && is_hotpluggable(device) == 0)
|
||||||
errx(EXIT_FAILURE, _("%s: is not hot-pluggable device"), device);
|
errx(EXIT_FAILURE, _("%s: is not hot-pluggable device"), device);
|
||||||
|
|
||||||
/* handle -n option */
|
/* handle -n option */
|
||||||
|
|
Loading…
Reference in New Issue