diff options
Diffstat (limited to 'networking')
-rw-r--r-- | networking/netstat.c | 25 | ||||
-rw-r--r-- | networking/traceroute.c | 10 | ||||
-rw-r--r-- | networking/wget.c | 17 |
3 files changed, 14 insertions, 38 deletions
diff --git a/networking/netstat.c b/networking/netstat.c index 4faa40c..6d91bb3 100644 --- a/networking/netstat.c +++ b/networking/netstat.c @@ -11,18 +11,8 @@ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdarg.h> -#include <signal.h> -#include <errno.h> -#include <sys/stat.h> -#include <dirent.h> -#include <unistd.h> -#include "inet_common.h" #include "busybox.h" -#include "pwd_.h" +#include "inet_common.h" #ifdef CONFIG_ROUTE extern void displayroutes(int noresolve, int netstatfmt); @@ -87,19 +77,6 @@ typedef enum { #define SO_WAITDATA (1<<17) /* wait data to read */ #define SO_NOSPACE (1<<18) /* no space to write */ -static char *itoa(unsigned int i) -{ - /* 21 digits plus null terminator, good for 64-bit or smaller ints */ - static char local[22]; - char *p = &local[21]; - *p-- = '\0'; - do { - *p-- = '0' + i % 10; - i /= 10; - } while (i > 0); - return p + 1; -} - static char *get_sname(int port, const char *proto, int num) { char *str=itoa(ntohs(port)); diff --git a/networking/traceroute.c b/networking/traceroute.c index 190f19d..79f3957 100644 --- a/networking/traceroute.c +++ b/networking/traceroute.c @@ -548,7 +548,7 @@ static int wait_for_reply(int sock, struct sockaddr_in *fromp, const struct timeval *tp) { fd_set fds; - struct timeval now, wait; + struct timeval now, tvwait; struct timezone tz; int cc = 0; socklen_t fromlen = sizeof(*fromp); @@ -556,12 +556,12 @@ wait_for_reply(int sock, struct sockaddr_in *fromp, const struct timeval *tp) FD_ZERO(&fds); FD_SET(sock, &fds); - wait.tv_sec = tp->tv_sec + waittime; - wait.tv_usec = tp->tv_usec; + tvwait.tv_sec = tp->tv_sec + waittime; + tvwait.tv_usec = tp->tv_usec; (void)gettimeofday(&now, &tz); - tvsub(&wait, &now); + tvsub(&tvwait, &now); - if (select(sock + 1, &fds, NULL, NULL, &wait) > 0) + if (select(sock + 1, &fds, NULL, NULL, &tvwait) > 0) cc = recvfrom(sock, (char *)packet, sizeof(packet), 0, (struct sockaddr *)fromp, &fromlen); diff --git a/networking/wget.c b/networking/wget.c index 64cdf62..6565bb1 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"); |