[Ttssh2-commit] [4959] setpassword, ispassword マクロコマンドを追加した。

svnno****@sourc***** svnno****@sourc*****
2012年 6月 1日 (金) 00:45:32 JST


Revision: 4959
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/4959
Author:   yutakapon
Date:     2012-06-01 00:45:32 +0900 (Fri, 01 Jun 2012)
Log Message:
-----------
setpassword, ispassword マクロコマンドを追加した。

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

Modified Paths:
--------------
    trunk/doc/en/html/about/history.html
    trunk/doc/en/html/macro/command/index.html
    trunk/doc/en/teraterm.hhc
    trunk/doc/en/teraterm.hhp
    trunk/doc/ja/html/about/history.html
    trunk/doc/ja/html/macro/command/index.html
    trunk/doc/ja/teraterm.hhc
    trunk/doc/ja/teraterm.hhp
    trunk/teraterm/common/helpid.h
    trunk/teraterm/ttpmacro/ttl.c
    trunk/teraterm/ttpmacro/ttmparse.c
    trunk/teraterm/ttpmacro/ttmparse.h

Added Paths:
-----------
    trunk/doc/en/html/macro/command/ispassword.html
    trunk/doc/en/html/macro/command/setpassword.html
    trunk/doc/ja/html/macro/command/ispassword.html
    trunk/doc/ja/html/macro/command/setpassword.html

-------------- next part --------------
Modified: trunk/doc/en/html/about/history.html
===================================================================
--- trunk/doc/en/html/about/history.html	2012-05-31 14:26:45 UTC (rev 4958)
+++ trunk/doc/en/html/about/history.html	2012-05-31 15:45:32 UTC (rev 4959)
@@ -31,6 +31,35 @@
 
 <h2><a name="teraterm">Tera Term</a></h2>
 
+
+<h3><a name="teraterm_4.75">2012.xx.xx (Ver 4.75 not released yet)</a></h3>
+<ul class="history">
+  <li>Changes
+    <ul>
+      <li></li>
+    </ul>
+  </li>
+
+  <li>Bug fixes
+    <ul>
+      <li></li>
+    </ul>
+  </li>
+
+  <li>Misc
+    <ul>
+      <li></li>
+      <li>Macro
+        <ul>
+          <li>added the <a href="../macro/command/setpassword.html">setpassword</a> command.</li>
+          <li>added the <a href="../macro/command/ispassword.html">ispassword</a> command.</li>
+        </ul></li>
+    </ul>
+  </li>
+</ul>
+
+
+
 <h3><a name="teraterm_4.74">2012.05.31 (Ver 4.74)</a></h3>
 <ul class="history">
   <li>Changes

Modified: trunk/doc/en/html/macro/command/index.html
===================================================================
--- trunk/doc/en/html/macro/command/index.html	2012-05-31 14:26:45 UTC (rev 4958)
+++ trunk/doc/en/html/macro/command/index.html	2012-05-31 15:45:32 UTC (rev 4959)
@@ -173,7 +173,9 @@
 <ul>
  <li><a href="delpassword.html">delpassword</a>
  <li><a href="getpassword.html">getpassword</a>
+ <li><a href="ispassword.html">ispassword</a> (version 4.75 or later)
  <li><a href="passwordbox.html">passwordbox</a>
+ <li><a href="setpassword.html">setpassword</a> (version 4.75 or later)
 </ul>
 
 

