From fd0fee34b5ae7699dc558c12ddc3663bdb580060 Mon Sep 17 00:00:00 2001 From: Max Reitz Date: Fri, 20 Dec 2013 19:28:20 +0100 Subject: qemu-io: Make filename optional Giving a filename is actually not essential, since it can be specified through the options as well - on the contrary: Sometimes a filename must not be given. Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- qemu-io.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'qemu-io.c') diff --git a/qemu-io.c b/qemu-io.c index bfb773e70f..d6690289b8 100644 --- a/qemu-io.c +++ b/qemu-io.c @@ -163,11 +163,13 @@ static int open_f(BlockDriverState *bs, int argc, char **argv) flags |= BDRV_O_RDWR; } - if (optind != argc - 1) { + if (optind == argc - 1) { + return openfile(argv[optind], flags, growable, opts); + } else if (optind == argc) { + return openfile(NULL, flags, growable, opts); + } else { return qemuio_command_usage(&open_cmd); } - - return openfile(argv[optind], flags, growable, opts); } static int quit_f(BlockDriverState *bs, int argc, char **argv) -- cgit v1.2.1