5 Commits
v1.1 ... v1.20

2 changed files with 43 additions and 39 deletions

View File

@ -3,14 +3,14 @@ DESTDIR ?=
PREFIX ?= /usr/local
# Build flags
FLAGS = -std=gnu99
OPTS = -std=gnu99
# Build rules
all: backly
.PHONY: all install clean
backly: backly.c Makefile
gcc $(FLAGS) -o backly backly.c
gcc $(OPTS) $(CFLAGS) -o backly backly.c
install: backly
install -Dm 0755 backly $(DESTDIR)/$(PREFIX)/bin/backly

View File

@ -259,7 +259,7 @@ void copyNew(char *src, int srcPrefix, char *dest, int destPrefix, int testMode)
// Only copy file if it doesn't exist or has changed
if (needToCopy == 1) {
printf("+ %s 100.00%", itemSrc + srcPrefix);
printf("+ %s ", itemSrc + srcPrefix);
fflush(stdout);
if (testMode == 0) {
int pid = fork();
@ -267,11 +267,11 @@ void copyNew(char *src, int srcPrefix, char *dest, int destPrefix, int testMode)
fprintf(stderr, "Could not fork: %s\n", strerror(errno));
continue;
} else if (pid == 0) {
execlp("cp", "cp", "-f --preserve=timestamps", itemSrc, itemDest, (char *) NULL);
execlp("cp", "cp", "-f", "-P", "--preserve=timestamps,links", itemSrc, itemDest, (char *) NULL);
} else {
struct stat srcStat, destStat;
double pDone = 0;
int numPrinted = 7;
int numPrinted = 0;
if (stat(itemSrc, &srcStat) != -1) {
while (waitpid(pid, NULL, WNOHANG) == 0) {
if (stat(itemDest, &destStat) == -1)
@ -285,6 +285,10 @@ void copyNew(char *src, int srcPrefix, char *dest, int destPrefix, int testMode)
fflush(stdout);
}
}
for (int i = 0; i < numPrinted; i++)
printf("\b \b");
printf("100.00%%");
fflush(stdout);
}
}
printf("\n");