diff --git a/host.c b/host.c index 663a12d..0bb0640 100644 --- a/host.c +++ b/host.c @@ -1,5 +1,5 @@ // -// "$Id: host.c 31773 2020-06-06 15:05:10 $" +// "$Id: host.c 31682 2020-06-18 15:05:10 $" // // tinyTerm -- A minimal serail/telnet/ssh/sftp terminal emulator // @@ -289,7 +289,6 @@ DWORD WINAPI serial(void *pv) CloseHandle( ph->hExitEvent ); CloseHandle( ph->hSerial ); ph->host_type = 0; - term_Disp( ph->term, "disconnected\r\n" ); comm_close: ph->host_status=IDLE; @@ -357,7 +356,6 @@ DWORD WINAPI telnet( void *pv ) ph->host_type = 0; closesocket(ph->sock); - term_Disp( ph->term, "disconnected\r\n" ); } ph->sock = 0; diff --git a/ssh2.c b/ssh2.c index 4b0ccb6..14c2638 100644 --- a/ssh2.c +++ b/ssh2.c @@ -1,5 +1,5 @@ // -// "$Id: ssh2.c 40296 2020-06-06 15:05:10 $" +// "$Id: ssh2.c 40300 2020-06-18 15:05:10 $" // // tinyTerm -- A minimal serail/telnet/ssh/sftp terminal emulator // @@ -356,7 +356,7 @@ int ssh_authentication( HOST *ph ) { char user[256], pw[256]; if ( ph->username==NULL ) { - char *p = ssh2_Gets( ph, "\r\nusername:", TRUE); + char *p = ssh2_Gets( ph, "\r\nusername: ", TRUE); if ( p==NULL ) return -5; strcpy(user, p); ph->username = user; @@ -383,7 +383,7 @@ int ssh_authentication( HOST *ph ) if ( strstr(authlist, "password")!=NULL ) { for ( int rep=0; rep<3; rep++ ) { if ( ph->password==NULL ) { - char *p = ssh2_Gets( ph, "password:", FALSE ); + char *p = ssh2_Gets( ph, "password: ", FALSE ); if ( p==NULL ) return -5; strcpy(pw, p); ph->password = pw; @@ -438,9 +438,13 @@ DWORD WINAPI ssh( void *pv ) term_Disp( ph->term, "\033[31msession failure!\r\n"); goto Session_Close; } + const char *banner = libssh2_session_banner_get(ph->session); - if ( banner!=NULL ) term_Disp( ph->term, banner); - + if ( banner!=NULL ) { + term_Disp( ph->term, banner); + term_Disp( ph->term, "\r\n"); + } + ph->host_status=AUTHENTICATING; if ( ssh_knownhost( ph )<0 ) { term_Disp( ph->term, "\033[31mverification failure!\r\n" ); @@ -504,7 +508,6 @@ DWORD WINAPI ssh( void *pv ) } tun_closeall( ph ); ph->host_type = 0; - term_Disp( ph->term, "disconnected\r\n"); Channel_Close: if ( ph->channel!=NULL ) { diff --git a/tiny.c b/tiny.c index cf3287b..359b48e 100644 --- a/tiny.c +++ b/tiny.c @@ -1,5 +1,5 @@ // -// "$Id: tiny.c 38235 2020-06-17 19:35:10 $" +// "$Id: tiny.c 38328 2020-06-18 19:35:10 $" // // tinyTerm -- A minimal serail/telnet/ssh/sftp terminal emulator // @@ -33,8 +33,8 @@ int dpi = 96; int titleHeight; int fontSize = 16; WCHAR fontFace[32] = L"Consolas"; -WCHAR wndTitle[256] = L" Term Script Options "; -const char TINYTERM[]="\n\033[32mtinyTerm > \033[37m"; +WCHAR wndTitle[256] = L" Term Script Options "; +const char TINYTERM[]="\n\033[32mtinyTerm> \033[37m"; const char DICTFILE[]="tinyTerm.hist"; const char WELCOME[]="\r\n\ \ttinyTerm is a simple, small and scriptable terminal emulator,\r\n\n\ @@ -274,9 +274,12 @@ void cmd_Enter(WCHAR *wcmd) term_Send( pt, cmd, cnt ); } else { - term_Print(pt, "\033[33m%s\n", cmd); - host_Open(ph, cmd); - } + if ( *cmd ) { + term_Print(pt, "\033[33m%s\n", cmd); + host_Open(ph, cmd); + } + else + host_Open(ph, NULL); } } } WNDPROC wpOrigCmdProc; @@ -339,10 +342,9 @@ void tiny_Title( char *buf ) SetWindowText(hwndTerm, wndTitle); if ( host_Status(ph)==IDLE ) { - if ( bLocalEdit ) - term_Disp(pt, TINYTERM); - else - term_Print(pt, "\r\n\033[33mPress Enter to reconnect\r\n"); + term_Print(pt, "\r\n\033[31mDisconnected! \ +\033[37mPress \033[33mEnter\033[37m to reconnect\r\n"); + if ( bLocalEdit ) term_Disp(pt, TINYTERM); menu_Enable( ID_CONNECT, TRUE); menu_Enable( ID_DISCONN, FALSE); menu_Check( ID_ECHO, term.bEcho); @@ -873,7 +875,7 @@ LRESULT CALLBACK MainWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) //moves the composition window to cursor pos on Win10 break; case WM_CHAR: - if ( host_Status( ph )==IDLE ) {//press Enter to restart + if ( host_Status( ph )==IDLE ) {//press Enter to reconnect if ( (wParam&0xff)==0x0d ) host_Open(ph, NULL); } else {