Changeset 3232 in MondoRescue for branches/3.2/mindi-busybox/util-linux/more.c
- Timestamp:
- Jan 1, 2014, 12:47:38 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/mindi-busybox/util-linux/more.c
r2725 r3232 14 14 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 15 15 */ 16 17 //usage:#define more_trivial_usage 18 //usage: "[FILE]..." 19 //usage:#define more_full_usage "\n\n" 20 //usage: "View FILE (or stdin) one screenful at a time" 21 //usage: 22 //usage:#define more_example_usage 23 //usage: "$ dmesg | more\n" 16 24 17 25 #include "libbb.h" … … 78 86 getTermSettings(cin_fileno, &initial_settings); 79 87 new_settings = initial_settings; 80 new_settings.c_lflag &= ~ICANON; 81 new_settings.c_lflag &= ~ECHO; 88 new_settings.c_lflag &= ~(ICANON | ECHO); 82 89 new_settings.c_cc[VMIN] = 1; 83 90 new_settings.c_cc[VTIME] = 0; … … 114 121 if (input != 'r' && please_display_more_prompt) { 115 122 len = printf("--More-- "); 116 if (st.st_size > 0) { 123 if (st.st_size != 0) { 124 uoff_t d = (uoff_t)st.st_size / 100; 125 if (d == 0) 126 d = 1; 117 127 len += printf("(%u%% of %"OFF_FMT"u bytes)", 118 (int) ( ftello(file)*100 / st.st_size),128 (int) ((uoff_t)ftello(file) / d), 119 129 st.st_size); 120 130 } … … 160 170 * a bajillion times easier to deal with. */ 161 171 if (c == '\t') { 162 spaces = CONVERTED_TAB_SIZE - 1;172 spaces = ((unsigned)~len) % CONVERTED_TAB_SIZE; 163 173 c = ' '; 164 174 } … … 192 202 /* My small mind cannot fathom backspaces and UTF-8 */ 193 203 putchar(c); 204 die_if_ferror_stdout(); /* if tty was destroyed (closed xterm, etc) */ 194 205 } 195 206 fclose(file);
Note:
See TracChangeset
for help on using the changeset viewer.