diff --git a/channels.c b/channels.c index 1dd0777..4002f96 100644 --- a/channels.c +++ b/channels.c @@ -3913,10 +3913,11 @@ channel_connect_to_path(const char *path, char *ctype, char *rname) return connect_to(path, PORT_STREAMLOCAL, ctype, rname); } +#ifndef WIN32_FIXME void channel_send_window_changes(void) { -#ifndef WIN32_FIXME + u_int i; struct winsize ws; @@ -3933,9 +3934,30 @@ channel_send_window_changes(void) packet_put_int((u_int)ws.ws_ypixel); packet_send(); } -#endif } +#else // WIN32_FIXME +void +channel_send_window_changes(int col, int row, int xpixel, int ypixel) +{ + u_int i; + struct winsize ws; + + for (i = 0; i < channels_alloc; i++) { + if (channels[i] == NULL || !channels[i]->client_tty || + channels[i]->type != SSH_CHANNEL_OPEN) + continue; + channel_request_start(i, "window-change", 0); + packet_put_int((u_int)col); + packet_put_int((u_int)row); + packet_put_int((u_int)xpixel); + packet_put_int((u_int)ypixel); + packet_send(); + } +} +#endif + + /* -- X11 forwarding */ /* diff --git a/channels.h b/channels.h index 9d76c9d..e7288db 100644 --- a/channels.h +++ b/channels.h @@ -226,7 +226,12 @@ void channel_register_status_confirm(int, channel_confirm_cb *, channel_confirm_abandon_cb *, void *); void channel_cancel_cleanup(int); int channel_close_fd(int *); +#ifndef WIN32_FIXME void channel_send_window_changes(void); +#else +void channel_send_window_changes(int, int, int, int); +#endif + /* protocol handler */ diff --git a/clientloop.c b/clientloop.c index 6a52f8e..702eb94 100644 --- a/clientloop.c +++ b/clientloop.c @@ -119,6 +119,12 @@ #include #define isatty(a) WSHELPisatty(a) + +// Windows Console screen size change related +extern int ScreenX; +extern int ScrollBottom; +int win_received_window_change_signal = 1; + #endif /* import options */ @@ -563,6 +569,25 @@ client_check_window_change(void) packet_put_int((u_int)ws.ws_ypixel); packet_send(); } +#else + + if (! win_received_window_change_signal) + return; + /** XXX race */ + win_received_window_change_signal = 0; + + debug2("client_check_window_change: changed"); + + if (compat20) { + channel_send_window_changes(ScreenX, ScrollBottom, 640, 480); + } else { + packet_start(SSH_CMSG_WINDOW_SIZE); + packet_put_int((u_int)ScreenX); + packet_put_int((u_int)ScrollBottom); + packet_put_int((u_int)640); + packet_put_int((u_int)480); + packet_send(); + } #endif /* !WIN32_FIXME */ } @@ -2571,11 +2596,11 @@ client_session2_setup(int id, int want_tty, int want_subsystem, tty_make_modes(-1, tiop); #else - packet_put_cstring(term != NULL ? term : ""); - packet_put_int((u_int) 80 /*ws.ws_col*/); - packet_put_int((u_int) 25 /*ws.ws_row*/); - packet_put_int((u_int) 640 /*ws.ws_xpixel*/); - packet_put_int((u_int) 480 /*ws.ws_ypixel*/); + packet_put_cstring(term != NULL ? term : "vt220"); + packet_put_int((u_int) ScreenX); + packet_put_int((u_int) ScrollBottom); + packet_put_int((u_int) 640); + packet_put_int((u_int) 480); tty_make_modes(-1, NULL); #endif /* else !WIN32_FIXME */ packet_send(); diff --git a/ssh.c b/ssh.c index 24c84c3..226cfc8 100644 --- a/ssh.c +++ b/ssh.c @@ -580,6 +580,7 @@ set_addrinfo_port(struct addrinfo *addrs, int port) /* * Main program for the ssh client. */ + int main(int ac, char **av) { @@ -605,9 +606,6 @@ main(int ac, char **av) * Setup exit signal handler for receiving signal, when * parent server is stopped. */ - - AllocConsole(); - ConInit( STD_OUTPUT_HANDLE, TRUE ); SetConsoleCtrlHandler(CtrlHandlerRoutine, TRUE); @@ -1502,6 +1500,13 @@ main(int ac, char **av) } } + #ifdef WIN32_FIXME + if (tty_flag) { + //AllocConsole(); + ConInit( STD_OUTPUT_HANDLE, TRUE ); + } + #endif + exit_status = compat20 ? ssh_session2() : ssh_session(); packet_close();