[Ttssh2-commit] [7929] filetruncate マクロコマンドのエラー時にマクロが一時停止しないようにした

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2019年 8月 9日 (金) 12:23:44 JST


Revision: 7929
          https://osdn.net/projects/ttssh2/scm/svn/commits/7929
Author:   maya
Date:     2019-08-09 12:23:44 +0900 (Fri, 09 Aug 2019)
Log Message:
-----------
filetruncate マクロコマンドのエラー時にマクロが一時停止しないようにした

ttssh2-devel 4036, #39452

Ticket Links:
------------
    https://osdn.net/projects/ttssh2/tracker/detail/39452

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

Added Paths:
-----------
    trunk/tests/#39452.ttl

-------------- next part --------------
Modified: trunk/doc/en/html/about/history.html
===================================================================
--- trunk/doc/en/html/about/history.html	2019-08-08 15:17:38 UTC (rev 7928)
+++ trunk/doc/en/html/about/history.html	2019-08-09 03:23:44 UTC (rev 7929)
@@ -36,6 +36,7 @@
   <li>Changes
     <ul>
       <li>MARCO: The <a href="../macro/command/fileopen.html">fileopen</a> command does not cause an error when a file can not be opened. Reverted changes in Ver 4.102.</li>
+	  <--li><a href="../macro/command/filetruncate.html">filetruncate</a> \x83}\x83N\x83\x8D\x83R\x83}\x83\x93\x83h\x82\xAA\x82Ńt\x83@\x83\x8B\x82\xAA\x8AJ\x82\xAF\x82Ȃ\xA2\x8Fꍇ\x81E\x83t\x83@\x83C\x83\x8B\x83T\x83C\x83Y\x82̕ύX\x82Ɏ\xB8\x94s\x82\xB5\x82\xBD\x8Fꍇ\x83G\x83\x89\x81[\x82ɂȂ\xE7\x82Ȃ\xA2\x82悤\x82ɂ\xB5\x82\xBD\x81B</li-->
       <li>Unspecified string font in IME uses your defined font.</li>
     </ul>
   </li>

Modified: trunk/doc/en/html/macro/command/filetruncate.html
===================================================================
--- trunk/doc/en/html/macro/command/filetruncate.html	2019-08-08 15:17:38 UTC (rev 7928)
+++ trunk/doc/en/html/macro/command/filetruncate.html	2019-08-09 03:23:44 UTC (rev 7929)
@@ -26,8 +26,9 @@
 <p>
 Changes the <size> bytes of a <filename> file.<br>
 Null characters('\0') are appended if the file is extended.<br>
-<br>
+</p>
 
+<p>
 The system variable "result" value is set to 0 if the file size is successfully changed. 
 The system variable "result" value of -1 indicates an error.
 </p>

Modified: trunk/doc/ja/html/about/history.html
===================================================================
--- trunk/doc/ja/html/about/history.html	2019-08-08 15:17:38 UTC (rev 7928)
+++ trunk/doc/ja/html/about/history.html	2019-08-09 03:23:44 UTC (rev 7929)
@@ -36,6 +36,7 @@
   <li>\x95ύX
     <ul>
       <li><a href="../macro/command/fileopen.html">fileopen</a> \x83}\x83N\x83\x8D\x83R\x83}\x83\x93\x83h\x82ŁA\x83t\x83@\x83C\x83\x8B\x82\xAA\x8AJ\x82\xAF\x82Ȃ\xA2\x8Fꍇ\x82ɃG\x83\x89\x81[\x82ɂȂ\xE7\x82Ȃ\xA2\x82悤\x82ɂ\xB5\x82\xBD\x81BVer 4.102\x82ł̕ύX\x82\xF0\x8C\xB3\x82ɖ߂\xB5\x82\xBD\x81B</li>
+	  <li><a href="../macro/command/filetruncate.html">filetruncate</a> \x83}\x83N\x83\x8D\x83R\x83}\x83\x93\x83h\x82\xAA\x82Ńt\x83@\x83\x8B\x82\xAA\x8AJ\x82\xAF\x82Ȃ\xA2\x8Fꍇ\x81E\x83t\x83@\x83C\x83\x8B\x83T\x83C\x83Y\x82̕ύX\x82Ɏ\xB8\x94s\x82\xB5\x82\xBD\x8Fꍇ\x83G\x83\x89\x81[\x82ɂȂ\xE7\x82Ȃ\xA2\x82悤\x82ɂ\xB5\x82\xBD\x81B</li>
       <li>IME\x82̖\xA2\x8Am\x92蕶\x8E\x9A\x82̃t\x83H\x83\x93\x83g\x82\xAA\x8Ew\x92\xE8\x83t\x83H\x83\x93\x83g\x82Ɠ\xAF\x88\xEA\x82ɂȂ\xE9\x82悤\x82ɂ\xB5\x82\xBD\x81B</li>
     </ul>
   </li>

Modified: trunk/doc/ja/html/macro/command/filetruncate.html
===================================================================
--- trunk/doc/ja/html/macro/command/filetruncate.html	2019-08-08 15:17:38 UTC (rev 7928)
+++ trunk/doc/ja/html/macro/command/filetruncate.html	2019-08-09 03:23:44 UTC (rev 7929)
@@ -25,10 +25,12 @@
 
 <p>
 \x83t\x83@\x83C\x83\x8B <filename> \x82\xF0\x83T\x83C\x83Y <size> \x83o\x83C\x83g\x82̑傫\x82\xB3\x82ɕύX\x82\xB7\x82\xE9\x81B<br>
-\x8Ew\x92肵\x82\xBD\x83T\x83C\x83Y\x82\xAA\x81A\x8A\xF9\x91\xB6\x82̑傫\x82\xB3\x82𒴂\xA6\x82\xBD\x8Fꍇ\x81A\x83k\x83\x8B\x95\xB6\x8E\x9A('\0')\x82\xAA\x92lj\xC1\x82\xB3\x82\xEA\x82\xE9\x81B<br>
-<br>
+\x8Ew\x92肵\x82\xBD\x83T\x83C\x83Y\x82\xAA\x81A\x8A\xF9\x91\xB6\x82̑傫\x82\xB3\x82𒴂\xA6\x82\xBD\x8Fꍇ\x81A\x83k\x83\x8B\x95\xB6\x8E\x9A('\0')\x82\xAA\x92lj\xC1\x82\xB3\x82\xEA\x82\xE9\x81B
+</p>
 
-\x83T\x83C\x83Y\x95ύX\x82ɐ\xAC\x8C\x{1C2D42}\xBD\x8Fꍇ\x82́A\x83V\x83X\x83e\x83\x80\x95ϐ\x94 result \x82\xC9 0 \x82\xAA\x8Ai\x94[\x82\xB3\x82\xEA\x82\xE9\x81B\x8E\xB8\x94s\x82\xB5\x82\xBD\x8Fꍇ\x82\xCD -1 \x82\xAA\x8Ai\x94[\x82\xB3\x82\xEA\x82\xE9\x81B
+<p>
+\x83T\x83C\x83Y\x95ύX\x82ɐ\xAC\x8C\x{1C2D42}\xBD\x8Fꍇ\x82́A\x83V\x83X\x83e\x83\x80\x95ϐ\x94 result \x82\xC9 0 \x82\xAA\x8Ai\x94[\x82\xB3\x82\xEA\x82\xE9\x81B
+\x8E\xB8\x94s\x82\xB5\x82\xBD\x8Fꍇ\x82\xCD -1 \x82\xAA\x8Ai\x94[\x82\xB3\x82\xEA\x82\xE9\x81B
 </p>
 
 <h2>\x97\xE1</h2>

Modified: trunk/teraterm/ttpmacro/ttl.c
===================================================================
--- trunk/teraterm/ttpmacro/ttl.c	2019-08-08 15:17:38 UTC (rev 7928)
+++ trunk/teraterm/ttpmacro/ttl.c	2019-08-09 03:23:44 UTC (rev 7929)
@@ -2096,16 +2096,14 @@
 	}
 
 	// \x83t\x83@\x83C\x83\x8B\x82\xF0\x8Ew\x92肵\x82\xBD\x83T\x83C\x83Y\x82Ő؂\xE8\x8Bl\x82߂\xE9\x81B
-   ret = _sopen_s( &fh, FName, _O_RDWR | _O_CREAT, _SH_DENYNO, _S_IREAD | _S_IWRITE );
-   if (ret != 0) {
-		Err = ErrCantOpen;
+	ret = _sopen_s( &fh, FName, _O_RDWR | _O_CREAT, _SH_DENYNO, _S_IREAD | _S_IWRITE );
+	if (ret != 0) {
 		goto end;
-   }
-   ret = _chsize_s(fh, TruncByte);
-   if (ret != 0) {
-		Err = ErrInvalidCtl;
+	}
+	ret = _chsize_s(fh, TruncByte);
+	if (ret != 0) {
 		goto end;
-   }
+	}
 
 	result = 0;
 	Err = 0;

Added: trunk/tests/#39452.ttl
===================================================================
--- trunk/tests/#39452.ttl	                        (rev 0)
+++ trunk/tests/#39452.ttl	2019-08-09 03:23:44 UTC (rev 7929)
@@ -0,0 +1,21 @@
+filetruncate '#39452-1:.txt'
+messagebox result 'invalid file name'
+
+filetruncate '#39452-1.txt' 'string'
+messagebox result 'invalid file size'
+
+; file is not exist
+filetruncate '#39452-1.txt' 10
+messagebox result 'success'
+
+; invalid file path
+filetruncate 'aa:\#39452-1.txt' 10
+messagebox result 'invalid file path'
+
+; file is exist but cannot open with write mode
+filecreate fp '#39452-1.txt'
+filetruncate '#39452-1.txt' 10
+messagebox result 'cannot open with write mode'
+fileclose fp
+
+filedelete '#39452-1.txt'


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