• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

oga's tools


Commit MetaInfo

Revision7160fb807d19f73e7f2432beacf9d19218a7e950 (tree)
Zeit2014-06-08 06:52:09
Autoroga <hyperoga@gmai...>
Commiteroga

Log Message

Merge branch 'master' of git.pf.sourceforge.jp:/gitroot/h/hy/hyperoga/ogatool

Ändern Zusammenfassung

Diff

--- a/dsync.c
+++ b/dsync.c
@@ -24,6 +24,7 @@
2424 * V1.19 11/12/06 change default r/w buffer size for perf and support -b
2525 * V1.20 11/12/09 support -ca compare all file for -t(test mode)
2626 * V1.21 14/01/15 support -nr
27+ * V1.22 14/05/31 change file compare method
2728 *
2829 * Known Bug
2930 * 07/04/31 Long UNC(upper 256) => app error (WinNT stat() unsupport?)
@@ -54,7 +55,7 @@
5455 #include <utime.h>
5556 #endif /* _WIN32 */
5657
57-#define VER "1.21"
58+#define VER "1.22"
5859
5960 #define dprintf if (vf) printf
6061 #define dprintf2 if (vf >= 2) printf
@@ -677,6 +678,8 @@ int DirCheckDelete(char *d1, char *d2)
677678 * IN : fname1, fname2 compare files
678679 * OUT : ret 0: same file
679680 * 1: different file
681+ * 2: fname1(src) not exist
682+ * 3: fname2(dst) not exist
680683 *
681684 */
682685 int Cmp(char *fname1, char *fname2)
@@ -691,12 +694,12 @@ int Cmp(char *fname1, char *fname2)
691694
692695 if (!(fp1 = fopen(fname1,"rb"))) {
693696 if (errno != ENOENT) perror(fname1);
694- return 1;
697+ return 2;
695698 }
696699 if (!(fp2 = fopen(fname2,"rb"))) {
697700 if (errno != ENOENT) perror(fname2);
698701 fclose(fp1);
699- return 1;
702+ return 3;
700703 }
701704 while (1) {
702705 c1 = getc(fp1);
@@ -746,6 +749,7 @@ int DirCopy(char *d1, char *d2)
746749 char buf[2048];
747750 char wkd1[512],wkd2[512];
748751 time_t time1,time2;
752+ int cmp; /* V1.22-A */
749753
750754 dprintf2("## dir1=[%s], dir2=[%s]\n",d1,d2);
751755
@@ -856,11 +860,17 @@ int DirCopy(char *d1, char *d2)
856860
857861 /* V1.18-A V1.20-C start */
858862 if (cf || caf) {
859- if (!Cmp(wkd1, wkd2)) {
860- strcpy(wkmsg, " (same)\n");
861- } else {
862- strcpy(wkmsg, " (different)\n"); /* V1.20-A */
863- }
863+ cmp = Cmp(wkd1, wkd2); /* V1.22-A */
864+ if (cmp == 0) { /* V1.22-C */
865+ /* コピー対象のものはsameでも表示する */
866+ strcpy(wkmsg, " (same)");
867+ } else if (cmp == 1) { /* V1.22-A */
868+ strcpy(wkmsg, " (different)"); /* V1.20-A */
869+ } else if (cmp == 2) { /* V1.22-A */
870+ strcpy(wkmsg, " (src not exist)"); /* V1.20-A */
871+ } else if (cmp == 3) { /* V1.22-A */
872+ strcpy(wkmsg, " (dst not exist)"); /* V1.20-A */
873+ }
864874 }
865875 fprintf(logfp, "## TEST: Copy %s to %s%s\n", wkd1, wkd2, wkmsg);
866876 /* V1.18-A V1.20-C end */
@@ -873,9 +883,16 @@ int DirCopy(char *d1, char *d2)
873883 fprintf(logfp, "## %s copy skipped.\n", wkd1);
874884 }
875885 } else if (tf && caf && (stbuf.st_mode & S_IFREG)) {
876- if (Cmp(wkd1, wkd2)) {
877- fprintf(logfp, "## TEST: %s and %s is different.\n", wkd1, wkd2); /* V1.20-A */
886+ if (cmp = Cmp(wkd1, wkd2)) { /* V1.22-C */
887+ if (cmp == 2) { /* V1.22-C */
888+ fprintf(logfp, "## TEST: %s does not exist.\n", wkd1); /* V1.22-C */
889+ } else if (cmp == 3) { /* V1.22-C */
890+ fprintf(logfp, "## TEST: %s does not exist.\n", wkd2);
891+ } else { /* V1.22-C */
892+ fprintf(logfp, "## TEST: %s and %s is different.\n", wkd1, wkd2); /* V1.20-A */
893+ } /* V1.22-C */
878894 } else {
895+ /* ファイルが同じ場合は-vの場合のみ出力する */
879896 if (vf) fprintf(logfp, "## TEST: %s and %s is same.\n", wkd1, wkd2); /* V1.20-A */
880897 }
881898 }