loop_top:
if (input != 'r' && please_display_more_prompt) {
len = printf("--More-- ");
- if (st.st_size > 0) {
+ if (st.st_size != 0) {
+ uoff_t d = (uoff_t)st.st_size / 100;
+ if (d == 0)
+ d = 1;
len += printf("(%u%% of %"OFF_FMT"u bytes)",
- (int) (ftello(file)*100 / st.st_size),
+ (int) ((uoff_t)ftello(file) / d),
st.st_size);
}
fflush_all();
/* Crudely convert tabs into spaces, which are
* a bajillion times easier to deal with. */
if (c == '\t') {
- spaces = CONVERTED_TAB_SIZE - 1;
+ spaces = ((unsigned)~len) % CONVERTED_TAB_SIZE;
c = ' ';
}