From: Ben Gras Date: Thu, 11 Aug 2005 16:18:53 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: v3.1.0~363 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/man.named-checkzone.html?a=commitdiff_plain;h=64695715da382bcff8e0dc12471f5caffee78e0c;p=minix.git *** empty log message *** --- diff --git a/commands/simple/cp.c b/commands/simple/cp.c index d45412108..0439748eb 100755 --- a/commands/simple/cp.c +++ b/commands/simple/cp.c @@ -364,7 +364,7 @@ int trylink(const char *src, const char *dst, struct stat *srcst, if (dstst->st_ino != 0) (void) unlink(dst); if ((linked= (link(olddst, dst) == 0)) && vflag) - printf("ln %s %s\n", olddst, dst); + printf("ln %s ..\n", olddst); return linked; } @@ -728,7 +728,7 @@ void link1(const char *src, const char *dst, struct stat *srcst, /* Can't do a cross-device link, we have to symlink. */ xdev= 1; } else { - if (vflag) printf("ln %s %s\n", src, dst); + if (vflag) printf("ln %s..\n", src); return; } } diff --git a/commands/simple/progressbar.c b/commands/simple/progressbar.c index 351076a8d..a4405b138 100755 --- a/commands/simple/progressbar.c +++ b/commands/simple/progressbar.c @@ -2,6 +2,7 @@ #include #include #include +#include _PROTOTYPE(int main, (int argc, char **argv)); @@ -10,18 +11,24 @@ prettyprogress(long b, long maxb, time_t starttime) { /* print progress indication */ time_t spent, now; - long bpsec; + double bpsec; time(&now); spent = now - starttime; - if(spent > 0 && (bpsec = b / spent) > 0) { + if(spent > 0 && (bpsec = (double)b / spent) > 0) { int len, i; long secremain, minremain, hremain; secremain = (maxb - b) / bpsec; minremain = (secremain / 60) % 60; hremain = secremain / 3600; - len = fprintf(stderr, "Remain %ld files. ETA: %d:%02d:%02d [", - maxb - b, + len = fprintf(stderr, "Remain %ld files. ", maxb-b); + +#if 0 + len += fprintf(stderr, "ETA: %d:%02d:%02d ", hremain, minremain, secremain % 60); +#endif + + len += fprintf(stderr, " ["); + #define WIDTH 77 len = WIDTH - len; for(i = 0; i < (b * (len-1) / maxb); i++) @@ -46,6 +53,7 @@ char *argv[]; if(argc < 2) return 1; count = atol(argv[1]); if(count < 1) return 1; + sync(); time(&start); printf("\n"); while(fgets(line, sizeof(line), stdin)) { @@ -54,7 +62,7 @@ char *argv[]; if(i <= count) prettyprogress(i, count, start); else printf("\r"); printf(""); - fflush(NULL); + fflush(stdout); } fprintf(stderr, "\nDone.\n");