svnno****@sourc*****
svnno****@sourc*****
2015年 5月 15日 (金) 14:56:39 JST
Revision: 5868 http://sourceforge.jp/projects/ttssh2/scm/svn/commits/5868 Author: maya Date: 2015-05-15 14:56:36 +0900 (Fri, 15 May 2015) Log Message: ----------- USE_ATCMDLINE マクロを削除 コマンドライン引数の @@ を @ に置き換えるコードを取っておいた USE_ATCMDLINE マクロを削除 Modified Paths: -------------- trunk/ttssh2/ttxssh/ttxssh.c -------------- next part -------------- Modified: trunk/ttssh2/ttxssh/ttxssh.c =================================================================== --- trunk/ttssh2/ttxssh/ttxssh.c 2015-05-14 15:22:09 UTC (rev 5867) +++ trunk/ttssh2/ttxssh/ttxssh.c 2015-05-15 05:56:36 UTC (rev 5868) @@ -481,7 +481,7 @@ } static void write_ssh_options(PTInstVar pvar, PCHAR fileName, - TS_SSH FAR * settings, BOOL copy_forward) + TS_SSH FAR * settings, BOOL copy_forward) { char buf[1024]; @@ -1004,7 +1004,7 @@ // \x83T\x83u\x83N\x83\x89\x83X\x89\xBB\x82\xB7\x82邽\x82߂̃E\x83C\x83\x93\x83h\x83E\x83v\x83\x8D\x83V\x81[\x83W\x83\x83 WNDPROC OrigHostnameEditProc; // Original window procedure LRESULT CALLBACK HostnameEditProc(HWND dlg, UINT msg, - WPARAM wParam, LPARAM lParam) + WPARAM wParam, LPARAM lParam) { HWND parent; int max, select, len; @@ -1594,32 +1594,6 @@ FWDUI_load_settings(pvar); } -#ifdef USE_ATCMDLINE -// @\x82\xF0\x83u\x83\x89\x83\x93\x83N\x82ɒu\x8A\xB7\x82\xB7\x82\xE9\x81B (2005.1.26 yutaka) -static void replace_to_blank(char *src, char *dst, int dst_len) -{ - int len, i; - - len = strlen(src); - if (dst_len < len) // buffer overflow check - return; - - for (i = 0 ; i < len ; i++) { - if (src[i] == '@') { // @ \x82\xAA\x93o\x8Fꂵ\x82\xBD\x82\xE7 - if (i < len - 1 && src[i + 1] == '@') { // \x82\xBB\x82̎\x9F\x82\xE0 @ \x82Ȃ\xE7\x83A\x83b\x83g\x83}\x81[\x83N\x82ƔF\x8E\xAF\x82\xB7\x82\xE9 - *dst++ = '@'; - i++; - } else { - *dst++ = ' '; // \x8Bɒu\x82\xAB\x8A\xB7\x82\xA6\x82\xE9 - } - } else { - *dst++ = src[i]; - } - } - *dst = '\0'; -} -#endif - // Percent-encode\x82\xB3\x82ꂽ\x95\xB6\x8E\x9A\x97\xF1src\x82\xF0\x83f\x83R\x81[\x83h\x82\xB5\x82\xC4dst\x82ɃR\x83s\x81[\x82\xB7\x82\xE9\x81B // dstlen\x82\xCDdst\x82̃T\x83C\x83Y\x81B\x82\xB1\x82\xEA\x82\xE6\x82茋\x89ʂ\xAA\x92\xB7\x82\xA2\x8Fꍇ\x81A\x82\xBB\x82̕\xAA\x82͐\xE8\x8ÊĂ\xE7\x82\xEA\x82\xE9\x81B static void percent_decode(char *dst, int dstlen, char *src) { @@ -1817,28 +1791,13 @@ } } else if (MATCH_STR(option + 1, "user=") == 0) { -#ifdef USE_ATCMDLINE - replace_to_blank(option + 6, pvar->ssh2_username, sizeof(pvar->ssh2_username)); - //_snprintf(pvar->ssh2_username, sizeof(pvar->ssh2_username), "%s", option + 6); - -#else _snprintf_s(pvar->ssh2_username, sizeof(pvar->ssh2_username), _TRUNCATE, "%s", option + 6); -#endif } else if (MATCH_STR(option + 1, "passwd=") == 0) { -#ifdef USE_ATCMDLINE - replace_to_blank(option + 8, pvar->ssh2_password, sizeof(pvar->ssh2_password)); - //_snprintf(pvar->ssh2_password, sizeof(pvar->ssh2_password), "%s", option + 8); -#else _snprintf_s(pvar->ssh2_password, sizeof(pvar->ssh2_password), _TRUNCATE, "%s", option + 8); -#endif } else if (MATCH_STR(option + 1, "keyfile=") == 0) { -#ifdef USE_ATCMDLINE - replace_to_blank(option + 9, pvar->ssh2_keyfile, sizeof(pvar->ssh2_keyfile)); -#else _snprintf_s(pvar->ssh2_keyfile, sizeof(pvar->ssh2_keyfile), _TRUNCATE, "%s", option + 9); -#endif } else if (MATCH_STR(option + 1, "ask4passwd") == 0) { // \x83p\x83X\x83\x8F\x81[\x83h\x82\xAD (2006.9.18 maya) @@ -1966,7 +1925,6 @@ static void FAR PASCAL TTXParseParam(PCHAR param, PTTSet ts, PCHAR DDETopic) { -#ifndef USE_ATCMDLINE int i; BOOL inParam = FALSE; BOOL inQuotes = FALSE; @@ -2082,125 +2040,7 @@ } } free(buf); -#else - // \x83X\x83y\x81[\x83X\x82\xF0\x8A܂ރt\x83@\x83C\x83\x8B\x96\xBC\x82\xF0\x94F\x8E\xAF\x82\xB7\x82\xE9\x82悤\x82ɏC\x90\xB3 (2006.10.7 maya) - int i, buflen; - BOOL inParam = FALSE; - BOOL inQuotes = FALSE; - BOOL inFileParam = FALSE; - PCHAR option = NULL; - if (pvar->hostdlg_activated) { - pvar->settings.Enabled = pvar->hostdlg_Enabled; - } - - for (i = 0; param[i] != 0; i++) { - if (inQuotes ? param[i] == '"' - : (param[i] == ' ' || param[i] == '\t')) { - if (option != NULL) { - char ch = param[i]; - PCHAR Equal; - - param[i] = 0; - Equal = strchr(option, '='); - if (inFileParam && Equal != NULL && *(Equal + 1) == '"') { - int buf_len = strlen(option) * sizeof(char); - char *buf = (char *)calloc(strlen(option), sizeof(char)); - char c = option[Equal - option + 1]; - option[Equal - option + 1] = 0; - strncat_s(buf, buf_len, option, _TRUNCATE); - option[Equal - option + 1] = c; - strncat_s(buf, buf_len, Equal + 2, _TRUNCATE); - switch (parse_option(pvar, *buf == '"' ? buf + 1 : buf)) { - case OPTION_CLEAR: - memset(option, ' ', i + 1 - (option - param)); - break; - case OPTION_REPLACE: - buflen = strlen(buf); - memcpy(option, buf, buflen); - memset(option + buflen, ' ', i + 1 - buflen - (option - param)); - break; - default: - param[i] = ch; - } - free(buf); - } - else { - switch (parse_option(pvar, *option == '"' ? option + 1 : option)) { - case OPTION_CLEAR: - memset(option, ' ', i + 1 - (option - param)); - break; - default: - param[i] = ch; - } - } - option = NULL; - } - inParam = FALSE; - inQuotes = FALSE; - inFileParam = FALSE; - } else if (!inParam) { - if (param[i] == '"') { - inQuotes = TRUE; - inParam = TRUE; - option = param + i; - } else if (param[i] != ' ' && param[i] != '\t') { - inParam = TRUE; - option = param + i; - } - } else { - if (option == NULL) { - continue; - } - if ((option[0] == '-' || option[0] == '/') && - (MATCH_STR(option + 1, "ssh-f=") == 0 || // ttssh option - MATCH_STR(option + 1, "ssh-consume=") == 0 || // ttssh option - MATCH_STR_I(option + 1, "f=") == 0 || // Tera Term option - MATCH_STR_I(option + 1, "fd=") == 0 || // Tera Term option - MATCH_STR_I(option + 1, "k=") == 0 || // Tera Term option - MATCH_STR_I(option + 1, "l=") == 0 || // Tera Term option - MATCH_STR_I(option + 1, "m=") == 0 || // Tera Term option - MATCH_STR_I(option + 1, "r=") == 0 || // Tera Term option - MATCH_STR_I(option + 1, "w=") == 0 || // Tera Term option - MATCH_STR(option + 1, "keyfile=") == 0)) { // ttssh option - if (param[i] == '"') { - inQuotes = TRUE; - } - inFileParam = TRUE; - } - } - } - - if (option != NULL) { - PCHAR Equal = strchr(option, '='); - if (inFileParam && Equal != NULL && *(Equal + 1) == '"') { - int buf_len = strlen(option) * sizeof(char); - char *buf = (char *)calloc(strlen(option), sizeof(char)); - char c = option[Equal - option + 1]; - option[Equal - option + 1] = 0; - strncat_s(buf, buf_len, option, _TRUNCATE); - option[Equal - option + 1] = c; - strncat_s(buf, buf_len, Equal + 2, _TRUNCATE); - switch (parse_option(pvar, *buf == '"' ? buf + 1 : buf)) { - case OPTION_CLEAR: - memset(option, ' ', i + 1 - (option - param)); - break; - case OPTION_REPLACE: - strcpy_s(option, i - (param - option), buf); - break; - } - free(buf); - } - else { - switch (parse_option(pvar, option)) { - case OPTION_CLEAR: - memset(option, ' ', i - (option - param)); - break; - } - } - } -#endif - FWDUI_load_settings(pvar); (pvar->ParseParam) (param, ts, DDETopic); @@ -5385,42 +5225,8 @@ strncpy_s(dst, dst_len, str, _TRUNCATE); } -#ifdef USE_ATCMDLINE -// \x88ȉ\xBA\x82\xCDTeraTerm Menu\x82̃R\x81[\x83h(ttpmenu.cpp)\x82Ɠ\xAF\x88\xEA\x81B -// \x8B\xF0 @ \x82ɒu\x82\xAB\x8A\xB7\x82\xA6\x82\xE9\x81B@\x8E\xA9\x90g\x82\xCD@@\x82ɂ\xB7\x82\xE9\x81B(2005.1.28 yutaka) -static void replace_blank_to_mark(char *str, char *dst, int dst_len) -{ - int i, len, n; - - len = strlen(str); - n = 0; - for (i = 0 ; i < len ; i++) { - if (str[i] == '@') - n++; - } - if (dst_len < (len + 2*n)) - return; - - for (i = 0 ; i < len ; i++) { - if (str[i] == '@') { - *dst++ = '@'; - *dst++ = '@'; - - } else if (str[i] == ' ') { - *dst++ = '@'; - - } else { - *dst++ = str[i]; - - } - } - *dst = '\0'; - -} -#endif - static void PASCAL FAR TTXSetCommandLine(PCHAR cmd, int cmdlen, - PGetHNRec rec) + PGetHNRec rec) { char tmpFile[MAX_PATH]; char tmpPath[1024]; @@ -5494,41 +5300,25 @@ // \x83p\x83X\x83\x8F\x81[\x83h\x82\xF0\x8Ao\x82\xA6\x82Ă\xA2\x82\xE9\x8Fꍇ\x82̂݁A\x83R\x83}\x83\x93\x83h\x83\x89\x83C\x83\x93\x82ɓn\x82\xB7\x81B(2006.8.3 yutaka) if (pvar->settings.remember_password && pvar->auth_state.cur_cred.method == SSH_AUTH_PASSWORD) { -#ifdef USE_ATCMDLINE - replace_blank_to_mark(pvar->auth_state.cur_cred.password, mark, sizeof(mark)); -#else dquote_string(pvar->auth_state.cur_cred.password, mark, sizeof(mark)); -#endif _snprintf_s(tmp, sizeof(tmp), _TRUNCATE, " /auth=password /user=%s /passwd=%s", pvar->auth_state.user, mark); strncat_s(cmd, cmdlen, tmp, _TRUNCATE); } else if (pvar->settings.remember_password && pvar->auth_state.cur_cred.method == SSH_AUTH_RSA) { -#ifdef USE_ATCMDLINE - replace_blank_to_mark(pvar->auth_state.cur_cred.password, mark, sizeof(mark)); -#else dquote_string(pvar->auth_state.cur_cred.password, mark, sizeof(mark)); -#endif _snprintf_s(tmp, sizeof(tmp), _TRUNCATE, " /auth=publickey /user=%s /passwd=%s", pvar->auth_state.user, mark); strncat_s(cmd, cmdlen, tmp, _TRUNCATE); -#ifdef USE_ATCMDLINE - replace_blank_to_mark(pvar->session_settings.DefaultRSAPrivateKeyFile, mark, sizeof(mark)); -#else dquote_string(pvar->session_settings.DefaultRSAPrivateKeyFile, mark, sizeof(mark)); -#endif _snprintf_s(tmp, sizeof(tmp), _TRUNCATE, " /keyfile=%s", mark); strncat_s(cmd, cmdlen, tmp, _TRUNCATE); } else if (pvar->settings.remember_password && pvar->auth_state.cur_cred.method == SSH_AUTH_TIS) { -#ifdef USE_ATCMDLINE - replace_blank_to_mark(pvar->auth_state.cur_cred.password, mark, sizeof(mark)); -#else dquote_string(pvar->auth_state.cur_cred.password, mark, sizeof(mark)); -#endif _snprintf_s(tmp, sizeof(tmp), _TRUNCATE, " /auth=challenge /user=%s /passwd=%s", pvar->auth_state.user, mark); strncat_s(cmd, cmdlen, tmp, _TRUNCATE);