int qemu_read_password(char *buf, int buf_size)

{

    uint8_t ch;

    int i, ret;



    printf("password: ");

    fflush(stdout);

    term_init();

    i = 0;

    for (;;) {

        ret = read(0, &ch, 1);

        if (ret == -1) {

            if (errno == EAGAIN || errno == EINTR) {

                continue;

            } else {

                break;

            }

        } else if (ret == 0) {

            ret = -1;

            break;

        } else {

            if (ch == '\r' ||

                ch == '\n') {

                ret = 0;

                break;

            }

            if (i < (buf_size - 1)) {

                buf[i++] = ch;

            }

        }

    }

    term_exit();

    buf[i] = '\0';

    printf("\n");

    return ret;

}

int qemu_read_password(char *buf, int buf_size)

{

    uint8_t ch;

    int i, ret;



    printf("password: ");

    fflush(stdout);

    term_init();

    i = 0;

    for (;;) {

        ret = read(0, &ch, 1);

        if (ret == -1) {

            if (errno == EAGAIN || errno == EINTR) {

                continue;

            } else {

                break;

            }

        } else if (ret == 0) {

            ret = -1;

            break;

        } else {

            if (ch == '\r' ||

                ch == '\n') {

                ret = 0;

                break;

            }

            if (i < (buf_size - 1)) {

                buf[i++] = ch;

            }

        }

    }

    term_exit();

    buf[i] = '\0';

    printf("\n");

    return ret;

}

int qemu_read_password(char *buf, int buf_size)     uint8_t ch;     int i, ret;     printf("password: ");     fflush(stdout);     term_init();     i = 0;     for (;;) {         ret = read(0, &ch, 1);         if (ret == -1) {             if (errno == EAGAIN || errno == EINTR) {                 continue;             } else {                 break;         } else if (ret == 0) {             ret = -1;             break;         } else {             if (ch == '\r' ||                 ch == '\n') {                 ret = 0;                 break;             if (i < (buf_size - 1)) {                 buf[i++] = ch;     term_exit();     buf[i] = '\0';     printf("\n");     return ret; int qemu_read_password(char *buf, int buf_size)     fflush(stdout);     i = 0;     for (;;) {             break;     buf[i] = '\0';
int FUNC_0(char *VAR_0, int VAR_1)

{

    uint8_t ch;

    int VAR_2, VAR_3;



    printf("password: ");

    fflush(stdout);

    term_init();

    VAR_2 = 0;

    for (;;) {

        VAR_3 = read(0, &ch, 1);

        if (VAR_3 == -1) {

            if (errno == EAGAIN || errno == EINTR) {

                continue;

            } else {

                break;

            }

        } else if (VAR_3 == 0) {

            VAR_3 = -1;

            break;

        } else {

            if (ch == '\r' ||

                ch == '\n') {

                VAR_3 = 0;

                break;

            }

            if (VAR_2 < (VAR_1 - 1)) {

                VAR_0[VAR_2++] = ch;

            }

        }

    }

    term_exit();

    VAR_0[VAR_2] = '\0';

    printf("\n");

    return VAR_3;

}

int FUNC_0(char *VAR_0, int VAR_1)
{ uint8_t ch; int VAR_2, VAR_3; printf("password: "); fflush(stdout); term_init(); VAR_2 = 0; for (;;) { VAR_3 = read(0, &ch, 1); if (VAR_3 == -1) { if (errno == EAGAIN || errno == EINTR) { continue; } else { break; } } else if (VAR_3 == 0) { VAR_3 = -1; break; } else { if (ch == '\r' ||
ch == '\n') { VAR_3 = 0; break; } if (VAR_2 < (VAR_1 - 1)) { VAR_0[VAR_2++] = ch; } } } term_exit(); VAR_0[VAR_2] = '\0'; printf("\n"); return VAR_3; }