3 Commits
v1.0 ... v1.11

2 changed files with 6 additions and 5 deletions

View File

@ -1,4 +1,5 @@
# Install prefix # Install destination and prefix
DESTDIR ?=
PREFIX ?= /usr/local PREFIX ?= /usr/local
# Build flags # Build flags
@ -12,7 +13,7 @@ backly: backly.c Makefile
gcc $(FLAGS) -o backly backly.c gcc $(FLAGS) -o backly backly.c
install: backly install: backly
install -m 0755 backly $(PREFIX)/bin install -Dm 0755 backly $(DESTDIR)/$(PREFIX)/bin/backly
clean: clean:
rm -f backly rm -f 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 // Only copy file if it doesn't exist or has changed
if (needToCopy == 1) { if (needToCopy == 1) {
printf("+ %s ", itemSrc + srcPrefix); printf("+ %s 100.00%%", itemSrc + srcPrefix);
fflush(stdout); fflush(stdout);
if (testMode == 0) { if (testMode == 0) {
int pid = fork(); 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)); fprintf(stderr, "Could not fork: %s\n", strerror(errno));
continue; continue;
} else if (pid == 0) { } else if (pid == 0) {
execlp("cp", "cp", "-fp", itemSrc, itemDest, (char *) NULL); execlp("cp", "cp", "-f", "--preserve=timestamps", itemSrc, itemDest, (char *) NULL);
} else { } else {
struct stat srcStat, destStat; struct stat srcStat, destStat;
double pDone = 0; double pDone = 0;
int numPrinted = 0; int numPrinted = 7;
if (stat(itemSrc, &srcStat) != -1) { if (stat(itemSrc, &srcStat) != -1) {
while (waitpid(pid, NULL, WNOHANG) == 0) { while (waitpid(pid, NULL, WNOHANG) == 0) {
if (stat(itemDest, &destStat) == -1) if (stat(itemDest, &destStat) == -1)