statbytes = 0;
progressmeter(int flag){	static const char prefixes[] = " KMGTP";	static struct timeval lastupdate;	static off_t lastsize;	struct timeval now, td, wait;	off_t cursize, abbrevsize;	double elapsed;	int ratio, barlength, i, remaining;	char buf[256];	if (flag == -1) {		(void)gettimeofday(&start, (struct timezone *)0);		lastupdate = start;		lastsize = 0;	}   	(void)gettimeofday(&now, (struct timezone *)0);	cursize = statbytes;	ratio = cursize * 100 / totalbytes;	ratio = MAX(ratio, 0);	ratio = MIN(ratio, 100);	snprintf(buf, sizeof(buf), "\r%-20.20s %3d%% ", curfile, ratio); 	barlength = getttywidth() - 51;	if (barlength > 0) {		i = barlength * ratio / 100;		snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),		"|%.*s%*s|", i,"*****************************************************************************""*****************************************************************************",                 barlength - i, "");	}	i = 0;	abbrevsize = cursize;	while (abbrevsize >= 100000 && i < sizeof(prefixes)) {		i++;		abbrevsize >>= 10;	}	snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %5qd %c%c ",	    (quad_t)abbrevsize, prefixes[i], prefixes[i] == ' ' ? ' ' :	    'B');	timersub(&now, &lastupdate, &wait);	if (cursize > lastsize) {		lastupdate = now;		lastsize = cursize;		if (wait.tv_sec >= STALLTIME) {			start.tv_sec += wait.tv_sec;			start.tv_usec += wait.tv_usec;		}		wait.tv_sec = 0;	}	timersub(&now, &start, &td);	elapsed = td.tv_sec + (td.tv_usec / 1000000.0);	if (statbytes <= 0 || elapsed <= 0.0 || cursize > totalbytes) {		snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),		    "   --:-- ETA");	} else if (wait.tv_sec >= STALLTIME) {		snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),		    " - stalled -");	} else {		remaining = (int)(totalbytes / (statbytes / elapsed) - elapsed);		i = elapsed / 3600;		if (i)			snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),			    "%2d:", i);		else			snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),			    "   ");		i = remaining % 3600;		snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),		    "%02d:%02d ETA", i / 60, i % 60);	}	atomicio(write, fileno(stdout), buf, strlen(buf));	if (flag == -1) {		signal(SIGALRM, (void *)updateprogressmeter);		alarmtimer(1);	} else if (flag == 1) {		alarmtimer(0);		write(fileno(stdout), "\n", 1);	}}