version 1.64, 2009/11/11 17:10:25 |
version 1.65, 2014/01/23 00:39:15 |
|
|
*/ |
*/ |
static struct timeval start; |
static struct timeval start; |
|
|
|
char *action; |
|
|
void |
void |
progressmeter(int flag, const char *filename) |
progressmeter(int flag, const char *filename) |
{ |
{ |
|
|
if (filename != NULL) |
if (filename != NULL) |
title = strdup(filename); |
title = strdup(filename); |
} |
} |
|
|
|
buf[0] = 0; |
|
if (!verbose && action != NULL) { |
|
int l = strlen(action); |
|
char *dotdot = ""; |
|
|
|
if (l < 7) |
|
l = 7; |
|
else if (l > 12) { |
|
l = 12; |
|
dotdot = "..."; |
|
overhead += 3; |
|
} |
|
snprintf(buf, sizeof(buf), "\r%-*.*s%s ", l, l, action, |
|
dotdot); |
|
overhead += l + 1; |
|
} else |
|
snprintf(buf, sizeof(buf), ""); |
|
|
if (!verbose && title != NULL) { |
if (!verbose && title != NULL) { |
int l = strlen(title); |
int l = strlen(title); |
char *dotdot = ""; |
char *dotdot = ""; |
|
|
dotdot = "..."; |
dotdot = "..."; |
overhead += 3; |
overhead += 3; |
} |
} |
snprintf(buf, sizeof(buf), "\r%-*.*s%s %3d%% ", l, l, title, |
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), |
|
"%-*.*s%s %3d%% ", l, l, title, |
dotdot, ratio); |
dotdot, ratio); |
overhead += l + 1; |
overhead += l + 1; |
} else |
} else |