[Ttssh2-commit] [5712] fileopen マクロコマンドに、読み取り専用でファイルを開くオプションを追加

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2014年 11月 20日 (木) 22:38:24 JST


Revision: 5712
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/5712
Author:   maya
Date:     2014-11-20 22:38:23 +0900 (Thu, 20 Nov 2014)
Log Message:
-----------
fileopen マクロコマンドに、読み取り専用でファイルを開くオプションを追加
  https://sourceforge.jp/ticket/browse.php?group_id=1412&tid=31050

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

-------------- next part --------------
Modified: trunk/teraterm/ttpmacro/ttl.c
===================================================================
--- trunk/teraterm/ttpmacro/ttl.c	2014-11-19 18:20:44 UTC (rev 5711)
+++ trunk/teraterm/ttpmacro/ttl.c	2014-11-20 13:38:23 UTC (rev 5712)
@@ -1471,13 +1471,17 @@
 {
 	WORD Err;
 	TVarId VarId;
-	int Append, FH;
+	int Append, FH, ReadonlyFlag=0;
 	TStrVal FName;
 
 	Err = 0;
 	GetIntVar(&VarId, &Err);
 	GetStrVal(FName, &Err);
 	GetIntVal(&Append, &Err);
+	// get 4nd arg(optional) if given
+	if (CheckParameterGiven()) { // readonly
+		GetIntVal(&ReadonlyFlag, &Err);
+	}
 	if ((Err==0) &&
 	    ((strlen(FName)==0) || (GetFirstChar()!=0)))
 		Err = ErrSyntax;
@@ -1487,7 +1491,13 @@
 		SetIntVal(VarId, -1);
 		return Err;
 	}
-	FH = _lopen(FName,OF_READWRITE);
+
+	if (ReadonlyFlag) {
+		FH = _lopen(FName,OF_READ);
+	}
+	else {
+		FH = _lopen(FName,OF_READWRITE);
+	}
 	if (FH<0)
 		FH = _lcreat(FName,0);
 	if (FH<0) FH = -1;



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