[Ttssh2-commit] [5283] waitで文字列を正しく検出できない場合が有ったのを修正。

svnno****@sourc***** svnno****@sourc*****
2013年 5月 25日 (土) 12:25:19 JST


Revision: 5283
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/5283
Author:   doda
Date:     2013-05-25 12:25:19 +0900 (Sat, 25 May 2013)
Log Message:
-----------
waitで文字列を正しく検出できない場合が有ったのを修正。
http://sourceforge.jp/ticket/browse.php?group_id=1412&tid=31373

Modified Paths:
--------------
    trunk/teraterm/ttpmacro/ttmdde.c

-------------- next part --------------
Modified: trunk/teraterm/ttpmacro/ttmdde.c
===================================================================
--- trunk/teraterm/ttpmacro/ttmdde.c	2013-05-24 23:57:50 UTC (rev 5282)
+++ trunk/teraterm/ttpmacro/ttmdde.c	2013-05-25 03:25:19 UTC (rev 5283)
@@ -646,7 +646,7 @@
 int Wait()
 {
 	BYTE b;
-	int i, Found, ret;
+	int i, j, Found, ret;
 	PCHAR Str;
 
 	Found = 0;
@@ -670,10 +670,19 @@
 						WaitCount[i]++;
 					}
 					else if (WaitCount[i]>0) {
-						WaitCount[i] = 0;
-						if ((BYTE)Str[0]==b) {
-							WaitCount[i] = 1;
+						for (j=WaitCount[i]-1; j>=0; j--) {
+							if ((BYTE)Str[j] == b) {
+								if (j== 0 || strncmp(Str, Str+(WaitCount[i]-j), j)==0) {
+									break;
+								}
+							}
 						}
+						if (j >= 0) {
+							WaitCount[i] = j+1;
+						}
+						else {
+							WaitCount[i] = 0;
+						}
 					}
 					if (WaitCount[i]==WaitStrLen[i]) {
 						Found = i+1;



Ttssh2-commit メーリングリストの案内