int qemu_config_parse(FILE *fp, QemuOptsList **lists, const char *fname)

{

    char line[1024], group[64], id[64], arg[64], value[1024];

    Location loc;

    QemuOptsList *list = NULL;

    Error *local_err = NULL;

    QemuOpts *opts = NULL;

    int res = -1, lno = 0;



    loc_push_none(&loc);

    while (fgets(line, sizeof(line), fp) != NULL) {

        loc_set_file(fname, ++lno);

        if (line[0] == '\n') {

            /* skip empty lines */

            continue;

        }

        if (line[0] == '#') {

            /* comment */

            continue;

        }

        if (sscanf(line, "[%63s \"%63[^\"]\"]", group, id) == 2) {

            /* group with id */

            list = find_list(lists, group, &local_err);

            if (local_err) {

                error_report_err(local_err);

                goto out;

            }

            opts = qemu_opts_create(list, id, 1, NULL);

            continue;

        }

        if (sscanf(line, "[%63[^]]]", group) == 1) {

            /* group without id */

            list = find_list(lists, group, &local_err);

            if (local_err) {

                error_report_err(local_err);

                goto out;

            }

            opts = qemu_opts_create(list, NULL, 0, &error_abort);

            continue;

        }

        value[0] = '\0';

        if (sscanf(line, " %63s = \"%1023[^\"]\"", arg, value) == 2 ||

            sscanf(line, " %63s = \"\"", arg) == 1) {

            /* arg = value */

            if (opts == NULL) {

                error_report("no group defined");

                goto out;

            }

            qemu_opt_set(opts, arg, value, &local_err);

            if (local_err) {

                error_report_err(local_err);

                goto out;

            }

            continue;

        }

        error_report("parse error");

        goto out;

    }

    if (ferror(fp)) {

        error_report("error reading file");

        goto out;

    }

    res = 0;

out:

    loc_pop(&loc);

    return res;

}

int qemu_config_parse(FILE *fp, QemuOptsList **lists, const char *fname)

{

    char line[1024], group[64], id[64], arg[64], value[1024];

    Location loc;

    QemuOptsList *list = NULL;

    Error *local_err = NULL;

    QemuOpts *opts = NULL;

    int res = -1, lno = 0;



    loc_push_none(&loc);

    while (fgets(line, sizeof(line), fp) != NULL) {

        loc_set_file(fname, ++lno);

        if (line[0] == '\n') {

            

            continue;

        }

        if (line[0] == '#') {

            

            continue;

        }

        if (sscanf(line, "[%63s \"%63[^\"]\"]", group, id) == 2) {

            

            list = find_list(lists, group, &local_err);

            if (local_err) {

                error_report_err(local_err);

                goto out;

            }

            opts = qemu_opts_create(list, id, 1, NULL);

            continue;

        }

        if (sscanf(line, "[%63[^]]]", group) == 1) {

            

            list = find_list(lists, group, &local_err);

            if (local_err) {

                error_report_err(local_err);

                goto out;

            }

            opts = qemu_opts_create(list, NULL, 0, &error_abort);

            continue;

        }

        value[0] = '\0';

        if (sscanf(line, " %63s = \"%1023[^\"]\"", arg, value) == 2 ||

            sscanf(line, " %63s = \"\"", arg) == 1) {

            

            if (opts == NULL) {

                error_report("no group defined");

                goto out;

            }

            qemu_opt_set(opts, arg, value, &local_err);

            if (local_err) {

                error_report_err(local_err);

                goto out;

            }

            continue;

        }

        error_report("parse error");

        goto out;

    }

    if (ferror(fp)) {

        error_report("error reading file");

        goto out;

    }

    res = 0;

out:

    loc_pop(&loc);

    return res;

}

int FUNC_0(FILE *VAR_0, QemuOptsList **VAR_1, const char *VAR_2)

{

    char VAR_3[1024], VAR_4[64], VAR_5[64], VAR_6[64], VAR_7[1024];

    Location loc;

    QemuOptsList *list = NULL;

    Error *local_err = NULL;

    QemuOpts *opts = NULL;

    int VAR_8 = -1, VAR_9 = 0;



    loc_push_none(&loc);

    while (fgets(VAR_3, sizeof(VAR_3), VAR_0) != NULL) {

        loc_set_file(VAR_2, ++VAR_9);

        if (VAR_3[0] == '\n') {

            

            continue;

        }

        if (VAR_3[0] == '#') {

            

            continue;

        }

        if (sscanf(VAR_3, "[%63s \"%63[^\"]\"]", VAR_4, VAR_5) == 2) {

            

            list = find_list(VAR_1, VAR_4, &local_err);

            if (local_err) {

                error_report_err(local_err);

                goto out;

            }

            opts = qemu_opts_create(list, VAR_5, 1, NULL);

            continue;

        }

        if (sscanf(VAR_3, "[%63[^]]]", VAR_4) == 1) {

            

            list = find_list(VAR_1, VAR_4, &local_err);

            if (local_err) {

                error_report_err(local_err);

                goto out;

            }

            opts = qemu_opts_create(list, NULL, 0, &error_abort);

            continue;

        }

        VAR_7[0] = '\0';

        if (sscanf(VAR_3, " %63s = \"%1023[^\"]\"", VAR_6, VAR_7) == 2 ||

            sscanf(VAR_3, " %63s = \"\"", VAR_6) == 1) {

            

            if (opts == NULL) {

                error_report("no VAR_4 defined");

                goto out;

            }

            qemu_opt_set(opts, VAR_6, VAR_7, &local_err);

            if (local_err) {

                error_report_err(local_err);

                goto out;

            }

            continue;

        }

        error_report("parse error");

        goto out;

    }

    if (ferror(VAR_0)) {

        error_report("error reading file");

        goto out;

    }

    VAR_8 = 0;

out:

    loc_pop(&loc);

    return VAR_8;

}

int FUNC_0(FILE *VAR_0, QemuOptsList **VAR_1, const char *VAR_2)
{ char VAR_3[1024], VAR_4[64], VAR_5[64], VAR_6[64], VAR_7[1024]; Location loc; QemuOptsList *list = NULL; Error *local_err = NULL; QemuOpts *opts = NULL; int VAR_8 = -1, VAR_9 = 0; loc_push_none(&loc); while (fgets(VAR_3, sizeof(VAR_3), VAR_0) != NULL) { loc_set_file(VAR_2, ++VAR_9); if (VAR_3[0] == '\n') { continue; } if (VAR_3[0] == '#') { continue; } if (sscanf(VAR_3, "[%63s \"%63[^\"]\"]", VAR_4, VAR_5) == 2) { list = find_list(VAR_1, VAR_4, &local_err); if (local_err) { error_report_err(local_err); goto out; } opts = qemu_opts_create(list, VAR_5, 1, NULL); continue; } if (sscanf(VAR_3, "[%63[^]]]", VAR_4) == 1) { list = find_list(VAR_1, VAR_4, &local_err); if (local_err) { error_report_err(local_err); goto out; } opts = qemu_opts_create(list, NULL, 0, &error_abort); continue; } VAR_7[0] = '\0'; if (sscanf(VAR_3, " %63s = \"%1023[^\"]\"", VAR_6, VAR_7) == 2 ||
sscanf(VAR_3, " %63s = \"\"", VAR_6) == 1) { if (opts == NULL) { error_report("no VAR_4 defined"); goto out; } qemu_opt_set(opts, VAR_6, VAR_7, &local_err); if (local_err) { error_report_err(local_err); goto out; } continue; } error_report("parse error"); goto out; } if (ferror(VAR_0)) { error_report("error reading file"); goto out; } VAR_8 = 0; out:
loc_pop(&loc); return VAR_8; }