aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--util-linux/more.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/util-linux/more.c b/util-linux/more.c
index c424a0e4b..7160b8b00 100644
--- a/util-linux/more.c
+++ b/util-linux/more.c
@@ -113,9 +113,12 @@ int more_main(int argc UNUSED_PARAM, char **argv)
113 loop_top: 113 loop_top:
114 if (input != 'r' && please_display_more_prompt) { 114 if (input != 'r' && please_display_more_prompt) {
115 len = printf("--More-- "); 115 len = printf("--More-- ");
116 if (st.st_size > 0) { 116 if (st.st_size != 0) {
117 uoff_t d = (uoff_t)st.st_size / 100;
118 if (d == 0)
119 d = 1;
117 len += printf("(%u%% of %"OFF_FMT"u bytes)", 120 len += printf("(%u%% of %"OFF_FMT"u bytes)",
118 (int) (ftello(file)*100 / st.st_size), 121 (int) ((uoff_t)ftello(file) / d),
119 st.st_size); 122 st.st_size);
120 } 123 }
121 fflush_all(); 124 fflush_all();
@@ -159,7 +162,7 @@ int more_main(int argc UNUSED_PARAM, char **argv)
159 /* Crudely convert tabs into spaces, which are 162 /* Crudely convert tabs into spaces, which are
160 * a bajillion times easier to deal with. */ 163 * a bajillion times easier to deal with. */
161 if (c == '\t') { 164 if (c == '\t') {
162 spaces = CONVERTED_TAB_SIZE - 1; 165 spaces = ((unsigned)~len) % CONVERTED_TAB_SIZE;
163 c = ' '; 166 c = ' ';
164 } 167 }
165 168