Tera Termの個人的な作業用リポジトリ
修订版 | 223bb214b3f88b903ca1719befafcd1d6d7d612a (tree) |
---|---|
时间 | 2020-04-12 00:57:03 |
作者 | zmatsuo <zmatsuo@user...> |
Commiter | zmatsuo |
正規表現マクロコマンドを正しく動作するよう修正
- strreplace
- regexoption
git-svn-id: svn+ssh://svn.osdn.net/svnroot/ttssh2/trunk@8710 f5f01b69-1e22-0410-acbf-894ab4bd6246
@@ -4623,19 +4623,17 @@ WORD TTLStrRemove() | ||
4623 | 4623 | WORD TTLStrReplace() |
4624 | 4624 | { |
4625 | 4625 | WORD Err, VarType; |
4626 | - TVarId VarId; | |
4626 | + TVarId DestVarId; | |
4627 | 4627 | TStrVal oldstr; |
4628 | 4628 | TStrVal newstr; |
4629 | 4629 | TStrVal tmpstr; |
4630 | - const char *srcptr; | |
4631 | - const char *matchptr; | |
4632 | 4630 | char *p; |
4633 | 4631 | int srclen, oldlen, matchlen; |
4634 | 4632 | int pos, ret; |
4635 | 4633 | int result = 0; |
4636 | 4634 | |
4637 | 4635 | Err = 0; |
4638 | - GetStrVar(&VarId,&Err); | |
4636 | + GetStrVar(&DestVarId,&Err); | |
4639 | 4637 | GetIntVal(&pos,&Err); |
4640 | 4638 | GetStrVal(oldstr,&Err); |
4641 | 4639 | GetStrVal(newstr,&Err); |
@@ -4643,7 +4641,7 @@ WORD TTLStrReplace() | ||
4643 | 4641 | Err = ErrSyntax; |
4644 | 4642 | if (Err!=0) return Err; |
4645 | 4643 | |
4646 | - srcptr = StrVarPtr(VarId); | |
4644 | + const char *srcptr = StrVarPtr(DestVarId); | |
4647 | 4645 | srclen = strlen(srcptr); |
4648 | 4646 | |
4649 | 4647 | if (pos > srclen || pos <= 0) { |
@@ -4673,9 +4671,10 @@ WORD TTLStrReplace() | ||
4673 | 4671 | } |
4674 | 4672 | ret--; |
4675 | 4673 | |
4676 | - if (CheckVar("matchstr",&VarType,&VarId) && | |
4674 | + TVarId MatchVarId; | |
4675 | + if (CheckVar("matchstr",&VarType,&MatchVarId) && | |
4677 | 4676 | (VarType==TypString)) { |
4678 | - matchptr = StrVarPtr(VarId); | |
4677 | + const char *matchptr = StrVarPtr(MatchVarId); | |
4679 | 4678 | matchlen = strlen(matchptr); |
4680 | 4679 | } else { |
4681 | 4680 | result = 0; |
@@ -4686,7 +4685,7 @@ WORD TTLStrReplace() | ||
4686 | 4685 | strncpy_s(dest, sizeof(dest), tmpstr, pos + ret); |
4687 | 4686 | strncat_s(dest, sizeof(dest), newstr, _TRUNCATE); |
4688 | 4687 | strncat_s(dest, sizeof(dest), tmpstr + pos + ret + matchlen, _TRUNCATE); |
4689 | - SetStrVal(VarId, dest); | |
4688 | + SetStrVal(DestVarId, dest); | |
4690 | 4689 | |
4691 | 4690 | result = 1; |
4692 | 4691 |
@@ -55,7 +55,7 @@ TStrVal Wait2Str; | ||
55 | 55 | BOOL Wait2Found; |
56 | 56 | |
57 | 57 | OnigOptionType RegexOpt = ONIG_OPTION_NONE; |
58 | -OnigEncoding RegexEnc = ONIG_ENCODING_ASCII; | |
58 | +OnigEncoding RegexEnc = ONIG_ENCODING_UTF8; | |
59 | 59 | OnigSyntaxType *RegexSyntax = ONIG_SYNTAX_RUBY; |
60 | 60 | |
61 | 61 | #define ServiceName "TERATERM" |