[Ttssh2-commit] [3232] 一部の2バイト文字がホスト名に使えなかったのを修正。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 3月 25日 (水) 05:50:54 JST


Revision: 3232
          http://svn.sourceforge.jp/view?root=ttssh2&view=rev&rev=3232
Author:   doda
Date:     2009-03-25 05:50:54 +0900 (Wed, 25 Mar 2009)

Log Message:
-----------
一部の2バイト文字がホスト名に使えなかったのを修正。
[Ttssh2-devel 1407], http://sourceforge.jp/forum/forum.php?thread_id=22115&forum_id=5841

Modified Paths:
--------------
    trunk/ttssh2/ttxssh/ttxssh.c


-------------- next part --------------
Modified: trunk/ttssh2/ttxssh/ttxssh.c
===================================================================
--- trunk/ttssh2/ttxssh/ttxssh.c	2009-03-24 20:37:11 UTC (rev 3231)
+++ trunk/ttssh2/ttxssh/ttxssh.c	2009-03-24 20:50:54 UTC (rev 3232)
@@ -45,6 +45,7 @@
 #include <fcntl.h>
 #include <sys/stat.h>
 #include <time.h>
+#include <mbstring.h>
 
 #include "resource.h"
 #include <commctrl.h>
@@ -1653,7 +1654,7 @@
 		optlen = strlen(option);
 
 		// Å‰‚Ì':'‚Ì‘O‚Ì•¶Žš‚ª”Žš‚¾‚Á‚½ê‡A‚»‚ê‚ðsshƒvƒƒgƒRƒ‹ƒo[ƒWƒ‡ƒ“‚Æ‚Ý‚È‚·
-		p = strchr(option, ':');
+		p = _mbschr(option, ':');
 		switch (*(p-1)) {
 		case '1':
 			pvar->settings.ssh_protocol_version = 1;
@@ -1667,15 +1668,15 @@
 		p += 3;
 
 		// path part ‚ðØ‚èŽÌ‚Ä‚é
-		if ((p2 = strchr(p, '/')) != NULL) {
+		if ((p2 = _mbschr(p, '/')) != NULL) {
 			*p2 = 0;
 		}
 
 		// '@'‚ª‚ ‚Á‚½ê‡A‚»‚ê‚æ‚è‘O‚̓†[ƒUî•ñ
-		if ((p2 = strchr(p, '@')) != NULL) {
+		if ((p2 = _mbschr(p, '@')) != NULL) {
 			*p2 = 0;
 			// ':'ˆÈ~‚̓pƒXƒ[ƒh
-			if ((p3 = strchr(p, ':')) != NULL) {
+			if ((p3 = _mbschr(p, ':')) != NULL) {
 				*p3 = 0;
 				percent_decode(pvar->ssh2_password, sizeof(pvar->ssh2_password), p3 + 1);
 				pvar->ssh2_autologin = 1;
@@ -1694,9 +1695,9 @@
 		// ƒ|[ƒgŽw’肪–³‚¢Žž‚Í":22"‚ð‘«‚·
 #ifndef NO_INET6
 		if (option[0] == '[' && option[hostlen-1] == ']' ||     // IPv6 raw address without port
-		    option[0] != '[' && strchr(option, ':') == NULL) {  // hostname or IPv4 raw address without port
+		    option[0] != '[' && _mbschr(option, ':') == NULL) { // hostname or IPv4 raw address without port
 #else
-		if (strchr(option, ':') == NULL) {
+		if (_mbschr(option, ':') == NULL) {
 #endif							/* NO_INET6 */
 			memcpy_s(option+hostlen, optlen-hostlen, ":22", 3);
 			hostlen += 3;
@@ -1709,7 +1710,7 @@
 
 		return OPTION_REPLACE;
 	}
-	else if (strchr(option, '@') != NULL) {
+	else if (_mbschr(option, '@') != NULL) {
 		//
 		// user @ host Œ`Ž®‚̃Tƒ|[ƒg
 		//   Žæ‚荇‚¦‚¸ssh‚ł̂݃Tƒ|[ƒg‚ׁ̈Aƒ†[ƒU–¼‚Íttssh“à‚Œׂ·B
@@ -1718,7 +1719,7 @@
 		//   Tera Term–{‘̂ŏˆ—‚·‚é‚悤‚É‚·‚é—\’èB
 		//
 		char *p;
-		p = strchr(option, '@');
+		p = _mbschr(option, '@');
 		*p = 0;
 
 		strncpy_s(pvar->ssh2_username, sizeof(pvar->ssh2_username), option, _TRUNCATE);



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