summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--progressmeter.c13
-rw-r--r--progressmeter.h4
-rw-r--r--scp.c2
-rw-r--r--sftp-client.c2
4 files changed, 9 insertions, 12 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);
59static void sig_winch(int); 59static void sig_winch(int);
60static void setscreensize(void); 60static void setscreensize(void);
61 61
62/* updates the progressmeter to reflect the current state of the transfer */
63void refresh_progress_meter(void);
64
65/* signal handler for updating the progress meter */ 62/* signal handler for updating the progress meter */
66static void sig_alarm(int); 63static void sig_alarm(int);
67 64
@@ -120,7 +117,7 @@ format_size(char *buf, int size, off_t bytes)
120} 117}
121 118
122void 119void
123refresh_progress_meter(void) 120refresh_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}
diff --git a/progressmeter.h b/progressmeter.h
index 8f6678060..1703ea75b 100644
--- a/progressmeter.h
+++ b/progressmeter.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: progressmeter.h,v 1.4 2019/01/23 08:01:46 dtucker Exp $ */ 1/* $OpenBSD: progressmeter.h,v 1.5 2019/01/24 16:52:17 dtucker Exp $ */
2/* 2/*
3 * Copyright (c) 2002 Nils Nordman. All rights reserved. 3 * Copyright (c) 2002 Nils Nordman. All rights reserved.
4 * 4 *
@@ -24,5 +24,5 @@
24 */ 24 */
25 25
26void start_progress_meter(const char *, off_t, off_t *); 26void start_progress_meter(const char *, off_t, off_t *);
27void refresh_progress_meter(void); 27void refresh_progress_meter(int);
28void stop_progress_meter(void); 28void stop_progress_meter(void);
diff --git a/scp.c b/scp.c
index 80308573c..1971c80cd 100644
--- a/scp.c
+++ b/scp.c
@@ -593,7 +593,7 @@ scpio(void *_cnt, size_t s)
593 off_t *cnt = (off_t *)_cnt; 593 off_t *cnt = (off_t *)_cnt;
594 594
595 *cnt += s; 595 *cnt += s;
596 refresh_progress_meter(); 596 refresh_progress_meter(0);
597 if (limit_kbps > 0) 597 if (limit_kbps > 0)
598 bandwidth_limit(&bwlimit, s); 598 bandwidth_limit(&bwlimit, s);
599 return 0; 599 return 0;
diff --git a/sftp-client.c b/sftp-client.c
index 2bc698f86..cf2887a40 100644
--- a/sftp-client.c
+++ b/sftp-client.c
@@ -101,7 +101,7 @@ sftpio(void *_bwlimit, size_t amount)
101{ 101{
102 struct bwlimit *bwlimit = (struct bwlimit *)_bwlimit; 102 struct bwlimit *bwlimit = (struct bwlimit *)_bwlimit;
103 103
104 refresh_progress_meter(); 104 refresh_progress_meter(0);
105 if (bwlimit != NULL) 105 if (bwlimit != NULL)
106 bandwidth_limit(bwlimit, amount); 106 bandwidth_limit(bwlimit, amount);
107 return 0; 107 return 0;