Added: trunk/doc/en/html/macro/command/ispassword.html
===================================================================
--- trunk/doc/en/html/macro/command/ispassword.html	                        (rev 0)
+++ trunk/doc/en/html/macro/command/ispassword.html	2012-05-31 15:45:32 UTC (rev 4959)
@@ -0,0 +1,65 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+  "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+  <title>ispassword</title>
+  <meta http-equiv="Content-Style-Type" content="text/css">
+  <link rel="stylesheet" href="../../style.css" type="text/css">
+</head>
+
+<body>
+
+
+<h1>ispassword</h1>
+
+<p>
+Determines if a password is stored.
+</p>
+
+<h2>Format</h2>
+
+<pre class="macro-syntax">
+ispassword &lt;filename&gt; &lt;password name&gt;
+</pre>
+
+<h2>Remarks</h2>
+
+<p>
+A password identified by &lt;password name&gt; from the password file &lt;filename&gt; is determinted if the password is stored in the file.<br>
+</p>
+
+<p>
+When a password identified by &lt;password name&gt; exists in the password file, the system variable "result" is set to 1. Otherwise, "result" is set to 0.
+</p>
+
+<h2>Example</h2>
+
+<pre class="macro-example">
+strdim pw 2
+username = 'yutaka'
+
+<strong>ispassword</strong> 'pw.dat' username ; result: 0=false; 1=true
+if result = 1 then
+  getpassword 'pw.dat' username pw[0]
+  pw[1] = pw[0]
+else
+  msg = 'What is your password for '
+  strconcat msg username
+  strconcat msg '?'
+  passwordbox msg 'Enter your password'
+  pw[0] = inputstr
+  pw[1] = pw[0]
+  setpassword 'pw.dat' username pw[0]
+endif
+</pre>
+
+<h2>See also</h2>
+
+<ul>
+ <li>"<a href="getpassword.html">getpassword</a>"</li>
+ <li>"<a href="setpassword.html">setpassword</a>"</li>
+</ul>
+
+</BODY>
+</HTML>

Added: trunk/doc/en/html/macro/command/setpassword.html
===================================================================
--- trunk/doc/en/html/macro/command/setpassword.html	                        (rev 0)
+++ trunk/doc/en/html/macro/command/setpassword.html	2012-05-31 15:45:32 UTC (rev 4959)
@@ -0,0 +1,64 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+  "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+  <title>setpassword</title>
+  <meta http-equiv="Content-Style-Type" content="text/css">
+  <link rel="stylesheet" href="../../style.css" type="text/css">
+</head>
+
+<body>
+
+
+<h1>setpassword</h1>
+
+<p>
+Adds or Overwrites a password.
+</p>
+
+<h2>Format</h2>
+
+<pre class="macro-syntax">
+setpassword &lt;filename&gt; &lt;password name&gt; &lt;strvar&gt;
+</pre>
+
+<h2>Remarks</h2>
+
+<p>
+A password identified by &lt;password name&gt; from the password file &lt;filename&gt; is updated.<br>
+The string variable &lt;strvar&gt; 's passowrd is encrypted and stored into the file.
+</p>
+
+<p>
+If the specified file does not exist, it is newly created.<br>
+</p>
+
+<p>
+A password file can contain multiple passwords.<br>
+Each of them is identified by the password identifier.
+</p>
+
+<p>
+When the password file can not be written, the system variable "result" is set to 0. Otherwise, "result" is set to 1.
+</p>
+
+<h2>Example</h2>
+
+<pre class="macro-example">
+newpasswd = 'hoge'
+<strong>setpassword</strong> 'password.dat' 'yutaka' newpasswd
+if result then
+  messagebox 'Password updated successfully.' 'Result'
+endif
+</pre>
+
+<h2>See also</h2>
+
+<ul>
+ <li>"<a href="getpassword.html">getpassword</a>"</li>
+ <li>"<a href="ispassword.html">ispassword</a>"</li>
+</ul>
+
+</BODY>
+</HTML>

Modified: trunk/doc/en/teraterm.hhc
===================================================================
--- trunk/doc/en/teraterm.hhc	2012-05-31 14:26:45 UTC (rev 4958)
+++ trunk/doc/en/teraterm.hhc	2012-05-31 15:45:32 UTC (rev 4959)
@@ -1311,10 +1311,20 @@
 					<param name="ImageNumber" value="11">
 					</OBJECT>
 				<LI> <OBJECT type="text/sitemap">
