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;
}
/* 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;
}
}
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
+#include <unistd.h>
_PROTOTYPE(int main, (int argc, char **argv));
{
/* 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++)
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)) {
if(i <= count) prettyprogress(i, count, start);
else printf("\r");
printf("\e[A");
- fflush(NULL);
+ fflush(stdout);
}
fprintf(stderr, "\nDone.\e[K\n");