aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qemu-options.hx5
-rw-r--r--vl.c30
2 files changed, 35 insertions, 0 deletions
diff --git a/qemu-options.hx b/qemu-options.hx
index 7922191..b65fd74 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1915,3 +1915,8 @@ DEF("semihosting", 0, QEMU_OPTION_semihosting,
DEF("old-param", 0, QEMU_OPTION_old_param,
"-old-param old param mode\n")
#endif
+DEF("readconfig", HAS_ARG, QEMU_OPTION_readconfig,
+ "-readconfig <file>\n")
+DEF("writeconfig", HAS_ARG, QEMU_OPTION_writeconfig,
+ "-writeconfig <file>\n"
+ " read/write config file")
diff --git a/vl.c b/vl.c
index 402e78d..bf91ee1 100644
--- a/vl.c
+++ b/vl.c
@@ -5364,6 +5364,36 @@ int main(int argc, char **argv, char **envp)
xen_mode = XEN_ATTACH;
break;
#endif
+ case QEMU_OPTION_readconfig:
+ {
+ FILE *fp;
+ fp = fopen(optarg, "r");
+ if (fp == NULL) {
+ fprintf(stderr, "open %s: %s\n", optarg, strerror(errno));
+ exit(1);
+ }
+ if (qemu_config_parse(fp) != 0) {
+ exit(1);
+ }
+ fclose(fp);
+ break;
+ }
+ case QEMU_OPTION_writeconfig:
+ {
+ FILE *fp;
+ if (strcmp(optarg, "-") == 0) {
+ fp = stdout;
+ } else {
+ fp = fopen(optarg, "w");
+ if (fp == NULL) {
+ fprintf(stderr, "open %s: %s\n", optarg, strerror(errno));
+ exit(1);
+ }
+ }
+ qemu_config_write(fp);
+ fclose(fp);
+ break;
+ }
}
}
}