+					<param name="Name" value="ispassword">
+					<param name="Local" value="html\macro\command\ispassword.html">
+					<param name="ImageNumber" value="11">
+					</OBJECT>
+				<LI> <OBJECT type="text/sitemap">
 					<param name="Name" value="passwordbox">
 					<param name="Local" value="html\macro\command\passwordbox.html">
 					<param name="ImageNumber" value="11">
 					</OBJECT>
+				<LI> <OBJECT type="text/sitemap">
+					<param name="Name" value="setpassword">
+					<param name="Local" value="html\macro\command\setpassword.html">
+					<param name="ImageNumber" value="11">
+					</OBJECT>
 			</UL>
 			<LI> <OBJECT type="text/sitemap">
 				<param name="Name" value="Miscellaneous commands">

Modified: trunk/doc/en/teraterm.hhp
===================================================================
--- trunk/doc/en/teraterm.hhp	2012-05-31 14:26:45 UTC (rev 4958)
+++ trunk/doc/en/teraterm.hhp	2012-05-31 15:45:32 UTC (rev 4959)
@@ -227,6 +227,7 @@
 HlpMacroCommandInputbox=html\macro\command\inputbox.html
 HlpMacroCommandInt2str=html\macro\command\int2str.html
 HlpMacroCommandIntdim=html\macro\command\intdim.html
+HlpMacroCommandIsPassword=html\macro\command\ispassword.html
 HlpMacroCommandKmtfinish=html\macro\command\kmtfinish.html
 HlpMacroCommandKmtget=html\macro\command\kmtget.html
 HlpMacroCommandKmtrecv=html\macro\command\kmtrecv.html
@@ -262,6 +263,7 @@
 HlpMacroCommandSendln=html\macro\command\sendln.html
 HlpMacroCommandSendlnbroadcast=html\macro\command\sendlnbroadcast.html
 HlpMacroCommandSendmulticast=html\macro\command\sendmulticast.html
+HlpMacroCommandSetPassword=html\macro\command\setpassword.html
 HlpMacroCommandSetdate=html\macro\command\setdate.html
 HlpMacroCommandSetdir=html\macro\command\setdir.html
 HlpMacroCommandSetdlgpos=html\macro\command\setdlgpos.html

Modified: trunk/doc/ja/html/about/history.html
===================================================================
--- trunk/doc/ja/html/about/history.html	2012-05-31 14:26:45 UTC (rev 4958)
+++ trunk/doc/ja/html/about/history.html	2012-05-31 15:45:32 UTC (rev 4959)
@@ -31,6 +31,33 @@
 
 <h2><a name="teraterm">Tera Term</a></h2>
 
+<h3><a name="teraterm_4.75">2012.xx.xx (Ver 4.75 not released yet)</a></h3>
+<ul class="history">
+  <li>\x95ύX
+    <ul>
+      <li></li>
+    </ul>
+  </li>
+
+  <li>\x83o\x83O\x8FC\x90\xB3
+    <ul>
+      <li></li>
+    </ul>
+  </li>
+
+  <li>\x82\xBB\x82̑\xBC
+    <ul>
+      <li></li>
+      <li>\x83}\x83N\x83\x8D
+        <ul>
+          <li><a href="../macro/command/setpassword.html">setpassword</a>\x83R\x83}\x83\x93\x83h\x82\xF0\x92lj\xC1\x82\xB5\x82\xBD\x81B</li>
+          <li><a href="../macro/command/ispassword.html">ispassword</a>\x83R\x83}\x83\x93\x83h\x82\xF0\x92lj\xC1\x82\xB5\x82\xBD\x81B</li>
+        </ul></li>
+    </ul>
+  </li>
+</ul>
+
+
 <h3><a name="teraterm_4.74">2012.05.31 (Ver 4.74)</a></h3>
 <ul class="history">
   <li>\x95ύX

