Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/cmds/modules/cat/cat.c

    ra33706e r07b7c48  
    117117static void waitkey()
    118118{
    119         kbd_event_t ev;
     119        cons_event_t ev;
     120        kbd_event_t *kev;
    120121       
    121122        while (true) {
    122                 if (!console_get_kbd_event(console, &ev)) {
     123                if (!console_get_event(console, &ev)) {
    123124                        return;
    124125                }
    125                 if (ev.type == KEY_PRESS) {
    126                         if (ev.key == KC_ESCAPE || ev.key == KC_Q) {
     126                if (ev.type == CEV_KEY && ev.ev.key.type == KEY_PRESS) {
     127                        kev = &ev.ev.key;
     128                       
     129                        if (kev->key == KC_ESCAPE || kev->key == KC_Q) {
    127130                                should_quit = true;
    128131                                return;
    129132                        }
    130                         if (ev.key == KC_C) {
     133                        if (kev->key == KC_C) {
    131134                                paging_enabled = false;
    132135                                return;
    133136                        }
    134                         if (ev.key == KC_ENTER || ev.key == KC_SPACE ||
    135                             ev.key == KC_PAGE_DOWN) {
     137                        if (kev->key == KC_ENTER || kev->key == KC_SPACE ||
     138                            kev->key == KC_PAGE_DOWN) {
    136139                                return;
    137140                        }
     
    176179
    177180        bool reading_stdin = dash_represents_stdin && (str_cmp(fname, "-") == 0);
    178 
     181       
    179182        if (reading_stdin) {
    180183                fd = fileno(stdin);
    181184                /* Allow storing the whole UTF-8 character. */
    182185                blen = STR_BOUNDS(1);
    183         } else {
     186        } else
    184187                fd = open(fname, O_RDONLY);
    185         }
     188       
    186189        if (fd < 0) {
    187190                printf("Unable to open %s\n", fname);
     
    222225                        bytes_to_read = 1;
    223226                } else {
    224                         if ((length != CAT_FULL_FILE)
    225                             && (length - (off64_t)count <= (off64_t)(blen - copied_bytes))) {
     227                        if ((length != CAT_FULL_FILE) &&
     228                            (length - (off64_t)count <= (off64_t)(blen - copied_bytes))) {
    226229                                bytes_to_read = (size_t) (length - count);
    227230                        } else {
     
    229232                        }
    230233                }
     234               
    231235                bytes = read(fd, buff + copied_bytes, bytes_to_read);
    232236                bytes += copied_bytes;
     
    261265                        reads++;
    262266                }
    263 
    264                 if (reading_stdin) {
     267               
     268                if (reading_stdin)
    265269                        fflush(stdout);
    266                 }
    267270        } while (bytes > 0 && !should_quit && (count < length || length == CAT_FULL_FILE));
    268271
Note: See TracChangeset for help on using the changeset viewer.