[Ttssh2-commit] [3343] ノーウェイトモード (/ttyplay-nowait) を新設。

svnno****@sourc***** svnno****@sourc*****
2009年 4月 23日 (木) 12:47:44 JST


Revision: 3343
          http://svn.sourceforge.jp/view?root=ttssh2&view=rev&rev=3343
Author:   doda
Date:     2009-04-23 12:47:43 +0900 (Thu, 23 Apr 2009)

Log Message:
-----------
ノーウェイトモード(/ttyplay-nowait)を新設。

Modified Paths:
--------------
    trunk/TTXSamples/TTXttyrec/TTXttyplay.c


-------------- next part --------------
Modified: trunk/TTXSamples/TTXttyrec/TTXttyplay.c
===================================================================
--- trunk/TTXSamples/TTXttyrec/TTXttyplay.c	2009-04-22 15:11:57 UTC (rev 3342)
+++ trunk/TTXSamples/TTXttyrec/TTXttyplay.c	2009-04-23 03:47:43 UTC (rev 3343)
@@ -47,6 +47,7 @@
 	int maxwait;
 	int speed;
 	BOOL pause;
+	BOOL nowait;
 	struct timeval last;
 	struct timeval wait;
 	char openfn[MAX_PATH];
@@ -110,6 +111,7 @@
 	pvar->wait.tv_sec = 0;
 	pvar->wait.tv_usec = 1;
 	pvar->pause = FALSE;
+	pvar->nowait = FALSE;
 }
 
 void RestoreTitle() {
@@ -186,10 +188,12 @@
 		prh = h;
 	}
 
-	gettimeofday(&curtime, NULL);
+	if (!pvar->nowait) {
+		gettimeofday(&curtime, NULL);
+		tdiff = tvdiff(pvar->last, curtime);
+	}
 
-	tdiff = tvdiff(pvar->last, curtime);
-	if (tdiff.tv_sec > pvar->wait.tv_sec ||
+	if (pvar->nowait || tdiff.tv_sec > pvar->wait.tv_sec ||
 	  (tdiff.tv_sec == pvar->wait.tv_sec && tdiff.tv_usec >= pvar->wait.tv_usec)) {
 		if (title_changed) {
 			RestoreTitle();
@@ -370,7 +374,10 @@
 
 	next = Param;
 	while (next = GetParam(buff, sizeof(buff), next)) {
-		if (_strnicmp(buff, "/TTYPLAY", 9) == 0 || _strnicmp(buff, "/TP", 4) == 0) {
+		if (_strnicmp(buff, "/ttyplay-nowait", 16) == 0 || _strnicmp(buff, "/tpnw", 6) == 0) {
+			pvar->nowait = TRUE;
+		}
+		else if (_strnicmp(buff, "/TTYPLAY", 9) == 0 || _strnicmp(buff, "/TP", 4) == 0) {
 			pvar->enable = TRUE;
 		}
 	}



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