Modified: trunk/doc/ja/html/macro/command/index.html
===================================================================
--- trunk/doc/ja/html/macro/command/index.html	2012-05-31 14:26:45 UTC (rev 4958)
+++ trunk/doc/ja/html/macro/command/index.html	2012-05-31 15:45:32 UTC (rev 4959)
@@ -173,7 +173,9 @@
 <ul>
  <li><a href="delpassword.html">delpassword</a>
  <li><a href="getpassword.html">getpassword</a>
+ <li><a href="ispassword.html">ispassword</a> (\x83o\x81[\x83W\x83\x87\x83\x934.75\x88ȍ~)
  <li><a href="passwordbox.html">passwordbox</a>
+ <li><a href="setpassword.html">setpassword</a> (\x83o\x81[\x83W\x83\x87\x83\x934.75\x88ȍ~)
 </ul>
 
 

Added: trunk/doc/ja/html/macro/command/ispassword.html
===================================================================
--- trunk/doc/ja/html/macro/command/ispassword.html	                        (rev 0)
+++ trunk/doc/ja/html/macro/command/ispassword.html	2012-05-31 15:45:32 UTC (rev 4959)
@@ -0,0 +1,65 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+  "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
+  <title>ispassword</title>
+  <meta http-equiv="Content-Style-Type" content="text/css">
+  <link rel="stylesheet" href="../../style.css" type="text/css">
+</head>
+
+<body>
+
+
+<h1>ispassword</h1>
+
+<p>
+\x83p\x83X\x83\x8F\x81[\x83h\x82\xAA\x90ݒ肳\x82\xEA\x82Ă\xA2\x82邩\x82𔻕ʂ\xB7\x82\xE9\x81B
+</p>
+
+<h2>\x8C`\x8E\xAE</h2>
+
+<pre class="macro-syntax">
+ispassword &lt;filename&gt; &lt;password name&gt;
+</pre>
+
+<h2>\x89\xF0\x90\xE0</h2>
+
+<p>
+\x83p\x83X\x83\x8F\x81[\x83h\x83t\x83@\x83C\x83\x8B &lt;filename&gt; \x82\xA9\x82\xE7 &lt;password name&gt; \x82Ŏw\x92肳\x82\xEA\x82\xE9\x83p\x83X\x83\x8F\x81[\x83h\x82\xAA\x91\xB6\x8D݂\xB7\x82邩\x82𒲂ׂ\xE9\x81B
+</p>
+
+<p>
+\x83p\x83X\x83\x8F\x81[\x83h\x83t\x83@\x83C\x83\x8B\x82\xC9 &lt;password name&gt; \x82ɑΉ\x9E\x82\xB7\x82\xE9\x83p\x83X\x83\x8F\x81[\x83h\x82\xAA\x90ݒ肳\x82\xEA\x82Ă\xA2\x82\xE9\x82Ȃ\xE7\x82΁A\x83V\x83X\x83e\x83\x80\x95ϐ\x94 result \x82\xC9 1 \x82\xAA\x8Ai\x94[\x82\xB3\x82\xEA\x82\xE9\x81B\x82\xBB\x82\xEA\x88ȊO\x82̏ꍇ\x81Aresult \x82\xC9 0 \x82\xAA\x8Ai\x94[\x82\xB3\x82\xEA\x82\xE9\x81B
+</p>
+
+<h2>\x97\xE1</h2>
+
+<pre class="macro-example">
+strdim pw 2
+username = 'yutaka'
+
+<strong>ispassword</strong> 'pw.dat' username ; result: 0=false; 1=true
+if result = 1 then
+  getpassword 'pw.dat' username pw[0]
+  pw[1] = pw[0]
+else
+  msg = 'What is your password for '
+  strconcat msg username
+  strconcat msg '?'
+  passwordbox msg 'Enter your password'
+  pw[0] = inputstr
+  pw[1] = pw[0]
+  setpassword 'pw.dat' username pw[0]
+endif
+</pre>
+
+<h2>\x8EQ\x8F\xC6</h2>
+
+<ul>
+ <li>"<a href="getpassword.html">getpassword</a>"</li>
+ <li>"<a href="setpassword.html">setpassword</a>"</li>
+</ul>
+
+</BODY>
+</HTML>

Added: trunk/doc/ja/html/macro/command/setpassword.html
===================================================================
--- trunk/doc/ja/html/macro/command/setpassword.html	                        (rev 0)
+++ trunk/doc/ja/html/macro/command/setpassword.html	2012-05-31 15:45:32 UTC (rev 4959)
@@ -0,0 +1,64 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+  "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
+  <title>setpassword</title>
+  <meta http-equiv="Content-Style-Type" content="text/css">
+  <link rel="stylesheet" href="../../style.css" type="text/css">
+</head>
+
+<body>
+
+
+<h1>setpassword</h1>
+
+<p>
+\x83p\x83X\x83\x8F\x81[\x83h\x82\xF0\x92lj\xC1\x82\xE0\x82\xB5\x82\xAD\x82͍X\x90V\x82\xB7\x82\xE9\x81B
+</p>
+
+<h2>\x8C`\x8E\xAE</h2>
+
+<pre class="macro-syntax">
+setpassword &lt;filename&gt; &lt;password name&gt; &lt;strvar&gt;
+</pre>
+
+<h2>\x89\xF0\x90\xE0</h2>
+
+<p>
+\x83p\x83X\x83\x8F\x81[\x83h\x83t\x83@\x83C\x83\x8B &lt;filename&gt; \x82\xA9\x82\xE7 &lt;password name&gt; \x82Ŏw\x92肳\x82\xEA\x82\xE9\x83p\x83X\x83\x8F\x81[\x83h\x82\xF0 &lt;strvar&gt; \x82ɍX\x90V\x82\xB7\x82\xE9\x81B<br>
+\x95\xB6\x8E\x9A\x97\xF1\x95ϐ\x94  &lt;strvar&gt; \x82̃p\x83X\x83\x8F\x81[\x83h\x82͈Í\x86\x89\xBB\x82\xB3\x82\xEA\x81A\x83t\x83@\x83C\x83\x8B\x82ɕۑ\xB6\x82\xB3\x82\xEA\x82\xE9\x81B
+</p>
+
+<p>
+\x82\xE0\x82\xB5\x8Ew\x92肳\x82ꂽ\x83t\x83@\x83C\x83\x8B\x82\xAA\x91\xB6\x8D݂\xB5\x82Ȃ\xAF\x82\xEA\x82΁A\x90V\x82\xB5\x82\xAD\x83t\x83@\x83C\x83\x8B\x82\xF0\x8D쐬\x82\xB7\x82\xE9\x81B
+</p>
+
+<p>
+\x88\xEA\x82‚̃p\x83X\x83\x8F\x81[\x83h\x83t\x83@\x83C\x83\x8B\x82ɕ\xA1\x90\x94\x82̃p\x83X\x83\x8F\x81[\x83h\x82\xF0\x95ۑ\xB6\x82\xB7\x82邱\x82Ƃ\xAA\x82ł\xAB\x82\xE9\x81B<br>
+\x8Ae\x83p\x83X\x83\x8F\x81[\x83h\x82̓p\x83X\x83\x8F\x81[\x83h\x8E\xAF\x95ʎq\x82ɂ\xE6\x82\xC1\x82Ď\xAF\x95ʂ\xB3\x82\xEA\x82\xE9\x81B
+</p>
+
+<p>
+\x83p\x83X\x83\x8F\x81[\x83h\x83t\x83@\x83C\x83\x8B\x82ւ̏\x91\x82\xAB\x8D\x9E\x82݂Ɏ\xB8\x94s\x82\xB5\x82\xBD\x8Fꍇ\x81A\x83V\x83X\x83e\x83\x80\x95ϐ\x94 result \x82\xC9 0 \x82\xAA\x8Ai\x94[\x82\xB3\x82\xEA\x82\xE9\x81B\x82\xBB\x82\xEA\x88ȊO\x82̏ꍇ\x81Aresult \x82\xC9 1 \x82\xAA\x8Ai\x94[\x82\xB3\x82\xEA\x82\xE9\x81B
+</p>
+
+<h2>\x97\xE1</h2>
+
+<pre class="macro-example">
+newpasswd = 'hoge'
+<strong>setpassword</strong> 'password.dat' 'yutaka' newpasswd
+if result then
+  messagebox 'Password updated successfully.' 'Result'
+endif
+</pre>
+
+<h2>\x8EQ\x8F\xC6</h2>
+
+<ul>
+ <li>"<a href="getpassword.html">getpassword</a>"</li>
+ <li>"<a href="ispassword.html">ispassword</a>"</li>
+</ul>
+
+</BODY>
+</HTML>

Modified: trunk/doc/ja/teraterm.hhc
===================================================================
--- trunk/doc/ja/teraterm.hhc	2012-05-31 14:26:45 UTC (rev 4958)
+++ trunk/doc/ja/teraterm.hhc	2012-05-31 15:45:32 UTC (rev 4959)
@@ -1322,10 +1322,18 @@
 					<param name="ImageNumber" value="11">
 					</OBJECT>
 				<LI> <OBJECT type="text/sitemap">
+					<param name="Name" value="ispassword">
+					<param name="Local" value="html\macro\command\ispassword.html">
+					</OBJECT>
+				<LI> <OBJECT type="text/sitemap">
 					<param name="Name" value="passwordbox">
 					<param name="Local" value="html\macro\command\passwordbox.html">
 					<param name="ImageNumber" value="11">
 					</OBJECT>
+				<LI> <OBJECT type="text/sitemap">
+					<param name="Name" value="setpassword">
+					<param name="Local" value="html\macro\command\setpassword.html">
+					</OBJECT>
 			</UL>
 			<LI> <OBJECT type="text/sitemap">
 				<param name="Name" value="\x82\xBB\x82̑\xBC\x82̃R\x83}\x83\x93\x83h">

Modified: trunk/doc/ja/teraterm.hhp
===================================================================
--- trunk/doc/ja/teraterm.hhp	2012-05-31 14:26:45 UTC (rev 4958)
+++ trunk/doc/ja/teraterm.hhp	2012-05-31 15:45:32 UTC (rev 4959)
@@ -237,6 +237,7 @@
 HlpMacroCommandInputbox=html\macro\command\inputbox.html
 HlpMacroCommandInt2str=html\macro\command\int2str.html
 HlpMacroCommandIntdim=html\macro\command\intdim.html
+HlpMacroCommandIsPassword=html\macro\command\ispassword.html
 HlpMacroCommandKmtfinish=html\macro\command\kmtfinish.html
 HlpMacroCommandKmtget=html\macro\command\kmtget.html
 HlpMacroCommandKmtrecv=html\macro\command\kmtrecv.html
@@ -283,6 +284,7 @@
 HlpMacroCommandSetexitcode=html\macro\command\setexitcode.html
 HlpMacroCommandSetfileattr=html\macro\command\setfileattr.html
 HlpMacroCommandSetMulticastName=html\macro\command\setmulticastname.html
+HlpMacroCommandSetPassword=html\macro\command\setpassword.html
 HlpMacroCommandSetrts=html\macro\command\setrts.html
 HlpMacroCommandSetsync=html\macro\command\setsync.html
 HlpMacroCommandSettime=html\macro\command\settime.html

Modified: trunk/teraterm/common/helpid.h
===================================================================
--- trunk/teraterm/common/helpid.h	2012-05-31 14:26:45 UTC (rev 4958)
+++ trunk/teraterm/common/helpid.h	2012-05-31 15:45:32 UTC (rev 4959)
@@ -235,6 +235,7 @@
 #define HlpMacroCommandInputbox         92052
 #define HlpMacroCommandInt2str          92053
 #define HlpMacroCommandIntdim           92150
+#define HlpMacroCommandIsPassword       92197
 #define HlpMacroCommandKmtfinish        92054
 #define HlpMacroCommandKmtget           92055
 #define HlpMacroCommandKmtrecv          92056
@@ -281,6 +282,7 @@
 #define HlpMacroCommandSetexitcode      92083
 #define HlpMacroCommandSetfileattr      92190
 #define HlpMacroCommandSetMulticastName 92146
+#define HlpMacroCommandSetPassword      92196
 #define HlpMacroCommandSetrts           92136
 #define HlpMacroCommandSetsync          92084
 #define HlpMacroCommandSettime          92085

Modified: trunk/teraterm/ttpmacro/ttl.c
===================================================================
--- trunk/teraterm/ttpmacro/ttl.c	2012-05-31 14:26:45 UTC (rev 4958)
+++ trunk/teraterm/ttpmacro/ttl.c	2012-05-31 15:45:32 UTC (rev 4959)
@@ -2140,6 +2140,80 @@
 	return Err;
 }
 
+// setpassword 'password.dat' 'mypassword' passowrd
+WORD TTLSetPassword()
+{
+	TStrVal FileNameStr, KeyStr;
+	char Temp[512];
+	WORD Err;
+	TVarId VarId;
+	PCHAR VarStr;
+	int result = 0;  /* failure */
+
+	Err = 0;
+	GetStrVal(FileNameStr, &Err);   // \x83t\x83@\x83C\x83\x8B\x96\xBC
+	GetStrVal(KeyStr, &Err);  // \x83L\x81[\x96\xBC
+	GetStrVar(&VarId, &Err);
+	VarStr = StrVarPtr(VarId);  // \x95ϐ\x94\x82ւ̃|\x83C\x83\x93\x83^
+	if ((Err==0) && (GetFirstChar()!=0))
+		Err = ErrSyntax;
+	if (Err!=0) return Err;
+
+	// \x95\xB6\x8E\x9A\x97񂪋\xF3\x82̏ꍇ\x82̓G\x83\x89\x81[\x82Ƃ\xB7\x82\xE9\x81B
+	if (FileNameStr[0]==0 || 
+	    KeyStr[0]==0 ||
+	    VarStr[0]==0)   // "getpassword"\x93\xAF\x97l\x81A\x8B\xF3\x83p\x83X\x83\x8F\x81[\x83h\x82\xE0\x8B\x96\x89‚\xB5\x82Ȃ\xA2\x81B
+		Err = ErrSyntax;
+	if (Err!=0) return Err;
+
+	GetAbsPath(FileNameStr, sizeof(FileNameStr));
+
+	// \x83p\x83X\x83\x8F\x81[\x83h\x82\xF0\x88Í\x86\x89\xBB\x82\xB7\x82\xE9\x81B
+	Encrypt(VarStr, Temp);
+
+	if (WritePrivateProfileString("Password", KeyStr, Temp, FileNameStr) != 0) 
+		result = 1;  /* success */
+
+	SetResult(result);  // \x90\xAC\x8C\xF7\x89”ۂ\xF0\x90ݒ肷\x82\xE9\x81B
+	return Err;
+}
+
+// ispassword 'password.dat' 'username' ; result: 0=false; 1=true
+WORD TTLIsPassword()
+{
+	TStrVal FileNameStr, KeyStr;
+	char Temp[512];
+	WORD Err;
+	int result = 0; 
+
+	Err = 0;
+	GetStrVal(FileNameStr, &Err);   // \x83t\x83@\x83C\x83\x8B\x96\xBC
+	GetStrVal(KeyStr, &Err);  // \x83L\x81[\x96\xBC
+	if ((Err==0) && (GetFirstChar()!=0))
+		Err = ErrSyntax;
+	if (Err!=0) return Err;
+
+	// \x95\xB6\x8E\x9A\x97񂪋\xF3\x82̏ꍇ\x82̓G\x83\x89\x81[\x82Ƃ\xB7\x82\xE9\x81B
+	if (FileNameStr[0]==0 || 
+	    KeyStr[0]==0)
+		Err = ErrSyntax;
+	if (Err!=0) return Err;
+
+	GetAbsPath(FileNameStr, sizeof(FileNameStr));
+
+	Temp[0] = 0;
+	GetPrivateProfileString("Password", KeyStr,"",
+	                        Temp, sizeof(Temp), FileNameStr);
+	if (Temp[0] == 0) { // password not exist
+		result = 0; 
+	} else {
+		result = 1; 
+	}
+
+	SetResult(result);  // \x90\xAC\x8C\xF7\x89”ۂ\xF0\x90ݒ肷\x82\xE9\x81B
+	return Err;
+}
+
 WORD TTLGetSpecialFolder()
 {
 	WORD Err;
@@ -5017,6 +5091,10 @@
 			Err = TTLGetHostname(); break;
 		case RsvGetPassword:
 			Err = TTLGetPassword(); break;
+		case RsvSetPassword:
+			Err = TTLSetPassword(); break;
+		case RsvIsPassword:
+			Err = TTLIsPassword(); break;
 		case RsvGetSpecialFolder:
 			Err = TTLGetSpecialFolder(); break;
 		case RsvGetTitle:

Modified: trunk/teraterm/ttpmacro/ttmparse.c
===================================================================
--- trunk/teraterm/ttpmacro/ttmparse.c	2012-05-31 14:26:45 UTC (rev 4958)
+++ trunk/teraterm/ttpmacro/ttmparse.c	2012-05-31 15:45:32 UTC (rev 4959)
@@ -239,6 +239,7 @@
 		else if (_stricmp(Str,"inputbox")==0) *WordId = RsvInputBox;
 		else if (_stricmp(Str,"int2str")==0) *WordId = RsvInt2Str;
 		else if (_stricmp(Str,"intdim")==0) *WordId = RsvIntDim;
+		else if (_stricmp(Str,"ispassword")==0) *WordId = RsvIsPassword;    // add 'ispassword'  (2012.5.24 yutaka)
 		break;
 	case 'k':
 		if (_stricmp(Str,"kmtfinish")==0) *WordId = RsvKmtFinish;
@@ -306,6 +307,7 @@
 		else if (_stricmp(Str,"setecho")==0) *WordId = RsvSetEcho;
 		else if (_stricmp(Str,"setenv")==0) *WordId = RsvSetEnv;    // reactivate 'setenv' (2007.8.31 maya)
 		else if (_stricmp(Str,"setexitcode")==0) *WordId = RsvSetExitCode;
+		else if (_stricmp(Str,"setpassword")==0) *WordId = RsvSetPassword;    // add 'setpassword'  (2012.5.23 yutaka)
 		else if (_stricmp(Str,"setrts")==0) *WordId = RsvSetRts;    // add 'setrts'  (2008.3.12 maya)
 		else if (_stricmp(Str,"setsync")==0) *WordId = RsvSetSync;
 		else if (_stricmp(Str,"settime")==0) *WordId = RsvSetTime;

Modified: trunk/teraterm/ttpmacro/ttmparse.h
===================================================================
--- trunk/teraterm/ttpmacro/ttmparse.h	2012-05-31 14:26:45 UTC (rev 4958)
+++ trunk/teraterm/ttpmacro/ttmparse.h	2012-05-31 15:45:32 UTC (rev 4959)
@@ -221,6 +221,8 @@
 #define RsvFolderSearch 193
 #define RsvExpandEnv    194
 #define RsvGetSpecialFolder  195
+#define RsvSetPassword  196
+#define RsvIsPassword   197
 
 #define RsvOperator     1000
 #define RsvBNot         1001



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