version 1.15.2.1, 2004/02/28 03:51:33 |
version 1.15.2.2, 2004/08/19 22:37:31 |
|
|
/* signal handler for updating the progress meter */ |
/* signal handler for updating the progress meter */ |
static void update_progress_meter(int); |
static void update_progress_meter(int); |
|
|
static time_t start; /* start progress */ |
static time_t start; /* start progress */ |
static time_t last_update; /* last progress update */ |
static time_t last_update; /* last progress update */ |
static char *file; /* name of the file being transferred */ |
static char *file; /* name of the file being transferred */ |
static off_t end_pos; /* ending position of transfer */ |
static off_t end_pos; /* ending position of transfer */ |
static off_t cur_pos; /* transfer position as of last refresh */ |
static off_t cur_pos; /* transfer position as of last refresh */ |
static volatile off_t *counter; /* progress counter */ |
static volatile off_t *counter; /* progress counter */ |
static long stalled; /* how long we have been stalled */ |
static long stalled; /* how long we have been stalled */ |
static int bytes_per_second; /* current speed in bytes per second */ |
static int bytes_per_second; /* current speed in bytes per second */ |
static int win_size; /* terminal window size */ |
static int win_size; /* terminal window size */ |
|
|
/* units for format_size */ |
/* units for format_size */ |
static const char unit[] = " KMGT"; |
static const char unit[] = " KMGT"; |
|
|
|
|
/* bandwidth usage */ |
/* bandwidth usage */ |
format_rate(buf + strlen(buf), win_size - strlen(buf), |
format_rate(buf + strlen(buf), win_size - strlen(buf), |
bytes_per_second); |
(off_t)bytes_per_second); |
strlcat(buf, "/s ", win_size); |
strlcat(buf, "/s ", win_size); |
|
|
/* ETA */ |
/* ETA */ |
|
|
} |
} |
|
|
void |
void |
start_progress_meter(char *f, off_t filesize, off_t *stat) |
start_progress_meter(char *f, off_t filesize, off_t *ctr) |
{ |
{ |
struct winsize winsize; |
struct winsize winsize; |
|
|
|
|
file = f; |
file = f; |
end_pos = filesize; |
end_pos = filesize; |
cur_pos = 0; |
cur_pos = 0; |
counter = stat; |
counter = ctr; |
stalled = 0; |
stalled = 0; |
bytes_per_second = 0; |
bytes_per_second = 0; |
|
|