printff: Normal printf with flush.
This commit is contained in:
@@ -293,32 +293,32 @@ FileNode *FileNode_Load(char *filePath) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FileNode_PrintNode(FileNode *fileNode) {
|
void FileNode_PrintNode(FileNode *fileNode) {
|
||||||
printf(FileNode_GetPath(fileNode, NULL ));
|
printff(FileNode_GetPath(fileNode, NULL ));
|
||||||
if (fileNode->flags & FileFlag_Normal) {
|
if (fileNode->flags & FileFlag_Normal) {
|
||||||
printf(" File");
|
printff(" File");
|
||||||
} else {
|
} else {
|
||||||
printf(" Dir");
|
printff(" Dir");
|
||||||
}
|
}
|
||||||
printf(" %d", fileNode->estado);
|
printff(" %d", fileNode->estado);
|
||||||
if (fileNode->estado == FileStatus_New) {
|
if (fileNode->estado == FileStatus_New) {
|
||||||
printf(" Nuevo");
|
printff(" Nuevo");
|
||||||
}
|
}
|
||||||
if (fileNode->estado == FileStatus_Modified) {
|
if (fileNode->estado == FileStatus_Modified) {
|
||||||
printf(" Modificado");
|
printff(" Modificado");
|
||||||
}
|
}
|
||||||
if (fileNode->estado == FileStatus_Deleted) {
|
if (fileNode->estado == FileStatus_Deleted) {
|
||||||
printf(" Borrado!!!");
|
printff(" Borrado!!!");
|
||||||
}
|
}
|
||||||
printf("\n");
|
printff("\n");
|
||||||
|
|
||||||
if(fileNode->flags&FileFlag_HasSize){
|
if(fileNode->flags&FileFlag_HasSize){
|
||||||
printf("\\-Tamanho: %lld\n",fileNode->size);
|
printff("\\-Tamanho: %lld\n",fileNode->size);
|
||||||
}
|
}
|
||||||
if(fileNode->flags&FileFlag_HastTime){
|
if(fileNode->flags&FileFlag_HastTime){
|
||||||
printf("\\-Fecha : ");FileTime_Print(fileNode->fileTime);printf("\n");
|
printff("\\-Fecha : ");FileTime_Print(fileNode->fileTime);printff("\n");
|
||||||
}
|
}
|
||||||
if(fileNode->flags&FileFlag_HasCRC){
|
if(fileNode->flags&FileFlag_HasCRC){
|
||||||
printf("\\-CRC : [%08X]\n",fileNode->crc);
|
printff("\\-CRC : [%08X]\n",fileNode->crc);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -339,7 +339,7 @@ void FileNode_Print(FileNode *fileNode) {
|
|||||||
while (fileNodeAux->next == NULL ) {
|
while (fileNodeAux->next == NULL ) {
|
||||||
fileNodeAux = fileNodeAux->parent;
|
fileNodeAux = fileNodeAux->parent;
|
||||||
if (fileNodeAux == fileNode || fileNodeAux == NULL ) {
|
if (fileNodeAux == fileNode || fileNodeAux == NULL ) {
|
||||||
printf("End\n");
|
printff("End\n");
|
||||||
end = 1;
|
end = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -551,37 +551,37 @@ void AccionFileNode_Print(AccionFileNode *actionFileNode) {
|
|||||||
|
|
||||||
switch (actionFileNode->action) {
|
switch (actionFileNode->action) {
|
||||||
case AccionFileCmp_Nothing:
|
case AccionFileCmp_Nothing:
|
||||||
//printf("%s == %s\n",pathIzq,pathDer);
|
//printff("%s == %s\n",pathIzq,pathDer);
|
||||||
break;
|
break;
|
||||||
case AccionFileCmp_LeftToRight:
|
case AccionFileCmp_LeftToRight:
|
||||||
printf(" => %s\n", showPath);
|
printff(" => %s\n", showPath);
|
||||||
break;
|
break;
|
||||||
case AccionFileCmp_RightToLeft:
|
case AccionFileCmp_RightToLeft:
|
||||||
printf(" <= %s\n", showPath);
|
printff(" <= %s\n", showPath);
|
||||||
break;
|
break;
|
||||||
case AccionFileCmp_DeleteLeft:
|
case AccionFileCmp_DeleteLeft:
|
||||||
printf(" *- %s\n", showPath);
|
printff(" *- %s\n", showPath);
|
||||||
break;
|
break;
|
||||||
case AccionFileCmp_DeleteRight:
|
case AccionFileCmp_DeleteRight:
|
||||||
printf(" -* %s\n", showPath);
|
printff(" -* %s\n", showPath);
|
||||||
break;
|
break;
|
||||||
case AccionFileCmp_DateLeftToRight:
|
case AccionFileCmp_DateLeftToRight:
|
||||||
printf(" -> %s\n", showPath);
|
printff(" -> %s\n", showPath);
|
||||||
break;
|
break;
|
||||||
case AccionFileCmp_DateRightToLeft:
|
case AccionFileCmp_DateRightToLeft:
|
||||||
printf(" <- %s\n", showPath);
|
printff(" <- %s\n", showPath);
|
||||||
break;
|
break;
|
||||||
case AccionFileCmp_MakeRightDirectory:
|
case AccionFileCmp_MakeRightDirectory:
|
||||||
printf(" -D %s\n", showPath);
|
printff(" -D %s\n", showPath);
|
||||||
break;
|
break;
|
||||||
case AccionFileCmp_MakeLeftDirectory:
|
case AccionFileCmp_MakeLeftDirectory:
|
||||||
printf(" D- %s\n", showPath);
|
printff(" D- %s\n", showPath);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
actionFileNode = actionFileNode->next;
|
actionFileNode = actionFileNode->next;
|
||||||
}
|
}
|
||||||
printf("End\n");
|
printff("End\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void AccionFileNodeAux_CopyDate(char *pathOrig, char *pathDest) {
|
void AccionFileNodeAux_CopyDate(char *pathOrig, char *pathDest) {
|
||||||
@@ -631,43 +631,43 @@ void AccionFileNode_RunList(AccionFileNode *actionFileNode, char *pathLeft,
|
|||||||
|
|
||||||
switch (actionFileNode->action) {
|
switch (actionFileNode->action) {
|
||||||
case AccionFileCmp_Nothing:
|
case AccionFileCmp_Nothing:
|
||||||
//printf("%s == %s\n",pathIzq,pathDer);
|
//printff("%s == %s\n",pathIzq,pathDer);
|
||||||
break;
|
break;
|
||||||
case AccionFileCmp_LeftToRight:
|
case AccionFileCmp_LeftToRight:
|
||||||
printf(" => %s\n", showPath);
|
printff(" => %s\n", showPath);
|
||||||
AccionFileNodeAux_Copy(fullPathLeft, fullPathRight);
|
AccionFileNodeAux_Copy(fullPathLeft, fullPathRight);
|
||||||
break;
|
break;
|
||||||
case AccionFileCmp_RightToLeft:
|
case AccionFileCmp_RightToLeft:
|
||||||
printf(" <= %s\n", showPath);
|
printff(" <= %s\n", showPath);
|
||||||
AccionFileNodeAux_Copy(fullPathRight, fullPathLeft);
|
AccionFileNodeAux_Copy(fullPathRight, fullPathLeft);
|
||||||
break;
|
break;
|
||||||
case AccionFileCmp_DeleteLeft:
|
case AccionFileCmp_DeleteLeft:
|
||||||
printf(" *- %s\n", showPath);
|
printff(" *- %s\n", showPath);
|
||||||
AccionFileNodeAux_Delete(fullPathRight, fullPathLeft);
|
AccionFileNodeAux_Delete(fullPathRight, fullPathLeft);
|
||||||
break;
|
break;
|
||||||
case AccionFileCmp_DeleteRight:
|
case AccionFileCmp_DeleteRight:
|
||||||
printf(" -* %s\n", showPath);
|
printff(" -* %s\n", showPath);
|
||||||
AccionFileNodeAux_Delete(fullPathLeft, fullPathRight);
|
AccionFileNodeAux_Delete(fullPathLeft, fullPathRight);
|
||||||
break;
|
break;
|
||||||
case AccionFileCmp_DateLeftToRight:
|
case AccionFileCmp_DateLeftToRight:
|
||||||
printf(" -> %s\n", showPath);
|
printff(" -> %s\n", showPath);
|
||||||
AccionFileNodeAux_CopyDate(fullPathLeft, fullPathRight);
|
AccionFileNodeAux_CopyDate(fullPathLeft, fullPathRight);
|
||||||
break;
|
break;
|
||||||
case AccionFileCmp_DateRightToLeft:
|
case AccionFileCmp_DateRightToLeft:
|
||||||
printf(" <- %s\n", showPath);
|
printff(" <- %s\n", showPath);
|
||||||
AccionFileNodeAux_CopyDate(fullPathRight, fullPathLeft);
|
AccionFileNodeAux_CopyDate(fullPathRight, fullPathLeft);
|
||||||
break;
|
break;
|
||||||
case AccionFileCmp_MakeRightDirectory:
|
case AccionFileCmp_MakeRightDirectory:
|
||||||
printf(" -D %s\n", showPath);
|
printff(" -D %s\n", showPath);
|
||||||
AccionFileNodeAux_MakeDir(fullPathLeft, fullPathRight);
|
AccionFileNodeAux_MakeDir(fullPathLeft, fullPathRight);
|
||||||
break;
|
break;
|
||||||
case AccionFileCmp_MakeLeftDirectory:
|
case AccionFileCmp_MakeLeftDirectory:
|
||||||
printf(" D- %s\n", showPath);
|
printff(" D- %s\n", showPath);
|
||||||
AccionFileNodeAux_MakeDir(fullPathRight, fullPathLeft);
|
AccionFileNodeAux_MakeDir(fullPathRight, fullPathLeft);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
actionFileNode = actionFileNode->next;
|
actionFileNode = actionFileNode->next;
|
||||||
}
|
}
|
||||||
printf("End\n");
|
printff("End\n");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ void FileTime_Print(FileTime fileTime) {
|
|||||||
struct tm *tms;
|
struct tm *tms;
|
||||||
|
|
||||||
tms = localtime((time_t *) &fileTime);
|
tms = localtime((time_t *) &fileTime);
|
||||||
printf("%04d-%02d-%02d %02d:%02d:%02d", tms->tm_year + 1900,
|
printff("%04d-%02d-%02d %02d:%02d:%02d", tms->tm_year + 1900,
|
||||||
tms->tm_mon + 1, tms->tm_mday, tms->tm_hour, tms->tm_min,
|
tms->tm_mon + 1, tms->tm_mday, tms->tm_hour, tms->tm_min,
|
||||||
tms->tm_sec);
|
tms->tm_sec);
|
||||||
}
|
}
|
||||||
@@ -302,7 +302,7 @@ void File_IterateDir(char *path,
|
|||||||
&& strcmp(entidad_dir->d_name, "..")) {
|
&& strcmp(entidad_dir->d_name, "..")) {
|
||||||
// A partir de aqui hay un fichero
|
// A partir de aqui hay un fichero
|
||||||
// (o directorio)
|
// (o directorio)
|
||||||
snprintf(f_path, MaxPath, "%s/%s", path, entidad_dir->d_name);
|
snprintff(f_path, MaxPath, "%s/%s", path, entidad_dir->d_name);
|
||||||
fin = func(f_path, entidad_dir->d_name, data);
|
fin = func(f_path, entidad_dir->d_name, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
88
src/main.c
88
src/main.c
@@ -11,22 +11,22 @@
|
|||||||
void Help(char *exe) {
|
void Help(char *exe) {
|
||||||
char exeFilename[MaxPath];
|
char exeFilename[MaxPath];
|
||||||
File_GetName(exe, exeFilename);
|
File_GetName(exe, exeFilename);
|
||||||
printf("Usage:\n");
|
printff("Usage:\n");
|
||||||
printf(" %s info [file] {[file] {..}}\n", exeFilename);
|
printff(" %s info [file] {[file] {..}}\n", exeFilename);
|
||||||
printf(" %s scan [dir] [tree] \n", exeFilename);
|
printff(" %s scan [dir] [tree] \n", exeFilename);
|
||||||
printf(" %s rescan [dir] [tree] \n", exeFilename);
|
printff(" %s rescan [dir] [tree] \n", exeFilename);
|
||||||
printf(" %s read [file] [tree]\n", exeFilename);
|
printff(" %s read [file] [tree]\n", exeFilename);
|
||||||
printf(" %s dir [dir]\n", exeFilename);
|
printff(" %s dir [dir]\n", exeFilename);
|
||||||
printf("\n");
|
printff("\n");
|
||||||
printf(" %s sync [dirIzquierda] [dirDerecha]\n", exeFilename);
|
printff(" %s sync [dirIzquierda] [dirDerecha]\n", exeFilename);
|
||||||
printf(" %s resync [dirIzquierda] [dirDerecha]\n", exeFilename);
|
printff(" %s resync [dirIzquierda] [dirDerecha]\n", exeFilename);
|
||||||
printf(" %s synctest [dirIzquierda] [dirDerecha]\n", exeFilename);
|
printff(" %s synctest [dirIzquierda] [dirDerecha]\n", exeFilename);
|
||||||
printf(" %s resynctest [dirIzquierda] [dirDerecha]\n", exeFilename);
|
printff(" %s resynctest [dirIzquierda] [dirDerecha]\n", exeFilename);
|
||||||
printf("\n");
|
printff("\n");
|
||||||
printf(" %s copy [dirIzquierda] [dirDerecha]\n", exeFilename);
|
printff(" %s copy [dirIzquierda] [dirDerecha]\n", exeFilename);
|
||||||
printf(" %s recopy [dirIzquierda] [dirDerecha]\n", exeFilename);
|
printff(" %s recopy [dirIzquierda] [dirDerecha]\n", exeFilename);
|
||||||
printf(" %s copytest [dirIzquierda] [dirDerecha]\n", exeFilename);
|
printff(" %s copytest [dirIzquierda] [dirDerecha]\n", exeFilename);
|
||||||
printf(" %s recopytest [dirIzquierda] [dirDerecha]\n", exeFilename);
|
printff(" %s recopytest [dirIzquierda] [dirDerecha]\n", exeFilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileNode *CheckDir(char *path, int recheck);
|
FileNode *CheckDir(char *path, int recheck);
|
||||||
@@ -52,29 +52,29 @@ int main(int argc, char *argv[]) {
|
|||||||
// Scanear informacion de directorio y guardar arbol
|
// Scanear informacion de directorio y guardar arbol
|
||||||
long long tScan=Time_GetTime();
|
long long tScan=Time_GetTime();
|
||||||
FileNode *fileNode;
|
FileNode *fileNode;
|
||||||
printf("Building FileNode..\n");
|
printff("Building FileNode..\n");
|
||||||
fileNode = FileNode_Build(argv[2]);
|
fileNode = FileNode_Build(argv[2]);
|
||||||
tScan=Time_GetTime()-tScan;
|
tScan=Time_GetTime()-tScan;
|
||||||
printf("tScan: %9lldus\n",tScan);
|
printff("tScan: %9lldus\n",tScan);
|
||||||
FileNode_Save(fileNode, argv[3]);
|
FileNode_Save(fileNode, argv[3]);
|
||||||
} else if (!strcmp(argv[1], "rescan") && argc == 4) {
|
} else if (!strcmp(argv[1], "rescan") && argc == 4) {
|
||||||
// Scanear informacion de directorio y guardar arbol
|
// Scanear informacion de directorio y guardar arbol
|
||||||
FileNode *fileNode;
|
FileNode *fileNode;
|
||||||
printf("Loading FileNode..\n");
|
printff("Loading FileNode..\n");
|
||||||
fileNode = FileNode_Load(argv[3]);
|
fileNode = FileNode_Load(argv[3]);
|
||||||
if (fileNode) {
|
if (fileNode) {
|
||||||
printf("Rebuilding FileNode..\n");
|
printff("Rebuilding FileNode..\n");
|
||||||
long long tScan=Time_GetTime();
|
long long tScan=Time_GetTime();
|
||||||
fileNode = FileNode_Refresh(fileNode, argv[2]);
|
fileNode = FileNode_Refresh(fileNode, argv[2]);
|
||||||
tScan=Time_GetTime()-tScan;
|
tScan=Time_GetTime()-tScan;
|
||||||
printf("tScan: %9lldus\n",tScan);
|
printff("tScan: %9lldus\n",tScan);
|
||||||
FileNode_Save(fileNode, argv[3]);
|
FileNode_Save(fileNode, argv[3]);
|
||||||
}else{
|
}else{
|
||||||
printf("Building FileNode..\n");
|
printff("Building FileNode..\n");
|
||||||
long long tScan=Time_GetTime();
|
long long tScan=Time_GetTime();
|
||||||
fileNode = FileNode_Build(argv[2]);
|
fileNode = FileNode_Build(argv[2]);
|
||||||
tScan=Time_GetTime()-tScan;
|
tScan=Time_GetTime()-tScan;
|
||||||
printf("tScan: %9lldus\n",tScan);
|
printff("tScan: %9lldus\n",tScan);
|
||||||
FileNode_Save(fileNode, argv[3]);
|
FileNode_Save(fileNode, argv[3]);
|
||||||
}
|
}
|
||||||
} else if (!strcmp(argv[1], "read") && argc == 3) {
|
} else if (!strcmp(argv[1], "read") && argc == 3) {
|
||||||
@@ -128,7 +128,7 @@ FileNode *CheckDir(char *path, int recheck) {
|
|||||||
// Comprobar directorio
|
// Comprobar directorio
|
||||||
snprintf(dirNodesFile, MaxPath, "%s/"FileNode_Filename, path);
|
snprintf(dirNodesFile, MaxPath, "%s/"FileNode_Filename, path);
|
||||||
if (recheck) {
|
if (recheck) {
|
||||||
printf("Checking Directory.. %s\n", path);
|
printff("Checking Directory.. %s\n", path);
|
||||||
long long tScan=Time_GetTime();
|
long long tScan=Time_GetTime();
|
||||||
fileNode = FileNode_Load(dirNodesFile);
|
fileNode = FileNode_Load(dirNodesFile);
|
||||||
if (fileNode) {
|
if (fileNode) {
|
||||||
@@ -137,13 +137,13 @@ FileNode *CheckDir(char *path, int recheck) {
|
|||||||
fileNode = FileNode_Build(path);
|
fileNode = FileNode_Build(path);
|
||||||
}
|
}
|
||||||
tScan=Time_GetTime()-tScan;
|
tScan=Time_GetTime()-tScan;
|
||||||
printf("tScan: %9lldus\n",tScan);
|
printff("tScan: %9lldus\n",tScan);
|
||||||
FileNode_Save(fileNode, dirNodesFile);
|
FileNode_Save(fileNode, dirNodesFile);
|
||||||
} else {
|
} else {
|
||||||
printf("Loading Directory.. %s\n", path);
|
printff("Loading Directory.. %s\n", path);
|
||||||
fileNode = FileNode_Load(dirNodesFile);
|
fileNode = FileNode_Load(dirNodesFile);
|
||||||
if (!fileNode) {
|
if (!fileNode) {
|
||||||
printf("Error, no nodesFile.fs\n");
|
printff("Error, no nodesFile.fs\n");
|
||||||
return NULL ;
|
return NULL ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -153,17 +153,17 @@ FileNode *CheckDir(char *path, int recheck) {
|
|||||||
void PrintStatistics(AccionFileNode *actionFileNode) {
|
void PrintStatistics(AccionFileNode *actionFileNode) {
|
||||||
ActionQueueStatistics statistics;
|
ActionQueueStatistics statistics;
|
||||||
AccionFileNode_Statistics(actionFileNode, &statistics);
|
AccionFileNode_Statistics(actionFileNode, &statistics);
|
||||||
printf("Statistics\n");
|
printff("Statistics\n");
|
||||||
printf(" % 12s % 12s % 12s\n", "Read", "Write", "Delete");
|
printff(" % 12s % 12s % 12s\n", "Read", "Write", "Delete");
|
||||||
printf("Left : % 12lld % 12lld % 12lld\n", statistics.readLeft,
|
printff("Left : % 12lld % 12lld % 12lld\n", statistics.readLeft,
|
||||||
statistics.writeLeft, statistics.deleteLeft);
|
statistics.writeLeft, statistics.deleteLeft);
|
||||||
printf("Right: % 12lld % 12lld % 12lld\n", statistics.readRight,
|
printff("Right: % 12lld % 12lld % 12lld\n", statistics.readRight,
|
||||||
statistics.writeRight, statistics.deleteRight);
|
statistics.writeRight, statistics.deleteRight);
|
||||||
printf("\n");
|
printff("\n");
|
||||||
printf("Copy count : % 10d\n", statistics.fullCopyCount);
|
printff("Copy count : % 10d\n", statistics.fullCopyCount);
|
||||||
printf("Date copy count: % 10d\n", statistics.dateCopyCount);
|
printff("Date copy count: % 10d\n", statistics.dateCopyCount);
|
||||||
printf("Directory count: % 10d\n", statistics.directoryCount);
|
printff("Directory count: % 10d\n", statistics.directoryCount);
|
||||||
printf("Delete count : % 10d\n", statistics.deleteCount);
|
printff("Delete count : % 10d\n", statistics.deleteCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Sync(char *pathLeft, char *pathRight, int recheck, int dryRun) {
|
int Sync(char *pathLeft, char *pathRight, int recheck, int dryRun) {
|
||||||
@@ -171,11 +171,11 @@ int Sync(char *pathLeft, char *pathRight, int recheck, int dryRun) {
|
|||||||
|
|
||||||
// Comprobar y cargar directorios
|
// Comprobar y cargar directorios
|
||||||
if (!File_ExistsPath(pathLeft) || !File_IsDirectory(pathLeft)) {
|
if (!File_ExistsPath(pathLeft) || !File_IsDirectory(pathLeft)) {
|
||||||
printf("Error, directory does not exist: %s\n", pathLeft);
|
printff("Error, directory does not exist: %s\n", pathLeft);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!File_ExistsPath(pathRight) || !File_IsDirectory(pathRight)) {
|
if (!File_ExistsPath(pathRight) || !File_IsDirectory(pathRight)) {
|
||||||
printf("Error, directory does not exist: %s\n", pathRight);
|
printff("Error, directory does not exist: %s\n", pathRight);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
fileNodeLeft = CheckDir(pathLeft, recheck);
|
fileNodeLeft = CheckDir(pathLeft, recheck);
|
||||||
@@ -189,11 +189,11 @@ int Sync(char *pathLeft, char *pathRight, int recheck, int dryRun) {
|
|||||||
|
|
||||||
// Construir acciones
|
// Construir acciones
|
||||||
long long tBuild=Time_GetTime();
|
long long tBuild=Time_GetTime();
|
||||||
printf("Building action list.. \n");
|
printff("Building action list.. \n");
|
||||||
AccionFileNode *actionFileNode = NULL;
|
AccionFileNode *actionFileNode = NULL;
|
||||||
actionFileNode = AccionFileNode_BuildSync(fileNodeLeft, fileNodeRight);
|
actionFileNode = AccionFileNode_BuildSync(fileNodeLeft, fileNodeRight);
|
||||||
tBuild=Time_GetTime()-tBuild;
|
tBuild=Time_GetTime()-tBuild;
|
||||||
printf("tBuild: %9lldus\n",tBuild);
|
printff("tBuild: %9lldus\n",tBuild);
|
||||||
|
|
||||||
if (dryRun) {
|
if (dryRun) {
|
||||||
// Mostrar lista de acciones
|
// Mostrar lista de acciones
|
||||||
@@ -212,11 +212,11 @@ int Copy(char *pathLeft, char *pathRight, int reCheck, int dryRun) {
|
|||||||
|
|
||||||
// Comprobar y cargar directorios
|
// Comprobar y cargar directorios
|
||||||
if (!File_ExistsPath(pathLeft) || !File_IsDirectory(pathLeft)) {
|
if (!File_ExistsPath(pathLeft) || !File_IsDirectory(pathLeft)) {
|
||||||
printf("Error, directory does not exist: %s\n", pathLeft);
|
printff("Error, directory does not exist: %s\n", pathLeft);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!File_ExistsPath(pathRight) || !File_IsDirectory(pathRight)) {
|
if (!File_ExistsPath(pathRight) || !File_IsDirectory(pathRight)) {
|
||||||
printf("Error, directory does not exist: %s\n", pathRight);
|
printff("Error, directory does not exist: %s\n", pathRight);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
fileNodeLeft = CheckDir(pathLeft, reCheck);
|
fileNodeLeft = CheckDir(pathLeft, reCheck);
|
||||||
@@ -230,11 +230,11 @@ int Copy(char *pathLeft, char *pathRight, int reCheck, int dryRun) {
|
|||||||
|
|
||||||
// Construir acciones
|
// Construir acciones
|
||||||
long long tBuild=Time_GetTime();
|
long long tBuild=Time_GetTime();
|
||||||
printf("Building action list.. \n");
|
printff("Building action list.. \n");
|
||||||
AccionFileNode *actionFileNode = NULL;
|
AccionFileNode *actionFileNode = NULL;
|
||||||
actionFileNode = AccionFileNode_BuildCopy(fileNodeLeft, fileNodeRight);
|
actionFileNode = AccionFileNode_BuildCopy(fileNodeLeft, fileNodeRight);
|
||||||
tBuild=Time_GetTime()-tBuild;
|
tBuild=Time_GetTime()-tBuild;
|
||||||
printf("tBuild: %9lldus\n",tBuild);
|
printff("tBuild: %9lldus\n",tBuild);
|
||||||
|
|
||||||
if (dryRun) {
|
if (dryRun) {
|
||||||
// Mostrar lista de acciones
|
// Mostrar lista de acciones
|
||||||
|
|||||||
17
src/util.c
17
src/util.c
@@ -65,4 +65,19 @@ void Time_Pause(int pausa){
|
|||||||
tv.tv_usec=(long long)pausa%1000000;
|
tv.tv_usec=(long long)pausa%1000000;
|
||||||
select(0, NULL, NULL, NULL, &tv);
|
select(0, NULL, NULL, NULL, &tv);
|
||||||
}
|
}
|
||||||
#endif // if WIN32
|
#endif // if WIN32
|
||||||
|
|
||||||
|
|
||||||
|
int printff(char *fmt, ...){
|
||||||
|
va_list ap;
|
||||||
|
int n;
|
||||||
|
|
||||||
|
// Print
|
||||||
|
va_start(ap,fmt);
|
||||||
|
n=vprintf(fmt,ap);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
// Flush
|
||||||
|
fflush(stdout);
|
||||||
|
return(n);
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
#ifndef _UTIL_
|
#ifndef _UTIL_
|
||||||
#define _UTIL_
|
#define _UTIL_
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
char *String_Copy(char *str);
|
char *String_Copy(char *str);
|
||||||
|
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
@@ -16,4 +19,6 @@ long long Time_GetTime();
|
|||||||
// Pauses the execution for t usecs.
|
// Pauses the execution for t usecs.
|
||||||
void Time_Pause(int pausa);
|
void Time_Pause(int pausa);
|
||||||
|
|
||||||
|
int printff(char *fmt, ...);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user