static void progress_meter(int flag) { /* We can be called from signal handler */ int save_errno = errno; if (flag == -1) { /* first call to progress_meter */ bb_progress_init(&G.pmt); } #ifdef MY_ABC_HERE bb_progress_update(&G.pmt, G.curfile, G.beg_range, G.transferred, G.chunked ? 0 : G.content_len + G.beg_range + G.transferred); #else bb_progress_update(&G.pmt, G.curfile, G.beg_range, G.transferred, G.chunked ? 0 : G.content_len + G.beg_range); #endif if (flag == 0) { /* last call to progress_meter */ alarm(0); fputc('\n', stderr); G.transferred = 0; } else { if (flag == -1) { /* first call to progress_meter */ signal_SA_RESTART_empty_mask(SIGALRM, progress_meter); } alarm(1); } errno = save_errno; }
static void progress_meter(int flag) { if (option_mask32 & WGET_OPT_QUIET) return; if (flag == PROGRESS_START) bb_progress_init(&G.pmt); bb_progress_update(&G.pmt, G.curfile, G.beg_range, G.transferred, G.chunked ? 0 : G.beg_range + G.transferred + G.content_len); if (flag == PROGRESS_END) { bb_putchar_stderr('\n'); G.transferred = 0; } }
/* SIGALRM logic nicked from the wget applet */ static void progress_meter(int flag) { /* We can be called from signal handler */ int save_errno = errno; if (flag == -1) { /* first call to progress_meter */ bb_progress_init(&G.pmt); } bb_progress_update(&G.pmt, G.file, 0, G.pos, G.size); if (flag == 0) { /* last call to progress_meter */ alarm(0); bb_putchar_stderr('\n'); } else { if (flag == -1) { /* first call to progress_meter */ signal_SA_RESTART_empty_mask(SIGALRM, progress_meter); } alarm(1); } errno = save_errno; }
static void tftp_progress_init(void) { bb_progress_init(&G.pmt, G.file); tftp_progress_update(); }