(p)->curfile = NULL; \
} while (0)
void bb_progress_init(bb_progress_t *p, const char *curfile) FAST_FUNC;
-void bb_progress_update(bb_progress_t *p,
+int bb_progress_update(bb_progress_t *p,
uoff_t beg_range,
uoff_t transferred,
uoff_t totalsize) FAST_FUNC;
* will be "totalsize" bytes.
* If totalsize == 0, then it is unknown.
*/
-void FAST_FUNC bb_progress_update(bb_progress_t *p,
+int FAST_FUNC bb_progress_update(bb_progress_t *p,
uoff_t beg_size,
uoff_t transferred,
uoff_t totalsize)
* Do not update on every call
* (we can be called on every network read!)
*/
- return;
+ return -1;
}
/* Before we lose real, unscaled sizes, produce human-readable size string */
}
if (notty)
fputc('\n', stderr);
+ return notty;
}
#if ENABLE_FEATURE_WGET_STATUSBAR
static void progress_meter(int flag)
{
+ int notty;
+
if (option_mask32 & WGET_OPT_QUIET)
return;
if (flag == PROGRESS_START)
bb_progress_init(&G.pmt, G.curfile);
- bb_progress_update(&G.pmt,
+ notty = bb_progress_update(&G.pmt,
G.beg_range,
G.transferred,
(G.chunked || !G.got_clen) ? 0 : G.beg_range + G.transferred + G.content_len
if (flag == PROGRESS_END) {
bb_progress_free(&G.pmt);
- bb_putchar_stderr('\n');
+ if (notty == 0)
+ bb_putchar_stderr('\n'); /* it's tty */
G.transferred = 0;
}
}