[Ttssh2-commit] [3581] strscanが正しく働かない場合があるのを修正。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 7月 6日 (月) 12:23:54 JST


Revision: 3581
          http://sourceforge.jp/projects/ttssh2/svn/view?view=rev&revision=3581
Author:   doda
Date:     2009-07-06 12:23:54 +0900 (Mon, 06 Jul 2009)

Log Message:
-----------
strscanが正しく働かない場合があるのを修正。
ただし、まだ strscan "一覧表D" "\D" がマッチしたりする。

http://sourceforge.jp/ticket/browse.php?group_id=1412&tid=17613

Modified Paths:
--------------
    trunk/doc/en/html/about/history.html
    trunk/doc/ja/html/about/history.html
    trunk/teraterm/ttpmacro/ttl.c


-------------- next part --------------
Modified: trunk/doc/en/html/about/history.html
===================================================================
--- trunk/doc/en/html/about/history.html	2009-07-06 03:10:47 UTC (rev 3580)
+++ trunk/doc/en/html/about/history.html	2009-07-06 03:23:54 UTC (rev 3581)
@@ -41,6 +41,7 @@
     <ul>
       <!--li>Ú‘±‘O‚ɍs‚Á‚½ƒ[ƒJƒ‹ƒGƒR[‚Æ‘—M‰üsƒR[ƒh‚̐ݒ肪–³Ž‹‚³‚ê‚鎖‚ª‚ ‚é‚Ì‚ðC³‚µ‚½B</li-->
       <!--li>ƒVƒŠƒAƒ‹Ú‘±Žž‚ɁA‘O‚̐ڑ±‚ÅŽg‚í‚ꂽTCPLocalEcho/TCPCRSend‚̐ݒ肪ƒŠƒZƒbƒg‚³‚ê‚È‚¢‚Ì‚ðC³‚µ‚½B</li-->
+      <li>Bug fix: <a href="../macro/command/strscan.html">strscan</a> macro command does not work correctly. </li>
     </ul>
   </li>
 

Modified: trunk/doc/ja/html/about/history.html
===================================================================
--- trunk/doc/ja/html/about/history.html	2009-07-06 03:10:47 UTC (rev 3580)
+++ trunk/doc/ja/html/about/history.html	2009-07-06 03:23:54 UTC (rev 3581)
@@ -41,6 +41,7 @@
     <ul>
       <li>Ú‘±‘O‚ɍs‚Á‚½ƒ[ƒJƒ‹ƒGƒR[‚Æ‘—M‰üsƒR[ƒh‚̐ݒ肪–³Ž‹‚³‚ê‚鎖‚ª‚ ‚é‚Ì‚ðC³‚µ‚½B</li>
       <li>ƒVƒŠƒAƒ‹Ú‘±Žž‚ɁA‘O‚̐ڑ±‚ÅŽg‚í‚ꂽTCPLocalEcho/TCPCRSend‚̐ݒ肪ƒŠƒZƒbƒg‚³‚ê‚È‚¢‚Ì‚ðC³‚µ‚½B<li-->
+      <li>ƒ}ƒNƒƒRƒ}ƒ“ƒh "<a href="../macro/command/strscan.html">strscan</a>" ‚ª³‚µ‚­“­‚©‚È‚¢ê‡‚ª‚ ‚é‚Ì‚ðC³‚µ‚½B</li>
     </ul>
   </li>
 

Modified: trunk/teraterm/ttpmacro/ttl.c
===================================================================
--- trunk/teraterm/ttpmacro/ttl.c	2009-07-06 03:10:47 UTC (rev 3580)
+++ trunk/teraterm/ttpmacro/ttl.c	2009-07-06 03:23:54 UTC (rev 3581)
@@ -3159,8 +3159,8 @@
 WORD TTLStrScan()
 {
 	WORD Err;
-	int Len1, Len2, i, j;
 	TStrVal Str1, Str2;
+	char *p;
 
 	Err = 0;
 	GetStrVal(Str1,&Err);
@@ -3169,31 +3169,17 @@
 		Err = ErrSyntax;
 	if (Err!=0) return Err;
 
-	Len1 = strlen(Str1);
-	Len2 = strlen(Str2);
-	if ((Len1==0) || (Len2==0))
-	{
+	if ((Str1[0] == 0) || (Str2[0] == 0)) {
 		SetResult(0);
 		return Err;
 	}
 
-	i = 0;
-	j = 0;
-	do {
-		if (Str1[i]==Str2[j])
-		{
-			j++;
-			i++;
-		}
-		else if (j==0)
-			i++;
-		else
-			j = 0;
-	} while ((i<Len1) && (j<Len2));
-	if (j==Len2)
-		SetResult(i-Len2+1);
-	else
+	if ((p = strstr(Str1, Str2)) != NULL) {
+		SetResult(p - Str1 + 1);
+	}
+	else {
 		SetResult(0);
+	}
 	return Err;
 }
 



Ttssh2-commit メーリングリストの案内
Back to archive index