fd_set ss;
SlurpProgress(int fd){	char s1[71];	char *newbuf;	int nready;	size_t ntoread;	ssize_t nread;	struct timeval now, tnext, tleft;	fd_set ss;	fd_set ss2;	const char *trail = "/-\\|", *trailcp;	trailcp = trail;	snprintf(s1, sizeof(s1), "%s%s%s... ", gAction, gTarget[0] ? " " : "", gTarget);	printf("\r%-70s%-9s", s1, "");	fflush(stdout);	gettimeofday(&now, NULL);	tnext = now;	tnext.tv_sec++;	tleft.tv_sec = 1;	tleft.tv_usec = 0;	FD_ZERO(&ss2);	FD_SET(fd, &ss2);	for(;;) {		if (gNBufUsed == (gNBufAllocated - 1)) {			if ((newbuf = (char *) realloc(gBuf, gNBufAllocated + TEXT_BLOCK_SIZE)) == NULL) {				perror("ccdv: realloc");				return (-1);			}			gNBufAllocated += TEXT_BLOCK_SIZE;			gBuf = newbuf;		}#if 0		for (;;) {			ss = ss2;			nready = select(fd + 1, &ss, NULL, NULL, &tleft);			if (nready == 1)				break;			if (nready < 0) {				if (errno != EINTR) {					perror("ccdv: select");					return (-1);				}				continue;			}			gettimeofday(&now, NULL);			if ((now.tv_sec > tnext.tv_sec) || ((now.tv_sec == tnext.tv_sec) && (now.tv_usec >= tnext.tv_usec))) {				tnext = now;				tnext.tv_sec++;				tleft.tv_sec = 1;				tleft.tv_usec = 0;				printf("\r%-71s%c%-7s", s1, *trailcp, "");				fflush(stdout);				if (*++trailcp == '\0')					trailcp = trail;			} else {				TimeValSubtract(&tleft, &tnext, &now);			}		}#endif		ntoread = (gNBufAllocated - gNBufUsed - 1);		nread = read(fd, gBuf + gNBufUsed, ntoread);		if (nread < 0) {			if (errno == EINTR)				continue;			perror("ccdv: read");			return (-1);		} else if (nread == 0) {			break;		}		gNBufUsed += nread;		gBuf[gNBufUsed] = '\0';	}	snprintf(s1, sizeof(s1), "%s%s%s: ", gAction, gTarget[0] ? " " : "", gTarget);	Wait();	if (gExitStatus == 0) {		printf("\r%-70s", s1);		printf("[%s%s%s]", ((gNBufUsed - strlen(gArgsStr)) < 4) ? SETCOLOR_SUCCESS : SETCOLOR_WARNING, "OK", SETCOLOR_NORMAL);		printf("%-5s\n", " ");	} else {		printf("\r%-70s", s1);		printf("[%s%s%s]", SETCOLOR_FAILURE, "ERROR", SETCOLOR_NORMAL);		printf("%-2s\n", " ");		gDumpCmdArgs = 1;	/* print cmd when there are errors */	}	fflush(stdout);	return (0);}	/* SlurpProgress */