[Ttssh2-commit] [4545] expandenv マクロコマンドを新設

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2011年 7月 28日 (木) 00:51:23 JST


Revision: 4545
          http://sourceforge.jp/projects/ttssh2/svn/view?view=rev&revision=4545
Author:   maya
Date:     2011-07-28 00:51:22 +0900 (Thu, 28 Jul 2011)

Log Message:
-----------
expandenv マクロコマンドを新設
  getpassword 内の環境変数展開を削除

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/expandenv.html
    trunk/doc/ja/html/macro/command/expandenv.html


-------------- next part --------------
Modified: trunk/doc/en/html/about/history.html
===================================================================
--- trunk/doc/en/html/about/history.html	2011-07-27 14:33:03 UTC (rev 4544)
+++ trunk/doc/en/html/about/history.html	2011-07-27 15:51:22 UTC (rev 4545)
@@ -37,13 +37,13 @@
     <ul>
       <li>"<a href="../macro/command/getpassword.html">getpassword</a>" macro command is updated.
         <ul>
-          <li>Support of environmental variables in file names.</li>
           <li>The result of the command execution is stored in the system variable "result".</li>
         </ul></li>
       <li>"<a href="../macro/command/strspecial.html">strspecial</a>" macro command is updated.
         <ul>
           <!--li>•ÏŠ·‚·‚镶Žš—ñ‚ð strspecial ƒRƒ}ƒ“ƒh‚É’¼ÚŽw’è‚Å‚«‚é‚悤‚É‚µ‚½B</li-->
         </ul></li>
+      <li>added the "<a href="../macro/command/expandenv.html">expandenv</a>" macro command.</li>
     </ul>
   </li>
 

