fmt, ##__VA_ARGS__); \
})
-const char *error_get_progname(void);
-
extern bool message_with_timestamp;
extern bool error_with_guestname;
extern const char *error_guest_name;
static char prompt[FILENAME_MAX + 2 /*"> "*/ + 1 /*"\0"*/ ];
if (!prompt[0]) {
- snprintf(prompt, sizeof(prompt), "%s> ", error_get_progname());
+ snprintf(prompt, sizeof(prompt), "%s> ", g_get_prgname());
}
return prompt;
break;
case 'V':
printf("%s version " QEMU_FULL_VERSION "\n"
- QEMU_COPYRIGHT "\n", error_get_progname());
+ QEMU_COPYRIGHT "\n", g_get_prgname());
exit(0);
case 'h':
- usage(error_get_progname());
+ usage(g_get_prgname());
exit(0);
case 'U':
force_share = true;
imageOpts = true;
break;
default:
- usage(error_get_progname());
+ usage(g_get_prgname());
exit(1);
}
}
if ((argc - optind) > 1) {
- usage(error_get_progname());
+ usage(g_get_prgname());
exit(1);
}
version();
printf("usage: %s [options] [disk_image]\n\n"
"'disk_image' is a raw hard disk image for IDE hard disk 0\n\n",
- error_get_progname());
+ g_get_prgname());
#define DEF(option, opt_arg, opt_enum, opt_help, arch_mask) \
if ((arch_mask) & arch_type) \
" --pidfile <path> write process ID to a file after startup\n"
"\n"
QEMU_HELP_BOTTOM "\n",
- error_get_progname());
+ g_get_prgname());
}
enum {
fprintf(f, "This list of names of trace points may be incomplete "
"when using the DTrace/SystemTap backends.\n"
"Run 'qemu-trace-stap list %s' to print the full list.\n",
- error_get_progname());
+ g_get_prgname());
#endif
}
}
}
-static const char *progname;
-
-/*
- * Set the program name for error_print_loc().
- */
-static void error_set_progname(const char *argv0)
-{
- const char *p = strrchr(argv0, '/');
- progname = p ? p + 1 : argv0;
-}
-
-const char *error_get_progname(void)
-{
- return progname;
-}
-
/*
* Print current location to current monitor if we have one, else to stderr.
*/
int i;
const char *const *argp;
- if (!monitor_cur() && progname) {
- fprintf(stderr, "%s:", progname);
+ if (!monitor_cur() && g_get_prgname()) {
+ fprintf(stderr, "%s:", g_get_prgname());
sep = " ";
}
switch (cur_loc->kind) {
void error_init(const char *argv0)
{
+ const char *p = strrchr(argv0, '/');
+
/* Set the program name for error_print_loc(). */
- error_set_progname(argv0);
+ g_set_prgname(p ? p + 1 : argv0);
/*
* This sets up glib logging so libraries using it also print their logs