Changes in uspace/app/bdsh/cmds/modules/cat/cat.c [a33706e:07b7c48] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/cat/cat.c
ra33706e r07b7c48 117 117 static void waitkey() 118 118 { 119 kbd_event_t ev; 119 cons_event_t ev; 120 kbd_event_t *kev; 120 121 121 122 while (true) { 122 if (!console_get_ kbd_event(console, &ev)) {123 if (!console_get_event(console, &ev)) { 123 124 return; 124 125 } 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) { 127 130 should_quit = true; 128 131 return; 129 132 } 130 if ( ev.key == KC_C) {133 if (kev->key == KC_C) { 131 134 paging_enabled = false; 132 135 return; 133 136 } 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) { 136 139 return; 137 140 } … … 176 179 177 180 bool reading_stdin = dash_represents_stdin && (str_cmp(fname, "-") == 0); 178 181 179 182 if (reading_stdin) { 180 183 fd = fileno(stdin); 181 184 /* Allow storing the whole UTF-8 character. */ 182 185 blen = STR_BOUNDS(1); 183 } else {186 } else 184 187 fd = open(fname, O_RDONLY); 185 }188 186 189 if (fd < 0) { 187 190 printf("Unable to open %s\n", fname); … … 222 225 bytes_to_read = 1; 223 226 } 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))) { 226 229 bytes_to_read = (size_t) (length - count); 227 230 } else { … … 229 232 } 230 233 } 234 231 235 bytes = read(fd, buff + copied_bytes, bytes_to_read); 232 236 bytes += copied_bytes; … … 261 265 reads++; 262 266 } 263 264 if (reading_stdin) {267 268 if (reading_stdin) 265 269 fflush(stdout); 266 }267 270 } while (bytes > 0 && !should_quit && (count < length || length == CAT_FULL_FILE)); 268 271
Note:
See TracChangeset
for help on using the changeset viewer.