svnno****@sourc*****
svnno****@sourc*****
2015年 2月 22日 (日) 22:04:29 JST
Revision: 5793 http://sourceforge.jp/projects/ttssh2/scm/svn/commits/5793 Author: doda Date: 2015-02-22 22:04:28 +0900 (Sun, 22 Feb 2015) Log Message: ----------- X転送時の転送先をコマンドラインで指定できるようにした。 Modified Paths: -------------- trunk/ttssh2/ttxssh/fwdui.c trunk/ttssh2/ttxssh/ttxssh.c trunk/ttssh2/ttxssh/ttxssh.h trunk/ttssh2/ttxssh/x11util.c trunk/ttssh2/ttxssh/x11util.h -------------- next part -------------- Modified: trunk/ttssh2/ttxssh/fwdui.c =================================================================== --- trunk/ttssh2/ttxssh/fwdui.c 2015-02-21 14:53:27 UTC (rev 5792) +++ trunk/ttssh2/ttxssh/fwdui.c 2015-02-22 13:04:28 UTC (rev 5793) @@ -382,7 +382,7 @@ { spec->type = FWD_REMOTE_X11_TO_LOCAL; spec->from_port = -1; - X11_get_DISPLAY_info(spec->to_host, sizeof(spec->to_host), + X11_get_DISPLAY_info(pvar, spec->to_host, sizeof(spec->to_host), &spec->to_port, &spec->x11_screen); UTIL_get_lang_msg("MSG_FWD_REMOTE_XSERVER", pvar, "remote X server"); strncpy_s(spec->from_port_name, sizeof(spec->from_port_name), Modified: trunk/ttssh2/ttxssh/ttxssh.c =================================================================== --- trunk/ttssh2/ttxssh/ttxssh.c 2015-02-21 14:53:27 UTC (rev 5792) +++ trunk/ttssh2/ttxssh/ttxssh.c 2015-02-22 13:04:28 UTC (rev 5793) @@ -473,6 +473,8 @@ // \x83G\x83\x89\x81[\x82\xA8\x82\xE6\x82ьx\x8D\x90\x8E\x9E\x82̃|\x83b\x83v\x83A\x83b\x83v\x83\x81\x83b\x83Z\x81[\x83W\x82\xF0\x97}\x8E~\x82\xB7\x82\xE9 (2014.6.26 yutaka) settings->DisablePopupMessage = GetPrivateProfileInt("TTSSH", "DisablePopupMessage", 0, fileName); + READ_STD_STRING_OPTION(X11Display); + clear_local_settings(pvar); } @@ -576,6 +578,8 @@ _itoa(settings->DisablePopupMessage, buf, 10); WritePrivateProfileString("TTSSH", "DisablePopupMessage", buf, fileName); + + WritePrivateProfileString("TTSSH", "X11Display", settings->X11Display, fileName); } @@ -1654,6 +1658,10 @@ sizeof(pvar->settings.DefaultForwarding), option + 5, _TRUNCATE); } + } else if (MATCH_STR(option + 4, "-display=") == 0) { + strncpy_s(pvar->settings.X11Display, + sizeof(pvar->settings.X11Display), + option + 13, _TRUNCATE); } else if (MATCH_STR(option + 4, "-f=") == 0) { read_ssh_options_from_user_file(pvar, option + 7); } else if (MATCH_STR(option + 4, "-v") == 0) { Modified: trunk/ttssh2/ttxssh/ttxssh.h =================================================================== --- trunk/ttssh2/ttxssh/ttxssh.h 2015-02-21 14:53:27 UTC (rev 5792) +++ trunk/ttssh2/ttxssh/ttxssh.h 2015-02-22 13:04:28 UTC (rev 5793) @@ -157,6 +157,8 @@ int IconID; int DisablePopupMessage; + + char X11Display[128]; } TS_SSH; typedef struct _TInstVar { Modified: trunk/ttssh2/ttxssh/x11util.c =================================================================== --- trunk/ttssh2/ttxssh/x11util.c 2015-02-21 14:53:27 UTC (rev 5792) +++ trunk/ttssh2/ttxssh/x11util.c 2015-02-22 13:04:28 UTC (rev 5793) @@ -41,11 +41,9 @@ int init_data_len; } X11UnspoofingFilterClosure; -void X11_get_DISPLAY_info(char FAR * name_buf, int name_buf_len, - int FAR * port, int FAR * screen) +void parse_DISPLAY_str(char FAR * name_buf, int name_buf_len, + int FAR * port, int FAR * screen, char *DISPLAY) { - char FAR *DISPLAY = getenv("DISPLAY"); - strncpy_s(name_buf, name_buf_len, "localhost", _TRUNCATE); *port = 6000; *screen = 0; @@ -75,6 +73,20 @@ } } +void X11_get_DISPLAY_info(PTInstVar pvar, char FAR * name_buf, int name_buf_len, + int FAR * port, int FAR * screen) +{ + char FAR *DISPLAY = getenv("DISPLAY"); + + if (pvar->settings.X11Display[0] != 0) { + parse_DISPLAY_str(name_buf, name_buf_len, port, screen, pvar->settings.X11Display); + } + else { + parse_DISPLAY_str(name_buf, name_buf_len, port, screen, DISPLAY); + } +} + + X11AuthData FAR *X11_load_local_auth_data(int screen_num) { X11AuthData FAR *auth_data = Modified: trunk/ttssh2/ttxssh/x11util.h =================================================================== --- trunk/ttssh2/ttxssh/x11util.h 2015-02-21 14:53:27 UTC (rev 5792) +++ trunk/ttssh2/ttxssh/x11util.h 2015-02-22 13:04:28 UTC (rev 5793) @@ -49,7 +49,7 @@ #define X11_get_spoofed_protocol_data(d) ((d)->spoofed_data) #define X11_get_spoofed_protocol_data_len(d) ((d)->spoofed_data_len) -void X11_get_DISPLAY_info(char FAR * name_buf, int name_buf_len, int FAR * port, int FAR * screen); +void X11_get_DISPLAY_info(PTInstVar pvar, char FAR * name_buf, int name_buf_len, int FAR * port, int FAR * screen); X11AuthData FAR * X11_load_local_auth_data(int screen_num); void FAR * X11_init_unspoofing_filter(struct _TInstVar FAR * pvar, X11AuthData FAR * auth_data);