version 1.46, 2019/01/23 08:01:46 |
version 1.47, 2019/01/24 16:52:17 |
|
|
static void sig_winch(int); |
static void sig_winch(int); |
static void setscreensize(void); |
static void setscreensize(void); |
|
|
/* updates the progressmeter to reflect the current state of the transfer */ |
|
void refresh_progress_meter(void); |
|
|
|
/* signal handler for updating the progress meter */ |
/* signal handler for updating the progress meter */ |
static void sig_alarm(int); |
static void sig_alarm(int); |
|
|
|
|
} |
} |
|
|
void |
void |
refresh_progress_meter(void) |
refresh_progress_meter(int force_update) |
{ |
{ |
char buf[MAX_WINSIZE + 1]; |
char buf[MAX_WINSIZE + 1]; |
off_t transferred; |
off_t transferred; |
|
|
int hours, minutes, seconds; |
int hours, minutes, seconds; |
int file_len; |
int file_len; |
|
|
if ((!alarm_fired && !win_resized) || !can_output()) |
if ((!force_update && !alarm_fired && !win_resized) || !can_output()) |
return; |
return; |
alarm_fired = 0; |
alarm_fired = 0; |
|
|
|
|
bytes_per_second = 0; |
bytes_per_second = 0; |
|
|
setscreensize(); |
setscreensize(); |
refresh_progress_meter(); |
refresh_progress_meter(1); |
|
|
signal(SIGALRM, sig_alarm); |
signal(SIGALRM, sig_alarm); |
signal(SIGWINCH, sig_winch); |
signal(SIGWINCH, sig_winch); |
|
|
|
|
/* Ensure we complete the progress */ |
/* Ensure we complete the progress */ |
if (cur_pos != end_pos) |
if (cur_pos != end_pos) |
refresh_progress_meter(); |
refresh_progress_meter(1); |
|
|
atomicio(vwrite, STDOUT_FILENO, "\n", 1); |
atomicio(vwrite, STDOUT_FILENO, "\n", 1); |
} |
} |