aboutsummaryrefslogtreecommitdiff
path: root/networking/telnet.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-04-07 15:02:20 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2018-04-07 15:02:20 +0200
commit2f094ae82106e91cb210e79ddc2e5285377b549e (patch)
treec76bacf7490a92aceda4113acc98bb9da45cd864 /networking/telnet.c
parente0afe0a9fd610b1972fdaa444ca39af0b0be6ec4 (diff)
downloadbusybox-w32-2f094ae82106e91cb210e79ddc2e5285377b549e.tar.gz
busybox-w32-2f094ae82106e91cb210e79ddc2e5285377b549e.tar.bz2
busybox-w32-2f094ae82106e91cb210e79ddc2e5285377b549e.zip
telnet: move winsize detection closer to I/O loop, delete non-functioning debug code
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to '')
-rw-r--r--networking/telnet.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/networking/telnet.c b/networking/telnet.c
index 8b0df7f5c..15d6a08d8 100644
--- a/networking/telnet.c
+++ b/networking/telnet.c
@@ -89,12 +89,6 @@
89# define TELOPT_NAWS 31 /* window size */ 89# define TELOPT_NAWS 31 /* window size */
90#endif 90#endif
91 91
92#ifdef DOTRACE
93# define TRACE(x, y) do { if (x) printf y; } while (0)
94#else
95# define TRACE(x, y)
96#endif
97
98enum { 92enum {
99 DATABUFSIZE = 128, 93 DATABUFSIZE = 128,
100 IACBUFSIZE = 128, 94 IACBUFSIZE = 128,
@@ -627,10 +621,6 @@ int telnet_main(int argc UNUSED_PARAM, char **argv)
627 621
628 INIT_G(); 622 INIT_G();
629 623
630#if ENABLE_FEATURE_TELNET_WIDTH
631 get_terminal_width_height(0, &G.win_width, &G.win_height);
632#endif
633
634#if ENABLE_FEATURE_TELNET_TTYPE 624#if ENABLE_FEATURE_TELNET_TTYPE
635 G.ttype = getenv("TERM"); 625 G.ttype = getenv("TERM");
636#endif 626#endif
@@ -661,6 +651,11 @@ int telnet_main(int argc UNUSED_PARAM, char **argv)
661 651
662 setsockopt_keepalive(netfd); 652 setsockopt_keepalive(netfd);
663 653
654#if ENABLE_FEATURE_TELNET_WIDTH
655 get_terminal_width_height(0, &G.win_width, &G.win_height);
656//TODO: support dynamic resize?
657#endif
658
664 signal(SIGINT, record_signo); 659 signal(SIGINT, record_signo);
665 660
666 ufds[0].fd = STDIN_FILENO; 661 ufds[0].fd = STDIN_FILENO;
@@ -684,7 +679,6 @@ int telnet_main(int argc UNUSED_PARAM, char **argv)
684 len = safe_read(STDIN_FILENO, G.buf, DATABUFSIZE); 679 len = safe_read(STDIN_FILENO, G.buf, DATABUFSIZE);
685 if (len <= 0) 680 if (len <= 0)
686 doexit(EXIT_SUCCESS); 681 doexit(EXIT_SUCCESS);
687 TRACE(0, ("Read con: %d\n", len));
688 handle_net_output(len); 682 handle_net_output(len);
689 } 683 }
690 684
@@ -694,7 +688,6 @@ int telnet_main(int argc UNUSED_PARAM, char **argv)
694 full_write1_str("Connection closed by foreign host\r\n"); 688 full_write1_str("Connection closed by foreign host\r\n");
695 doexit(EXIT_FAILURE); 689 doexit(EXIT_FAILURE);
696 } 690 }
697 TRACE(0, ("Read netfd (%d): %d\n", netfd, len));
698 handle_net_input(len); 691 handle_net_input(len);
699 } 692 }
700 } /* while (1) */ 693 } /* while (1) */