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.
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user