summaryrefslogtreecommitdiff
path: root/networking/wget.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2006-07-12 19:17:55 +0000
committerRob Landley <rob@landley.net>2006-07-12 19:17:55 +0000
commitc9c1a41c581101f53cc36efae53cd8ebb568962f (patch)
tree0aa4024f33e22567444f78d83d7d4b7986abe795 /networking/wget.c
parent801ab140132a111e9524371c9b8d425579692389 (diff)
downloadbusybox-w32-c9c1a41c581101f53cc36efae53cd8ebb568962f.tar.gz
busybox-w32-c9c1a41c581101f53cc36efae53cd8ebb568962f.tar.bz2
busybox-w32-c9c1a41c581101f53cc36efae53cd8ebb568962f.zip
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.
Diffstat (limited to 'networking/wget.c')
-rw-r--r--networking/wget.c17
1 files changed, 8 insertions, 9 deletions
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)
697 errno = save_errno; 697 errno = save_errno;
698} 698}
699 699
700static void 700static void alarmtimer(int iwait)
701alarmtimer(int wait)
702{ 701{
703 struct itimerval itv; 702 struct itimerval itv;
704 703
705 itv.it_value.tv_sec = wait; 704 itv.it_value.tv_sec = iwait;
706 itv.it_value.tv_usec = 0; 705 itv.it_value.tv_usec = 0;
707 itv.it_interval = itv.it_value; 706 itv.it_interval = itv.it_value;
708 setitimer(ITIMER_REAL, &itv, NULL); 707 setitimer(ITIMER_REAL, &itv, NULL);
@@ -715,7 +714,7 @@ progressmeter(int flag)
715 static struct timeval lastupdate; 714 static struct timeval lastupdate;
716 static off_t lastsize, totalsize; 715 static off_t lastsize, totalsize;
717 716
718 struct timeval now, td, wait; 717 struct timeval now, td, tvwait;
719 off_t abbrevsize; 718 off_t abbrevsize;
720 int elapsed, ratio, barlength, i; 719 int elapsed, ratio, barlength, i;
721 char buf[256]; 720 char buf[256];
@@ -753,18 +752,18 @@ progressmeter(int flag)
753 /* See http://en.wikipedia.org/wiki/Tera */ 752 /* See http://en.wikipedia.org/wiki/Tera */
754 fprintf(stderr, "%6d %c%c ", (int)abbrevsize, " KMGTPEZY"[i], i?'B':' '); 753 fprintf(stderr, "%6d %c%c ", (int)abbrevsize, " KMGTPEZY"[i], i?'B':' ');
755 754
756 timersub(&now, &lastupdate, &wait); 755 timersub(&now, &lastupdate, &tvwait);
757 if (transferred > lastsize) { 756 if (transferred > lastsize) {
758 lastupdate = now; 757 lastupdate = now;
759 lastsize = transferred; 758 lastsize = transferred;
760 if (wait.tv_sec >= STALLTIME) 759 if (tvwait.tv_sec >= STALLTIME)
761 timeradd(&start, &wait, &start); 760 timeradd(&start, &tvwait, &start);
762 wait.tv_sec = 0; 761 tvwait.tv_sec = 0;
763 } 762 }
764 timersub(&now, &start, &td); 763 timersub(&now, &start, &td);
765 elapsed = td.tv_sec; 764 elapsed = td.tv_sec;
766 765
767 if (wait.tv_sec >= STALLTIME) { 766 if (tvwait.tv_sec >= STALLTIME) {
768 fprintf(stderr, " - stalled -"); 767 fprintf(stderr, " - stalled -");
769 } else if (transferred <= 0 || elapsed <= 0 || transferred > totalsize || chunked) { 768 } else if (transferred <= 0 || elapsed <= 0 || transferred > totalsize || chunked) {
770 fprintf(stderr, "--:--:-- ETA"); 769 fprintf(stderr, "--:--:-- ETA");