Changeset 3aae4e8 in mainline for uspace/lib/clui/tinput.c


Ignore:
Timestamp:
2010-04-04T22:07:05Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
23de644
Parents:
9f10660f (diff), 73060801 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/clui/tinput.c

    r9f10660f r3aae4e8  
    513513}
    514514
    515 /** Read in one line of input. */
    516 char *tinput_read(tinput_t *ti)
     515/** Read in one line of input.
     516 *
     517 * @param ti    Text input.
     518 * @param dstr  Place to save pointer to new string.
     519 * @return      EOK on success, ENOENT if user requested abort, EIO
     520 *              if communication with console failed.
     521 */
     522int tinput_read(tinput_t *ti, char **dstr)
    517523{
    518524        console_event_t ev;
     
    522528
    523529        if (console_get_size(fphone(stdin), &ti->con_cols, &ti->con_rows) != EOK)
    524                 return NULL;
     530                return EIO;
    525531        if (console_get_pos(fphone(stdin), &ti->col0, &ti->row0) != EOK)
    526                 return NULL;
     532                return EIO;
    527533
    528534        ti->pos = ti->sel_start = 0;
     
    530536        ti->buffer[0] = '\0';
    531537        ti->done = false;
     538        ti->exit_clui = false;
    532539
    533540        while (!ti->done) {
    534541                fflush(stdout);
    535542                if (!console_get_event(fphone(stdin), &ev))
    536                         return NULL;
     543                        return EIO;
    537544
    538545                if (ev.type != KEY_PRESS)
     
    565572        }
    566573
     574        if (ti->exit_clui)
     575                return ENOENT;
     576
    567577        ti->pos = ti->nc;
    568578        tinput_position_caret(ti);
     
    575585        ti->hpos = 0;
    576586
    577         return str;
     587        *dstr = str;
     588        return EOK;
    578589}
    579590
     
    606617        case KC_A:
    607618                tinput_sel_all(ti);
     619                break;
     620        case KC_Q:
     621                /* Signal libary client to quit interactive loop. */
     622                ti->done = true;
     623                ti->exit_clui = true;
    608624                break;
    609625        default:
Note: See TracChangeset for help on using the changeset viewer.