Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/libbb/progress.c
- Timestamp:
- Dec 20, 2016, 4:07:32 PM (7 years ago)
- Location:
- branches/3.3
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mindi-busybox/libbb/progress.c
r3232 r3621 45 45 STALLTIME = 5 46 46 }; 47 48 static unsigned int get_tty2_width(void)49 {50 unsigned width;51 get_terminal_width_height(2, &width, NULL);52 return width;53 }54 47 55 48 void FAST_FUNC bb_progress_init(bb_progress_t *p, const char *curfile) … … 81 74 uoff_t beg_and_transferred; 82 75 unsigned since_last_update, elapsed; 83 int barlength;76 int notty; 84 77 int kiloscale; 85 78 … … 138 131 } 139 132 133 notty = !isatty(STDERR_FILENO); 134 140 135 if (ENABLE_UNICODE_SUPPORT) 141 fprintf(stderr, "\r%s" , p->curfile);136 fprintf(stderr, "\r%s" + notty, p->curfile); 142 137 else 143 fprintf(stderr, "\r%-20.20s" , p->curfile);138 fprintf(stderr, "\r%-20.20s" + notty, p->curfile); 144 139 145 140 beg_and_transferred = beg_size + transferred; 146 141 147 142 if (totalsize != 0) { 143 int barlength; 148 144 unsigned ratio = 100 * beg_and_transferred / totalsize; 149 145 fprintf(stderr, "%4u%%", ratio); 150 146 151 barlength = get_t ty2_width() - 49;147 barlength = get_terminal_width(2) - 49; 152 148 if (barlength > 0) { 153 149 /* god bless gcc for variable arrays :) */ … … 205 201 fprintf(stderr, "%3u:%02u:%02u ETA", hours, secs / 60, secs % 60); 206 202 } 203 if (notty) 204 fputc('\n', stderr); 207 205 }
Note:
See TracChangeset
for help on using the changeset viewer.