Changeset 5db9084 in mainline for uspace/lib/clui/tinput.c
- Timestamp:
- 2010-04-04T22:01:32Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 73060801
- Parents:
- 59ecd4a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/clui/tinput.c
r59ecd4a r5db9084 513 513 } 514 514 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 */ 522 int tinput_read(tinput_t *ti, char **dstr) 517 523 { 518 524 console_event_t ev; … … 522 528 523 529 if (console_get_size(fphone(stdin), &ti->con_cols, &ti->con_rows) != EOK) 524 return NULL;530 return EIO; 525 531 if (console_get_pos(fphone(stdin), &ti->col0, &ti->row0) != EOK) 526 return NULL;532 return EIO; 527 533 528 534 ti->pos = ti->sel_start = 0; … … 530 536 ti->buffer[0] = '\0'; 531 537 ti->done = false; 538 ti->exit_clui = false; 532 539 533 540 while (!ti->done) { 534 541 fflush(stdout); 535 542 if (!console_get_event(fphone(stdin), &ev)) 536 return NULL;543 return EIO; 537 544 538 545 if (ev.type != KEY_PRESS) … … 565 572 } 566 573 574 if (ti->exit_clui) 575 return ENOENT; 576 567 577 ti->pos = ti->nc; 568 578 tinput_position_caret(ti); … … 575 585 ti->hpos = 0; 576 586 577 return str; 587 *dstr = str; 588 return EOK; 578 589 } 579 590 … … 606 617 case KC_A: 607 618 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; 608 624 break; 609 625 default:
Note:
See TracChangeset
for help on using the changeset viewer.