Skip to content
Snippets Groups Projects
Commit dc871ec2 authored by deuce's avatar deuce
Browse files

Fix telnet with stdio mode.

parent 3870492c
No related branches found
No related tags found
No related merge requests found
...@@ -1425,7 +1425,11 @@ static const char* usage= ...@@ -1425,7 +1425,11 @@ static const char* usage=
" -8 set maximum Zmodem block size to 8K (ZedZap)\n" " -8 set maximum Zmodem block size to 8K (ZedZap)\n"
" -m# set maximum receive file size to # bytes (0=unlimited, default=%u)\n" " -m# set maximum receive file size to # bytes (0=unlimited, default=%u)\n"
" -! to pause after abnormal exit (error)\n" " -! to pause after abnormal exit (error)\n"
#ifdef __unix__
" -telnet to enable Telnet mode (the default except in stdio mode)\n"
#else
" -telnet to enable Telnet mode (the default)\n" " -telnet to enable Telnet mode (the default)\n"
#endif
" -rlogin or -ssh or -raw to disable Telnet mode\n" " -rlogin or -ssh or -raw to disable Telnet mode\n"
"\n" "\n"
"cmd = v to display detailed version information\n" "cmd = v to display detailed version information\n"
...@@ -1502,6 +1506,7 @@ int main(int argc, char **argv) ...@@ -1502,6 +1506,7 @@ int main(int argc, char **argv)
FILE* fp; FILE* fp;
BOOL tcp_nodelay; BOOL tcp_nodelay;
char compiler[32]; char compiler[32];
BOOL telnet_requested=FALSE;
str_list_t fname_list; str_list_t fname_list;
fname_list=strListInit(); fname_list=strListInit();
...@@ -1692,10 +1697,12 @@ int main(int argc, char **argv) ...@@ -1692,10 +1697,12 @@ int main(int argc, char **argv)
while(*arg=='-') while(*arg=='-')
arg++; arg++;
if(stricmp(arg,"telnet")==0) { if(stricmp(arg,"telnet")==0) {
telnet_requested=TRUE;
telnet=TRUE; telnet=TRUE;
continue; continue;
} }
if(stricmp(arg,"rlogin")==0 || stricmp(arg,"ssh")==0 || stricmp(arg,"raw")==0) { if(stricmp(arg,"rlogin")==0 || stricmp(arg,"ssh")==0 || stricmp(arg,"raw")==0) {
telnet_requested=FALSE;
telnet=FALSE; telnet=FALSE;
continue; continue;
} }
...@@ -1788,11 +1795,6 @@ int main(int argc, char **argv) ...@@ -1788,11 +1795,6 @@ int main(int argc, char **argv)
} }
} }
if(!telnet)
zm.escape_telnet_iac = FALSE;
zm.max_file_size = max_file_size;
if(sock==INVALID_SOCKET || sock<1) { if(sock==INVALID_SOCKET || sock<1) {
#ifdef __unix__ #ifdef __unix__
if(STDOUT_FILENO > STDIN_FILENO) if(STDOUT_FILENO > STDIN_FILENO)
...@@ -1802,6 +1804,7 @@ int main(int argc, char **argv) ...@@ -1802,6 +1804,7 @@ int main(int argc, char **argv)
stdio=TRUE; stdio=TRUE;
fprintf(statfp,"No socket descriptor specified, using STDIO\n"); fprintf(statfp,"No socket descriptor specified, using STDIO\n");
if(!telnet_requested)
telnet=FALSE; telnet=FALSE;
init_stdio(); init_stdio();
#else #else
...@@ -1815,6 +1818,11 @@ int main(int argc, char **argv) ...@@ -1815,6 +1818,11 @@ int main(int argc, char **argv)
statfp=stdout; statfp=stdout;
#endif #endif
if(!telnet)
zm.escape_telnet_iac = FALSE;
zm.max_file_size = max_file_size;
if(!(mode&(SEND|RECV))) { if(!(mode&(SEND|RECV))) {
fprintf(statfp,"!No command specified\n\n"); fprintf(statfp,"!No command specified\n\n");
fprintf(statfp,usage,MAX_FILE_SIZE); fprintf(statfp,usage,MAX_FILE_SIZE);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment