static int serial_parse(const char *devname)

{

    static int index = 0;

    char label[32];



    if (strcmp(devname, "none") == 0)

        return 0;

    if (index == MAX_SERIAL_PORTS) {

        fprintf(stderr, "qemu: too many serial ports\n");

        exit(1);

    }

    snprintf(label, sizeof(label), "serial%d", index);

    serial_hds[index] = qemu_chr_new(label, devname, NULL);

    if (!serial_hds[index]) {

        fprintf(stderr, "qemu: could not connect serial device"

                " to character backend '%s'\n", devname);

        return -1;

    }

    index++;

    return 0;

}

static int serial_parse(const char *devname)

{

    static int index = 0;

    char label[32];



    if (strcmp(devname, "none") == 0)

        return 0;

    if (index == MAX_SERIAL_PORTS) {

        fprintf(stderr, "qemu: too many serial ports\n");

        exit(1);

    }

    snprintf(label, sizeof(label), "serial%d", index);

    serial_hds[index] = qemu_chr_new(label, devname, NULL);

    if (!serial_hds[index]) {

        fprintf(stderr, "qemu: could not connect serial device"

                " to character backend '%s'\n", devname);

        return -1;

    }

    index++;

    return 0;

}

static int FUNC_0(const char *VAR_0)

{

    static int VAR_1 = 0;

    char VAR_2[32];



    if (strcmp(VAR_0, "none") == 0)

        return 0;

    if (VAR_1 == MAX_SERIAL_PORTS) {

        fprintf(stderr, "qemu: too many serial ports\n");

        exit(1);

    }

    snprintf(VAR_2, sizeof(VAR_2), "serial%d", VAR_1);

    serial_hds[VAR_1] = qemu_chr_new(VAR_2, VAR_0, NULL);

    if (!serial_hds[VAR_1]) {

        fprintf(stderr, "qemu: could not connect serial device"

                " to character backend '%s'\n", VAR_0);

        return -1;

    }

    VAR_1++;

    return 0;

}

static int FUNC_0(const char *VAR_0)
{ static int VAR_1 = 0; char VAR_2[32]; if (strcmp(VAR_0, "none") == 0)
return 0; if (VAR_1 == MAX_SERIAL_PORTS) { fprintf(stderr, "qemu: too many serial ports\n"); exit(1); } snprintf(VAR_2, sizeof(VAR_2), "serial%d", VAR_1); serial_hds[VAR_1] = qemu_chr_new(VAR_2, VAR_0, NULL); if (!serial_hds[VAR_1]) { fprintf(stderr, "qemu: could not connect serial device"
" to character backend '%s'\n", VAR_0); return -1; } VAR_1++; return 0; }