Added: trunk/doc/en/html/macro/command/expandenv.html
===================================================================
--- trunk/doc/en/html/macro/command/expandenv.html	                        (rev 0)
+++ trunk/doc/en/html/macro/command/expandenv.html	2011-07-27 15:51:22 UTC (rev 4545)
@@ -0,0 +1,66 @@
+<!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>expandenv</title>
+  <meta http-equiv="Content-Style-Type" content="text/css">
+  <link rel="stylesheet" href="../../style.css" type="text/css">
+</head>
+
+<body>
+
+
+<h1>expandenv</h1>
+
+<p>
+Expands environment variables.
+</p>
+
+<h2>Format</h2>
+
+<pre class="macro-syntax">
+expandenv &lt;strvar&gt; [&lt;strval&gt;]
+</pre>
+
+<h2>Parameters</h2>
+
+<dl>
+	<dt class="macro">string valiable &lt;strvar&gt;</dt>
+	<!--dd>‘æ2ˆø”‚ð“n‚³‚È‚¢ê‡‚́A‚±‚̈ø”‚ÅŽw’肵‚½•¶Žš—ñ‚ª“WŠJ‚³‚ê‚éB<br />
+	    ‘æ2ˆø”‚ð“n‚µ‚½ê‡‚́A‚±‚̈ø”‚Í–³Ž‹‚³‚ê‚éB</dd-->
+	
+	<dt class="macro">string &lt;strval&gt; (optional)</dt>
+	<!--dd>‚±‚̈ø”‚ðŽw’肵‚½ê‡A‚±‚̈ø”‚ÅŽw’肵‚½•¶Žš—ñ‚ª“WŠJ‚³‚ê‚éB</dd-->
+
+</dl>
+
+<h2>Return Value</h2>
+
+<dl>
+	<dt class="macro">System valiable &lt;result&gt;</dt>
+	<!--dd>“WŠJŒã‚Ì•¶Žš—ñ‚ªŠi”[‚³‚ê‚éB</dd-->
+	
+</dl>
+
+<h2>Remarks</h2>
+
+<p>
+<!-- “n‚³‚ꂽ•¶Žš—ñ‚ÉŠÜ‚Ü‚ê‚éŠÂ‹«•Ï”‚ð“WŠJ‚·‚éB -->
+</p>
+
+<h2>Example</h2>
+
+<pre class="macro-example">
+str = "%WINDIR%\notepad.exe"
+expandenv str
+messagebox str "env"
+</pre>
+
+<pre class="macro-example">
+expandenv str "%WINDIR%\notepad.exe"
+messagebox str "env"
+</pre>
+
+</body>
+</html>

Modified: trunk/doc/en/html/macro/command/index.html
===================================================================
--- trunk/doc/en/html/macro/command/index.html	2011-07-27 14:33:03 UTC (rev 4544)
+++ trunk/doc/en/html/macro/command/index.html	2011-07-27 15:51:22 UTC (rev 4545)
@@ -107,6 +107,7 @@
 <h2>String operation commands</h2>
 <ul>
  <li><a href="code2str.html">code2str</a>
+ <li><a href="expandenv.html">expandenv</a> (version 4.71 or later)
  <li><a href="int2str.html">int2str</a>
  <li><a href="sprintf.html">sprintf</a> (version 4.52 or later)
  <li><a href="sprintf2.html">sprintf2</a> (version 4.62 or later)

Modified: trunk/doc/en/teraterm.hhc
===================================================================
--- trunk/doc/en/teraterm.hhc	2011-07-27 14:33:03 UTC (rev 4544)
+++ trunk/doc/en/teraterm.hhc	2011-07-27 15:51:22 UTC (rev 4545)
@@ -1019,6 +1019,11 @@
 					<param name="ImageNumber" value="11">
 					</OBJECT>
 				<LI> <OBJECT type="text/sitemap">
+					<param name="Name" value="expandenv">
+					<param name="Local" value="html\macro\command\expandenv.html">
+					<param name="ImageNumber" value="11">
+					</OBJECT>
+				<LI> <OBJECT type="text/sitemap">
 					<param name="Name" value="int2str">
 					<param name="Local" value="html\macro\command\int2str.html">
 					<param name="ImageNumber" value="11">

Modified: trunk/doc/en/teraterm.hhp
===================================================================
--- trunk/doc/en/teraterm.hhp	2011-07-27 14:33:03 UTC (rev 4544)
+++ trunk/doc/en/teraterm.hhp	2011-07-27 15:51:22 UTC (rev 4545)
@@ -179,6 +179,7 @@
 HlpMacroCommandExec=html\macro\command\exec.html
 HlpMacroCommandExeccmnd=html\macro\command\execcmnd.html
 HlpMacroCommandExit=html\macro\command\exit.html
+HlpMacroCommandExpandenv=html\macro\command\expandenv.html
 HlpMacroCommandFileclose=html\macro\command\fileclose.html
 HlpMacroCommandFileconcat=html\macro\command\fileconcat.html
 HlpMacroCommandFilecopy=html\macro\command\filecopy.html

Modified: trunk/doc/ja/html/about/history.html
===================================================================
--- trunk/doc/ja/html/about/history.html	2011-07-27 14:33:03 UTC (rev 4544)
+++ trunk/doc/ja/html/about/history.html	2011-07-27 15:51:22 UTC (rev 4545)
@@ -37,13 +37,13 @@
     <ul>
       <li>ƒ}ƒNƒƒRƒ}ƒ“ƒh "<a href="../macro/command/getpassword.html">getpassword</a>"‚ð‹@”\ƒAƒbƒvƒf[ƒg‚µ‚½B
         <ul>
-          <li>ƒtƒ@ƒCƒ‹–¼‚Ɋ‹«•Ï”‚ðŠÜ‚ß‚ç‚ê‚é‚悤‚É‚µ‚½B</li>
           <li>ƒRƒ}ƒ“ƒh‚ÌŽÀs‰Â”Û‚ð"result"ƒVƒXƒeƒ€•Ï”‚ÉŠi”[‚·‚é‚悤‚É‚µ‚½B</li>
         </ul></li>
       <li>ƒ}ƒNƒƒRƒ}ƒ“ƒh "<a href="../macro/command/strspecial.html">strspecial</a>" ‚ð‹@”\ƒAƒbƒvƒf[ƒg‚µ‚½B
         <ul>
           <li>•ÏŠ·‚·‚镶Žš—ñ‚ð strspecial ƒRƒ}ƒ“ƒh‚É’¼ÚŽw’è‚Å‚«‚é‚悤‚É‚µ‚½B</li>
         </ul></li>
+      <li>ƒ}ƒNƒƒRƒ}ƒ“ƒh "<a href="../macro/command/expandenv.html">expandenv</a>" ‚ð’ljÁ‚µ‚½B</li>
     </ul>
   </li>
 

