*** empty log message ***
This commit is contained in:
parent
4e4b661941
commit
64695715da
|
@ -364,7 +364,7 @@ int trylink(const char *src, const char *dst, struct stat *srcst,
|
||||||
if (dstst->st_ino != 0) (void) unlink(dst);
|
if (dstst->st_ino != 0) (void) unlink(dst);
|
||||||
|
|
||||||
if ((linked= (link(olddst, dst) == 0)) && vflag)
|
if ((linked= (link(olddst, dst) == 0)) && vflag)
|
||||||
printf("ln %s %s\n", olddst, dst);
|
printf("ln %s ..\n", olddst);
|
||||||
|
|
||||||
return linked;
|
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. */
|
/* Can't do a cross-device link, we have to symlink. */
|
||||||
xdev= 1;
|
xdev= 1;
|
||||||
} else {
|
} else {
|
||||||
if (vflag) printf("ln %s %s\n", src, dst);
|
if (vflag) printf("ln %s..\n", src);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
_PROTOTYPE(int main, (int argc, char **argv));
|
_PROTOTYPE(int main, (int argc, char **argv));
|
||||||
|
|
||||||
|
@ -10,18 +11,24 @@ prettyprogress(long b, long maxb, time_t starttime)
|
||||||
{
|
{
|
||||||
/* print progress indication */
|
/* print progress indication */
|
||||||
time_t spent, now;
|
time_t spent, now;
|
||||||
long bpsec;
|
double bpsec;
|
||||||
time(&now);
|
time(&now);
|
||||||
spent = now - starttime;
|
spent = now - starttime;
|
||||||
if(spent > 0 && (bpsec = b / spent) > 0) {
|
if(spent > 0 && (bpsec = (double)b / spent) > 0) {
|
||||||
int len, i;
|
int len, i;
|
||||||
long secremain, minremain, hremain;
|
long secremain, minremain, hremain;
|
||||||
secremain = (maxb - b) / bpsec;
|
secremain = (maxb - b) / bpsec;
|
||||||
minremain = (secremain / 60) % 60;
|
minremain = (secremain / 60) % 60;
|
||||||
hremain = secremain / 3600;
|
hremain = secremain / 3600;
|
||||||
len = fprintf(stderr, "Remain %ld files. ETA: %d:%02d:%02d [",
|
len = fprintf(stderr, "Remain %ld files. ", maxb-b);
|
||||||
maxb - b,
|
|
||||||
|
#if 0
|
||||||
|
len += fprintf(stderr, "ETA: %d:%02d:%02d ",
|
||||||
hremain, minremain, secremain % 60);
|
hremain, minremain, secremain % 60);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
len += fprintf(stderr, " [");
|
||||||
|
|
||||||
#define WIDTH 77
|
#define WIDTH 77
|
||||||
len = WIDTH - len;
|
len = WIDTH - len;
|
||||||
for(i = 0; i < (b * (len-1) / maxb); i++)
|
for(i = 0; i < (b * (len-1) / maxb); i++)
|
||||||
|
@ -46,6 +53,7 @@ char *argv[];
|
||||||
if(argc < 2) return 1;
|
if(argc < 2) return 1;
|
||||||
count = atol(argv[1]);
|
count = atol(argv[1]);
|
||||||
if(count < 1) return 1;
|
if(count < 1) return 1;
|
||||||
|
sync();
|
||||||
time(&start);
|
time(&start);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
while(fgets(line, sizeof(line), stdin)) {
|
while(fgets(line, sizeof(line), stdin)) {
|
||||||
|
@ -54,7 +62,7 @@ char *argv[];
|
||||||
if(i <= count) prettyprogress(i, count, start);
|
if(i <= count) prettyprogress(i, count, start);
|
||||||
else printf("\r");
|
else printf("\r");
|
||||||
printf("[A");
|
printf("[A");
|
||||||
fflush(NULL);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "\nDone.[K\n");
|
fprintf(stderr, "\nDone.[K\n");
|
||||||
|
|
Loading…
Reference in a new issue