Changeset ac897e8 in mainline
- Timestamp:
- 2011-03-22T20:43:01Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f2d665b4
- Parents:
- e7ffdd3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/cat/cat.c
re7ffdd3 rac897e8 57 57 static const char *hexchars = "0123456789abcdef"; 58 58 59 static size_t chars_per_screen = 0;59 static bool paging_enabled = false; 60 60 static size_t chars_remaining = 0; 61 static size_t lines_remaining = 0; 62 static sysarg_t console_cols = 0; 63 static sysarg_t console_rows = 0; 61 64 62 65 static struct option const long_options[] = { … … 97 100 static void waitprompt() 98 101 { 99 sysarg_t rows, cols; 100 if (console_get_size(fphone(stdout), &cols, &rows) == EOK) { 101 console_set_pos(fphone(stdout), 0, rows-1); 102 } 102 console_set_pos(fphone(stdout), 0, console_rows-1); 103 103 console_set_color(fphone(stdout), COLOR_BLUE, COLOR_WHITE, 0); 104 104 printf("Press any key to continue"); … … 125 125 { 126 126 console_clear(fphone(stdout)); 127 chars_remaining = chars_per_screen; 127 chars_remaining = console_cols; 128 lines_remaining = console_rows-1; 128 129 } 129 130 … … 131 132 { 132 133 putchar(c); 133 if ( chars_per_screen > 0) {134 if (paging_enabled) { 134 135 chars_remaining--; 135 if (chars_remaining == 0) { 136 if (c == '\n' || chars_remaining == 0) { 137 chars_remaining = console_cols; 138 lines_remaining--; 139 } 140 if (lines_remaining == 0) { 136 141 fflush(stdout); 137 142 waitprompt(); … … 259 264 return CMD_FAILURE; 260 265 } 261 chars_per_screen = cols * (rows-1); 266 console_cols = cols; 267 console_rows = rows; 268 paging_enabled = true; 262 269 newpage(); 263 270 }
Note:
See TracChangeset
for help on using the changeset viewer.