diff options
Diffstat (limited to 'progressmeter.c')
-rw-r--r-- | progressmeter.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/progressmeter.c b/progressmeter.c index add462dde..e385c1254 100644 --- a/progressmeter.c +++ b/progressmeter.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: progressmeter.c,v 1.46 2019/01/23 08:01:46 dtucker Exp $ */ | 1 | /* $OpenBSD: progressmeter.c,v 1.47 2019/01/24 16:52:17 dtucker Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2003 Nils Nordman. All rights reserved. | 3 | * Copyright (c) 2003 Nils Nordman. All rights reserved. |
4 | * | 4 | * |
@@ -59,9 +59,6 @@ static void format_rate(char *, int, off_t); | |||
59 | static void sig_winch(int); | 59 | static void sig_winch(int); |
60 | static void setscreensize(void); | 60 | static void setscreensize(void); |
61 | 61 | ||
62 | /* updates the progressmeter to reflect the current state of the transfer */ | ||
63 | void refresh_progress_meter(void); | ||
64 | |||
65 | /* signal handler for updating the progress meter */ | 62 | /* signal handler for updating the progress meter */ |
66 | static void sig_alarm(int); | 63 | static void sig_alarm(int); |
67 | 64 | ||
@@ -120,7 +117,7 @@ format_size(char *buf, int size, off_t bytes) | |||
120 | } | 117 | } |
121 | 118 | ||
122 | void | 119 | void |
123 | refresh_progress_meter(void) | 120 | refresh_progress_meter(int force_update) |
124 | { | 121 | { |
125 | char buf[MAX_WINSIZE + 1]; | 122 | char buf[MAX_WINSIZE + 1]; |
126 | off_t transferred; | 123 | off_t transferred; |
@@ -131,7 +128,7 @@ refresh_progress_meter(void) | |||
131 | int hours, minutes, seconds; | 128 | int hours, minutes, seconds; |
132 | int file_len; | 129 | int file_len; |
133 | 130 | ||
134 | if ((!alarm_fired && !win_resized) || !can_output()) | 131 | if ((!force_update && !alarm_fired && !win_resized) || !can_output()) |
135 | return; | 132 | return; |
136 | alarm_fired = 0; | 133 | alarm_fired = 0; |
137 | 134 | ||
@@ -254,7 +251,7 @@ start_progress_meter(const char *f, off_t filesize, off_t *ctr) | |||
254 | bytes_per_second = 0; | 251 | bytes_per_second = 0; |
255 | 252 | ||
256 | setscreensize(); | 253 | setscreensize(); |
257 | refresh_progress_meter(); | 254 | refresh_progress_meter(1); |
258 | 255 | ||
259 | signal(SIGALRM, sig_alarm); | 256 | signal(SIGALRM, sig_alarm); |
260 | signal(SIGWINCH, sig_winch); | 257 | signal(SIGWINCH, sig_winch); |
@@ -271,7 +268,7 @@ stop_progress_meter(void) | |||
271 | 268 | ||
272 | /* Ensure we complete the progress */ | 269 | /* Ensure we complete the progress */ |
273 | if (cur_pos != end_pos) | 270 | if (cur_pos != end_pos) |
274 | refresh_progress_meter(); | 271 | refresh_progress_meter(1); |
275 | 272 | ||
276 | atomicio(vwrite, STDOUT_FILENO, "\n", 1); | 273 | atomicio(vwrite, STDOUT_FILENO, "\n", 1); |
277 | } | 274 | } |