Revision 7cc07ab8
b/include/qemu/option.h | ||
---|---|---|
79 | 79 |
void free_option_parameters(QEMUOptionParameter *list); |
80 | 80 |
void print_option_parameters(QEMUOptionParameter *list); |
81 | 81 |
void print_option_help(QEMUOptionParameter *list); |
82 |
bool has_help_option(const char *param); |
|
83 |
bool is_valid_option_list(const char *param); |
|
82 | 84 |
|
83 | 85 |
/* ------------------------------------------------------------------ */ |
84 | 86 |
|
b/util/qemu-option.c | ||
---|---|---|
450 | 450 |
return NULL; |
451 | 451 |
} |
452 | 452 |
|
453 |
bool has_help_option(const char *param) |
|
454 |
{ |
|
455 |
size_t buflen = strlen(param) + 1; |
|
456 |
char *buf = g_malloc0(buflen); |
|
457 |
const char *p = param; |
|
458 |
bool result = false; |
|
459 |
|
|
460 |
while (*p) { |
|
461 |
p = get_opt_value(buf, buflen, p); |
|
462 |
if (*p) { |
|
463 |
p++; |
|
464 |
} |
|
465 |
|
|
466 |
if (is_help_option(buf)) { |
|
467 |
result = true; |
|
468 |
goto out; |
|
469 |
} |
|
470 |
} |
|
471 |
|
|
472 |
out: |
|
473 |
free(buf); |
|
474 |
return result; |
|
475 |
} |
|
476 |
|
|
477 |
bool is_valid_option_list(const char *param) |
|
478 |
{ |
|
479 |
size_t buflen = strlen(param) + 1; |
|
480 |
char *buf = g_malloc0(buflen); |
|
481 |
const char *p = param; |
|
482 |
bool result = true; |
|
483 |
|
|
484 |
while (*p) { |
|
485 |
p = get_opt_value(buf, buflen, p); |
|
486 |
if (*p && !*++p) { |
|
487 |
result = false; |
|
488 |
goto out; |
|
489 |
} |
|
490 |
|
|
491 |
if (!*buf || *buf == ',') { |
|
492 |
result = false; |
|
493 |
goto out; |
|
494 |
} |
|
495 |
} |
|
496 |
|
|
497 |
out: |
|
498 |
free(buf); |
|
499 |
return result; |
|
500 |
} |
|
501 |
|
|
453 | 502 |
/* |
454 | 503 |
* Prints all options of a list that have a value to stdout |
455 | 504 |
*/ |
Also available in: Unified diff