commit 1a090bf1eb6836e28cc036202464965c3f936e15
parent 2b767016b3be028083f1a642ccf4651aea52dc53
Author: sin <sin@2f30.org>
Date: Wed, 4 Sep 2013 13:33:59 +0100
Fix eject(1) so we can specify a device name
Diffstat:
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/eject.c b/eject.c
@@ -15,14 +15,14 @@ enum {
static void
usage(void)
{
- eprintf("usage: %s [-t]\n", argv0);
+ eprintf("usage: %s [-t] [devname]\n", argv0);
}
int
main(int argc, char *argv[])
{
int fd, out;
- const char *cdrom = "/dev/sr0";
+ char *cdrom = "/dev/sr0";
int tflag = 0;
ARGBEGIN {
@@ -33,6 +33,11 @@ main(int argc, char *argv[])
usage();
} ARGEND;
+ if (argc > 1)
+ usage();
+ else if (argc == 1)
+ cdrom = argv[0];
+
fd = open(cdrom, O_RDONLY | O_NONBLOCK);
if (fd < 0)
eprintf("open %s:", cdrom);