Added: trunk/doc/ja/html/macro/command/expandenv.html
===================================================================
--- trunk/doc/ja/html/macro/command/expandenv.html	                        (rev 0)
+++ trunk/doc/ja/html/macro/command/expandenv.html	2011-07-27 15:51:22 UTC (rev 4545)
@@ -0,0 +1,66 @@
+<!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>expandenv</title>
+  <meta http-equiv="Content-Style-Type" content="text/css">
+  <link rel="stylesheet" href="../../style.css" type="text/css">
+</head>
+
+<body>
+
+
+<h1>expandenv</h1>
+
+<p>
+ŠÂ‹«•Ï”‚ð“WŠJ‚·‚éB
+</p>
+
+<h2>Œ`Ž®</h2>
+
+<pre class="macro-syntax">
+expandenv &lt;strvar&gt; [&lt;strval&gt;]
+</pre>
+
+<h2>ƒpƒ‰ƒ[ƒ^</h2>
+
+<dl>
+	<dt class="macro">•¶Žš—ñ•Ï” &lt;strvar&gt;</dt>
+	<dd>‘æ2ˆø”‚ð“n‚³‚È‚¢ê‡‚́A‚±‚̈ø”‚ÅŽw’肵‚½•¶Žš—ñ‚ª“WŠJ‚³‚ê‚éB<br />
+	    ‘æ2ˆø”‚ð“n‚µ‚½ê‡‚́A‚±‚̈ø”‚Í–³Ž‹‚³‚ê‚éB</dd>
+	
+	<dt class="macro">•¶Žš—ñ &lt;strval&gt; (ƒIƒvƒVƒ‡ƒ“)</dt>
+	<dd>‚±‚̈ø”‚ðŽw’肵‚½ê‡A‚±‚̈ø”‚ÅŽw’肵‚½•¶Žš—ñ‚ª“WŠJ‚³‚ê‚éB</dd>
+
+</dl>
+
+<h2>•Ô‚è’l</h2>
+
+<dl>
+	<dt class="macro">•¶Žš—ñ•Ï” &lt;strvar&gt;</dt>
+	<dd>“WŠJŒã‚Ì•¶Žš—ñ‚ªŠi”[‚³‚ê‚éB</dd>
+	
+</dl>
+
+<h2>‰ðà</h2>
+
+<p>
+“n‚³‚ꂽ•¶Žš—ñ‚ÉŠÜ‚Ü‚ê‚éŠÂ‹«•Ï”‚ð“WŠJ‚·‚éB
+</p>
+
+<h2>—á</h2>
+
+<pre class="macro-example">
+str = "%WINDIR%\notepad.exe"
+expandenv str
+messagebox str "env"
+</pre>
+
+<pre class="macro-example">
+expandenv str "%WINDIR%\notepad.exe"
+messagebox str "env"
+</pre>
+
+</body>
+</html>

Modified: trunk/doc/ja/html/macro/command/index.html
===================================================================
--- trunk/doc/ja/html/macro/command/index.html	2011-07-27 14:33:03 UTC (rev 4544)
+++ trunk/doc/ja/html/macro/command/index.html	2011-07-27 15:51:22 UTC (rev 4545)
@@ -107,6 +107,7 @@
 <h2>•¶Žš—ñ‘€ìƒRƒ}ƒ“ƒh</h2>
 <ul>
  <li><a href="code2str.html">code2str</a>
+ <li><a href="expandenv.html">expandenv</a> (ƒo[ƒWƒ‡ƒ“4.71ˆÈ~)
  <li><a href="int2str.html">int2str</a>
  <li><a href="sprintf.html">sprintf</a> (ƒo[ƒWƒ‡ƒ“4.52ˆÈ~)
  <li><a href="sprintf2.html">sprintf2</a> (ƒo[ƒWƒ‡ƒ“4.62ˆÈ~)

Modified: trunk/doc/ja/teraterm.hhc
===================================================================
--- trunk/doc/ja/teraterm.hhc	2011-07-27 14:33:03 UTC (rev 4544)
+++ trunk/doc/ja/teraterm.hhc	2011-07-27 15:51:22 UTC (rev 4545)
@@ -1032,6 +1032,11 @@
 					<param name="ImageNumber" value="11">
 					</OBJECT>
 				<LI> <OBJECT type="text/sitemap">
+					<param name="Name" value="expandenv">
+					<param name="Local" value="html\macro\command\expandenv.html">
+					<param name="ImageNumber" value="11">
+					</OBJECT>
+				<LI> <OBJECT type="text/sitemap">
 					<param name="Name" value="int2str">
 					<param name="Local" value="html\macro\command\int2str.html">
 					<param name="ImageNumber" value="11">

Modified: trunk/doc/ja/teraterm.hhp
===================================================================
--- trunk/doc/ja/teraterm.hhp	2011-07-27 14:33:03 UTC (rev 4544)
+++ trunk/doc/ja/teraterm.hhp	2011-07-27 15:51:22 UTC (rev 4545)
@@ -189,6 +189,7 @@
 HlpMacroCommandExec=html\macro\command\exec.html
 HlpMacroCommandExeccmnd=html\macro\command\execcmnd.html
 HlpMacroCommandExit=html\macro\command\exit.html
+HlpMacroCommandExpandenv=html\macro\command\expandenv.html
 HlpMacroCommandFileclose=html\macro\command\fileclose.html
 HlpMacroCommandFileconcat=html\macro\command\fileconcat.html
 HlpMacroCommandFilecopy=html\macro\command\filecopy.html

Modified: trunk/teraterm/common/helpid.h
===================================================================
--- trunk/teraterm/common/helpid.h	2011-07-27 14:33:03 UTC (rev 4544)
+++ trunk/teraterm/common/helpid.h	2011-07-27 15:51:22 UTC (rev 4545)
@@ -188,6 +188,7 @@
 #define HlpMacroCommandExec             92019
 #define HlpMacroCommandExeccmnd         92020
 #define HlpMacroCommandExit             92021
+#define HlpMacroCommandExpandenv        92194
 #define HlpMacroCommandFileclose        92022
 #define HlpMacroCommandFileconcat       92023
 #define HlpMacroCommandFilecopy         92024

Modified: trunk/teraterm/ttpmacro/ttl.c
===================================================================
--- trunk/teraterm/ttpmacro/ttl.c	2011-07-27 14:33:03 UTC (rev 4544)
+++ trunk/teraterm/ttpmacro/ttl.c	2011-07-27 15:51:22 UTC (rev 4545)
@@ -974,6 +974,36 @@
 	return ErrSyntax;
 }
 
+WORD TTLExpandEnv()
+{
+	WORD Err, VarId;
+	TStrVal deststr, srcptr;
+
+	Err = 0;
+	GetStrVar(&VarId,&Err);
+	if (Err!=0) return Err;
+
+	if (CheckParameterGiven()) { // expandenv strvar strval
+		GetStrVal(srcptr,&Err);
+		if ((Err==0) && (GetFirstChar()!=0))
+			Err = ErrSyntax;
+		if (Err!=0) {
+			return Err;
+		}
+
+		// ƒtƒ@ƒCƒ‹ƒpƒX‚Ɋ‹«•Ï”‚ªŠÜ‚Ü‚ê‚Ä‚¢‚é‚È‚ç‚΁A“WŠJ‚·‚éB
+		ExpandEnvironmentStrings(srcptr, deststr, MaxStrLen);
+		SetStrVal(VarId, deststr);
+	}
+	else { // expandenv strvar
+		// ƒtƒ@ƒCƒ‹ƒpƒX‚Ɋ‹«•Ï”‚ªŠÜ‚Ü‚ê‚Ä‚¢‚é‚È‚ç‚΁A“WŠJ‚·‚éB
+		ExpandEnvironmentStrings(StrVarPtr(VarId), deststr, MaxStrLen);
+		SetStrVal(VarId, deststr);
+	}
+
+	return Err;
+}
+
 WORD TTLFileClose()
 {
 	WORD Err;
@@ -1974,9 +2004,6 @@
 
 	GetAbsPath(Str,sizeof(Str));
 
-	// ƒtƒ@ƒCƒ‹ƒpƒX‚Ɋ‹«•Ï”‚ªŠÜ‚Ü‚ê‚Ä‚¢‚é‚È‚ç‚΁A“WŠJ‚·‚éB
-	ExpandEnvironmentStrings(Str, filepath, sizeof(filepath));
-
 	GetPrivateProfileString("Password",Str2,"",
 	                        Temp,sizeof(Temp), filepath);
 	if (Temp[0]==0) // password not exist
@@ -4722,6 +4749,8 @@
 			Err = TTLExecCmnd(); break;
 		case RsvExit:
 			Err = TTLExit(); break;
+		case RsvExpandEnv:
+			Err = TTLExpandEnv(); break;
 		case RsvFileClose:
 			Err = TTLFileClose(); break;
 		case RsvFileConcat:

Modified: trunk/teraterm/ttpmacro/ttmparse.c
===================================================================
--- trunk/teraterm/ttpmacro/ttmparse.c	2011-07-27 14:33:03 UTC (rev 4544)
+++ trunk/teraterm/ttpmacro/ttmparse.c	2011-07-27 15:51:22 UTC (rev 4545)
@@ -165,6 +165,7 @@
 		else if (_stricmp(Str,"exec")==0) *WordId = RsvExec;
 		else if (_stricmp(Str,"execcmnd")==0) *WordId = RsvExecCmnd;
 		else if (_stricmp(Str,"exit")==0) *WordId = RsvExit;
+		else if (_stricmp(Str,"expandenv")==0) *WordId = RsvExpandEnv;
 		break;
 	case 'f':
 		if (_stricmp(Str,"fileclose")==0) *WordId = RsvFileClose;

Modified: trunk/teraterm/ttpmacro/ttmparse.h
===================================================================
--- trunk/teraterm/ttpmacro/ttmparse.h	2011-07-27 14:33:03 UTC (rev 4544)
+++ trunk/teraterm/ttpmacro/ttmparse.h	2011-07-27 15:51:22 UTC (rev 4545)
@@ -209,6 +209,7 @@
 #define RsvFolderCreate 191
 #define RsvFolderDelete 192
 #define RsvFolderSearch 193
+#define RsvExpandEnv    194
 
 #define RsvOperator     1000
 #define RsvBNot         1001



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