static void readline_update(ReadLineState *rs)

{

    int i, delta, len;



    if (rs->cmd_buf_size != rs->last_cmd_buf_size ||

        memcmp(rs->cmd_buf, rs->last_cmd_buf, rs->cmd_buf_size) != 0) {

        for(i = 0; i < rs->last_cmd_buf_index; i++) {

            monitor_printf(rs->mon, "\033[D");

        }

        rs->cmd_buf[rs->cmd_buf_size] = '\0';

        if (rs->read_password) {

            len = strlen(rs->cmd_buf);

            for(i = 0; i < len; i++)

                monitor_printf(rs->mon, "*");

        } else {

            monitor_printf(rs->mon, "%s", rs->cmd_buf);

        }

        monitor_printf(rs->mon, "\033[K");

        memcpy(rs->last_cmd_buf, rs->cmd_buf, rs->cmd_buf_size);

        rs->last_cmd_buf_size = rs->cmd_buf_size;

        rs->last_cmd_buf_index = rs->cmd_buf_size;

    }

    if (rs->cmd_buf_index != rs->last_cmd_buf_index) {

        delta = rs->cmd_buf_index - rs->last_cmd_buf_index;

        if (delta > 0) {

            for(i = 0;i < delta; i++) {

                monitor_printf(rs->mon, "\033[C");

            }

        } else {

            delta = -delta;

            for(i = 0;i < delta; i++) {

                monitor_printf(rs->mon, "\033[D");

            }

        }

        rs->last_cmd_buf_index = rs->cmd_buf_index;

    }

    monitor_flush(rs->mon);

}

static void readline_update(ReadLineState *rs)

{

    int i, delta, len;



    if (rs->cmd_buf_size != rs->last_cmd_buf_size ||

        memcmp(rs->cmd_buf, rs->last_cmd_buf, rs->cmd_buf_size) != 0) {

        for(i = 0; i < rs->last_cmd_buf_index; i++) {

            monitor_printf(rs->mon, "\033[D");

        }

        rs->cmd_buf[rs->cmd_buf_size] = '\0';

        if (rs->read_password) {

            len = strlen(rs->cmd_buf);

            for(i = 0; i < len; i++)

                monitor_printf(rs->mon, "*");

        } else {

            monitor_printf(rs->mon, "%s", rs->cmd_buf);

        }

        monitor_printf(rs->mon, "\033[K");

        memcpy(rs->last_cmd_buf, rs->cmd_buf, rs->cmd_buf_size);

        rs->last_cmd_buf_size = rs->cmd_buf_size;

        rs->last_cmd_buf_index = rs->cmd_buf_size;

    }

    if (rs->cmd_buf_index != rs->last_cmd_buf_index) {

        delta = rs->cmd_buf_index - rs->last_cmd_buf_index;

        if (delta > 0) {

            for(i = 0;i < delta; i++) {

                monitor_printf(rs->mon, "\033[C");

            }

        } else {

            delta = -delta;

            for(i = 0;i < delta; i++) {

                monitor_printf(rs->mon, "\033[D");

            }

        }

        rs->last_cmd_buf_index = rs->cmd_buf_index;

    }

    monitor_flush(rs->mon);

}

static void FUNC_0(ReadLineState *VAR_0)

{

    int VAR_1, VAR_2, VAR_3;



    if (VAR_0->cmd_buf_size != VAR_0->last_cmd_buf_size ||

        memcmp(VAR_0->cmd_buf, VAR_0->last_cmd_buf, VAR_0->cmd_buf_size) != 0) {

        for(VAR_1 = 0; VAR_1 < VAR_0->last_cmd_buf_index; VAR_1++) {

            monitor_printf(VAR_0->mon, "\033[D");

        }

        VAR_0->cmd_buf[VAR_0->cmd_buf_size] = '\0';

        if (VAR_0->read_password) {

            VAR_3 = strlen(VAR_0->cmd_buf);

            for(VAR_1 = 0; VAR_1 < VAR_3; VAR_1++)

                monitor_printf(VAR_0->mon, "*");

        } else {

            monitor_printf(VAR_0->mon, "%s", VAR_0->cmd_buf);

        }

        monitor_printf(VAR_0->mon, "\033[K");

        memcpy(VAR_0->last_cmd_buf, VAR_0->cmd_buf, VAR_0->cmd_buf_size);

        VAR_0->last_cmd_buf_size = VAR_0->cmd_buf_size;

        VAR_0->last_cmd_buf_index = VAR_0->cmd_buf_size;

    }

    if (VAR_0->cmd_buf_index != VAR_0->last_cmd_buf_index) {

        VAR_2 = VAR_0->cmd_buf_index - VAR_0->last_cmd_buf_index;

        if (VAR_2 > 0) {

            for(VAR_1 = 0;VAR_1 < VAR_2; VAR_1++) {

                monitor_printf(VAR_0->mon, "\033[C");

            }

        } else {

            VAR_2 = -VAR_2;

            for(VAR_1 = 0;VAR_1 < VAR_2; VAR_1++) {

                monitor_printf(VAR_0->mon, "\033[D");

            }

        }

        VAR_0->last_cmd_buf_index = VAR_0->cmd_buf_index;

    }

    monitor_flush(VAR_0->mon);

}

static void FUNC_0(ReadLineState *VAR_0)
{ int VAR_1, VAR_2, VAR_3; if (VAR_0->cmd_buf_size != VAR_0->last_cmd_buf_size ||
memcmp(VAR_0->cmd_buf, VAR_0->last_cmd_buf, VAR_0->cmd_buf_size) != 0) { for(VAR_1 = 0; VAR_1 < VAR_0->last_cmd_buf_index; VAR_1++) { monitor_printf(VAR_0->mon, "\033[D"); } VAR_0->cmd_buf[VAR_0->cmd_buf_size] = '\0'; if (VAR_0->read_password) { VAR_3 = strlen(VAR_0->cmd_buf); for(VAR_1 = 0; VAR_1 < VAR_3; VAR_1++) monitor_printf(VAR_0->mon, "*"); } else { monitor_printf(VAR_0->mon, "%s", VAR_0->cmd_buf); } monitor_printf(VAR_0->mon, "\033[K"); memcpy(VAR_0->last_cmd_buf, VAR_0->cmd_buf, VAR_0->cmd_buf_size); VAR_0->last_cmd_buf_size = VAR_0->cmd_buf_size; VAR_0->last_cmd_buf_index = VAR_0->cmd_buf_size; } if (VAR_0->cmd_buf_index != VAR_0->last_cmd_buf_index) { VAR_2 = VAR_0->cmd_buf_index - VAR_0->last_cmd_buf_index; if (VAR_2 > 0) { for(VAR_1 = 0;VAR_1 < VAR_2; VAR_1++) { monitor_printf(VAR_0->mon, "\033[C"); } } else { VAR_2 = -VAR_2; for(VAR_1 = 0;VAR_1 < VAR_2; VAR_1++) { monitor_printf(VAR_0->mon, "\033[D"); } } VAR_0->last_cmd_buf_index = VAR_0->cmd_buf_index; } monitor_flush(VAR_0->mon); }