From c9c1a41c581101f53cc36efae53cd8ebb568962f Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Wed, 12 Jul 2006 19:17:55 +0000 Subject: A couple things that got tangled up in my tree, easier to check in both than untangle them: Rewrite u_signal_names() into get_signum() and get_signame(), plus trim the signal list to that required by posix (they can specify the numbers for the rest if they really need them). (This is preparatory cleanup for adding a timeout applet like Roberto Foglietta wants.) Export the itoa (added due to Denis Vlasenko, although it's not quite his preferred implementation) from xfuncs.c so it's actually used, and remove several other redundant implementations of itoa and utoa() in the tree. --- networking/wget.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'networking/wget.c') diff --git a/networking/wget.c b/networking/wget.c index 64cdf6220..6565bb1f3 100644 --- a/networking/wget.c +++ b/networking/wget.c @@ -697,12 +697,11 @@ updateprogressmeter(int ignore) errno = save_errno; } -static void -alarmtimer(int wait) +static void alarmtimer(int iwait) { struct itimerval itv; - itv.it_value.tv_sec = wait; + itv.it_value.tv_sec = iwait; itv.it_value.tv_usec = 0; itv.it_interval = itv.it_value; setitimer(ITIMER_REAL, &itv, NULL); @@ -715,7 +714,7 @@ progressmeter(int flag) static struct timeval lastupdate; static off_t lastsize, totalsize; - struct timeval now, td, wait; + struct timeval now, td, tvwait; off_t abbrevsize; int elapsed, ratio, barlength, i; char buf[256]; @@ -753,18 +752,18 @@ progressmeter(int flag) /* See http://en.wikipedia.org/wiki/Tera */ fprintf(stderr, "%6d %c%c ", (int)abbrevsize, " KMGTPEZY"[i], i?'B':' '); - timersub(&now, &lastupdate, &wait); + timersub(&now, &lastupdate, &tvwait); if (transferred > lastsize) { lastupdate = now; lastsize = transferred; - if (wait.tv_sec >= STALLTIME) - timeradd(&start, &wait, &start); - wait.tv_sec = 0; + if (tvwait.tv_sec >= STALLTIME) + timeradd(&start, &tvwait, &start); + tvwait.tv_sec = 0; } timersub(&now, &start, &td); elapsed = td.tv_sec; - if (wait.tv_sec >= STALLTIME) { + if (tvwait.tv_sec >= STALLTIME) { fprintf(stderr, " - stalled -"); } else if (transferred <= 0 || elapsed <= 0 || transferred > totalsize || chunked) { fprintf(stderr, "--:--:-- ETA"); -- cgit v1.2.3