summaryrefslogtreecommitdiff
path: root/qemu-io.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2013-06-05 14:19:34 +0200
committerStefan Hajnoczi <stefanha@redhat.com>2013-06-06 11:27:04 +0200
commite681be7eca0143fe7259ce8233fe5dd8898d072f (patch)
tree375ba8f29a3b544a5ed5fb5d7b78c1f32e8b2963 /qemu-io.c
parentf18a834a92f0b490cefeb71410f3f25b969d336f (diff)
downloadqemu-e681be7eca0143fe7259ce8233fe5dd8898d072f.zip
qemu-io: Move 'quit' function
This one only makes sense in the context of the qemu-io tool, so move it to qemu-io.c. Adapt coding style and register it like other commands. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'qemu-io.c')
-rw-r--r--qemu-io.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/qemu-io.c b/qemu-io.c
index 14eef2cc65..8f6c57e1b2 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -137,6 +137,21 @@ static int open_f(BlockDriverState *bs, int argc, char **argv)
return openfile(argv[optind], flags, growable);
}
+static int quit_f(BlockDriverState *bs, int argc, char **argv)
+{
+ return 1;
+}
+
+static const cmdinfo_t quit_cmd = {
+ .name = "quit",
+ .altname = "q",
+ .cfunc = quit_f,
+ .argmin = -1,
+ .argmax = -1,
+ .flags = CMD_FLAG_GLOBAL,
+ .oneline = "exit the program",
+};
+
static void usage(const char *name)
{
printf(
@@ -247,7 +262,7 @@ int main(int argc, char **argv)
bdrv_init();
/* initialize commands */
- quit_init();
+ add_command(&quit_cmd);
add_command(&open_cmd);
add_command(&close_cmd);