int qemu_opt_set(QemuOpts *opts, const char *name, const char *value)

{

    QemuOpt *opt;



    opt = qemu_opt_find(opts, name);

    if (!opt) {

        QemuOptDesc *desc = opts->list->desc;

        int i;



        for (i = 0; desc[i].name != NULL; i++) {

            if (strcmp(desc[i].name, name) == 0) {

                break;

            }

        }

        if (desc[i].name == NULL) {

            if (i == 0) {

                /* empty list -> allow any */;

            } else {

                fprintf(stderr, "option \"%s\" is not valid for %s\n",

                        name, opts->list->name);

                return -1;

            }

        }

        opt = qemu_mallocz(sizeof(*opt));

        opt->name = qemu_strdup(name);

        opt->opts = opts;

        TAILQ_INSERT_TAIL(&opts->head, opt, next);

        if (desc[i].name != NULL) {

            opt->desc = desc+i;

        }

    }

    qemu_free((/* !const */ char*)opt->str);

    opt->str = NULL;

    if (value) {

        opt->str = qemu_strdup(value);

    }

    if (qemu_opt_parse(opt) < 0) {

        fprintf(stderr, "Failed to parse \"%s\" for \"%s.%s\"\n", opt->str,

                opts->list->name, opt->name);

        qemu_opt_del(opt);

        return -1;

    }

    return 0;

}

int qemu_opt_set(QemuOpts *opts, const char *name, const char *value)

{

    QemuOpt *opt;



    opt = qemu_opt_find(opts, name);

    if (!opt) {

        QemuOptDesc *desc = opts->list->desc;

        int i;



        for (i = 0; desc[i].name != NULL; i++) {

            if (strcmp(desc[i].name, name) == 0) {

                break;

            }

        }

        if (desc[i].name == NULL) {

            if (i == 0) {

                ;

            } else {

                fprintf(stderr, "option \"%s\" is not valid for %s\n",

                        name, opts->list->name);

                return -1;

            }

        }

        opt = qemu_mallocz(sizeof(*opt));

        opt->name = qemu_strdup(name);

        opt->opts = opts;

        TAILQ_INSERT_TAIL(&opts->head, opt, next);

        if (desc[i].name != NULL) {

            opt->desc = desc+i;

        }

    }

    qemu_free(( char*)opt->str);

    opt->str = NULL;

    if (value) {

        opt->str = qemu_strdup(value);

    }

    if (qemu_opt_parse(opt) < 0) {

        fprintf(stderr, "Failed to parse \"%s\" for \"%s.%s\"\n", opt->str,

                opts->list->name, opt->name);

        qemu_opt_del(opt);

        return -1;

    }

    return 0;

}

int FUNC_0(QemuOpts *VAR_0, const char *VAR_1, const char *VAR_2)

{

    QemuOpt *opt;



    opt = qemu_opt_find(VAR_0, VAR_1);

    if (!opt) {

        QemuOptDesc *desc = VAR_0->list->desc;

        int VAR_3;



        for (VAR_3 = 0; desc[VAR_3].VAR_1 != NULL; VAR_3++) {

            if (strcmp(desc[VAR_3].VAR_1, VAR_1) == 0) {

                break;

            }

        }

        if (desc[VAR_3].VAR_1 == NULL) {

            if (VAR_3 == 0) {

                ;

            } else {

                fprintf(stderr, "option \"%s\" is not valid for %s\n",

                        VAR_1, VAR_0->list->VAR_1);

                return -1;

            }

        }

        opt = qemu_mallocz(sizeof(*opt));

        opt->VAR_1 = qemu_strdup(VAR_1);

        opt->VAR_0 = VAR_0;

        TAILQ_INSERT_TAIL(&VAR_0->head, opt, next);

        if (desc[VAR_3].VAR_1 != NULL) {

            opt->desc = desc+VAR_3;

        }

    }

    qemu_free(( char*)opt->str);

    opt->str = NULL;

    if (VAR_2) {

        opt->str = qemu_strdup(VAR_2);

    }

    if (qemu_opt_parse(opt) < 0) {

        fprintf(stderr, "Failed to parse \"%s\" for \"%s.%s\"\n", opt->str,

                VAR_0->list->VAR_1, opt->VAR_1);

        qemu_opt_del(opt);

        return -1;

    }

    return 0;

}

int FUNC_0(QemuOpts *VAR_0, const char *VAR_1, const char *VAR_2)
{ QemuOpt *opt; opt = qemu_opt_find(VAR_0, VAR_1); if (!opt) { QemuOptDesc *desc = VAR_0->list->desc; int VAR_3; for (VAR_3 = 0; desc[VAR_3].VAR_1 != NULL; VAR_3++) { if (strcmp(desc[VAR_3].VAR_1, VAR_1) == 0) { break; } } if (desc[VAR_3].VAR_1 == NULL) { if (VAR_3 == 0) { ; } else { fprintf(stderr, "option \"%s\" is not valid for %s\n",
VAR_1, VAR_0->list->VAR_1); return -1; } } opt = qemu_mallocz(sizeof(*opt)); opt->VAR_1 = qemu_strdup(VAR_1); opt->VAR_0 = VAR_0; TAILQ_INSERT_TAIL(&VAR_0->head, opt, next); if (desc[VAR_3].VAR_1 != NULL) { opt->desc = desc+VAR_3; } } qemu_free(( char*)opt->str); opt->str = NULL; if (VAR_2) { opt->str = qemu_strdup(VAR_2); } if (qemu_opt_parse(opt) < 0) { fprintf(stderr, "Failed to parse \"%s\" for \"%s.%s\"\n", opt->str,
VAR_0->list->VAR_1, opt->VAR_1); qemu_opt_del(opt); return -1; } return 0; }