add option to quietly query qemu-fwcfg

This commit is contained in:
K. Lange 2018-07-18 16:20:01 +09:00
parent 5eddf74c68
commit 50ce403c0e

View File

@ -71,14 +71,18 @@ int main(int argc, char * argv[]) {
int opt = 0;
int list = 0;
int no_newline = 0;
int query_quietly = 0;
while ((opt = getopt(argc, argv, "?ln")) != -1) {
while ((opt = getopt(argc, argv, "?lnq")) != -1) {
switch (opt) {
case '?':
return usage(argv);
case 'n':
no_newline = 1;
break;
case 'q':
query_quietly = 1;
break;
case 'l':
list = 1;
break;
@ -129,6 +133,10 @@ int main(int argc, char * argv[]) {
}
}
if (query_quietly) {
return !found;
}
if (found) {
/* if we found the requested file, read it from the port */
outports(FW_CFG_PORT_OUT, file.select);