mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-23 11:39:53 +00:00
qemu-io: Use error_[gs]et_progname()
qemu-io reimplements itself what error_get_progname()/error_set_progname() already does. This commit switches it to use this API from qemu-error.h Signed-off-by: Christophe Fergeau <cfergeau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20190131164614.19209-2-cfergeau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
eeba63fc7f
commit
99e98d7c9f
14
qemu-io.c
14
qemu-io.c
@ -34,8 +34,6 @@
|
||||
|
||||
#define CMD_NOFILE_OK 0x01
|
||||
|
||||
static char *progname;
|
||||
|
||||
static BlockBackend *qemuio_blk;
|
||||
static bool quit_qemu_io;
|
||||
|
||||
@ -312,7 +310,7 @@ static char *get_prompt(void)
|
||||
static char prompt[FILENAME_MAX + 2 /*"> "*/ + 1 /*"\0"*/ ];
|
||||
|
||||
if (!prompt[0]) {
|
||||
snprintf(prompt, sizeof(prompt), "%s> ", progname);
|
||||
snprintf(prompt, sizeof(prompt), "%s> ", error_get_progname());
|
||||
}
|
||||
|
||||
return prompt;
|
||||
@ -525,7 +523,7 @@ int main(int argc, char **argv)
|
||||
#endif
|
||||
|
||||
module_call_init(MODULE_INIT_TRACE);
|
||||
progname = g_path_get_basename(argv[0]);
|
||||
error_set_progname(argv[0]);
|
||||
qemu_init_exec_dir(argv[0]);
|
||||
|
||||
qcrypto_init(&error_fatal);
|
||||
@ -580,10 +578,10 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
case 'V':
|
||||
printf("%s version " QEMU_FULL_VERSION "\n"
|
||||
QEMU_COPYRIGHT "\n", progname);
|
||||
QEMU_COPYRIGHT "\n", error_get_progname());
|
||||
exit(0);
|
||||
case 'h':
|
||||
usage(progname);
|
||||
usage(error_get_progname());
|
||||
exit(0);
|
||||
case 'U':
|
||||
force_share = true;
|
||||
@ -600,13 +598,13 @@ int main(int argc, char **argv)
|
||||
imageOpts = true;
|
||||
break;
|
||||
default:
|
||||
usage(progname);
|
||||
usage(error_get_progname());
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if ((argc - optind) > 1) {
|
||||
usage(progname);
|
||||
usage(error_get_progname());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user