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>
snprintf(ts, size, "0.%04u sec", (unsigned int) (usec * 10000));
}
}
-
-
-/* from libxcmd/quit.c */
-
-static cmdinfo_t quit_cmd;
-
-/* ARGSUSED */
-static int
-quit_f(
- BlockDriverState *bs,
- int argc,
- char **argv)
-{
- return 1;
-}
-
-void
-quit_init(void)
-{
- quit_cmd.name = _("quit");
- quit_cmd.altname = _("q");
- quit_cmd.cfunc = quit_f;
- quit_cmd.argmin = -1;
- quit_cmd.argmax = -1;
- quit_cmd.flags = CMD_FLAG_GLOBAL;
- quit_cmd.oneline = _("exit the program");
-
- add_command(&quit_cmd);
-}
extern cmdinfo_t *cmdtab;
extern int ncmds;
-void quit_init(void);
-
typedef int (*checkfunc_t)(BlockDriverState *bs, const cmdinfo_t *ci);
void add_command(const cmdinfo_t *ci);
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(
bdrv_init();
/* initialize commands */
- quit_init();
+ add_command(&quit_cmd);
add_command(&open_cmd);
add_command(&close_cmd);