aboutsummaryrefslogtreecommitdiff
path: root/networking/telnet.c
diff options
context:
space:
mode:
Diffstat (limited to 'networking/telnet.c')
-rw-r--r--networking/telnet.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/networking/telnet.c b/networking/telnet.c
index 63ee38088..5d7ecef3b 100644
--- a/networking/telnet.c
+++ b/networking/telnet.c
@@ -60,7 +60,6 @@ struct globals {
60 byte telwish; /* DO, DONT, WILL, WONT */ 60 byte telwish; /* DO, DONT, WILL, WONT */
61 byte charmode; 61 byte charmode;
62 byte telflags; 62 byte telflags;
63 byte gotsig;
64 byte do_termios; 63 byte do_termios;
65#if ENABLE_FEATURE_TELNET_TTYPE 64#if ENABLE_FEATURE_TELNET_TTYPE
66 char *ttype; 65 char *ttype;
@@ -113,7 +112,7 @@ static void conescape(void)
113{ 112{
114 char b; 113 char b;
115 114
116 if (G.gotsig) /* came from line mode... go raw */ 115 if (bb_got_signal) /* came from line mode... go raw */
117 rawmode(); 116 rawmode();
118 117
119 write_str(1, "\r\nConsole escape. Commands are:\r\n\n" 118 write_str(1, "\r\nConsole escape. Commands are:\r\n\n"
@@ -127,13 +126,13 @@ static void conescape(void)
127 126
128 switch (b) { 127 switch (b) {
129 case 'l': 128 case 'l':
130 if (!G.gotsig) { 129 if (!bb_got_signal) {
131 do_linemode(); 130 do_linemode();
132 goto rrturn; 131 goto rrturn;
133 } 132 }
134 break; 133 break;
135 case 'c': 134 case 'c':
136 if (G.gotsig) { 135 if (bb_got_signal) {
137 will_charmode(); 136 will_charmode();
138 goto rrturn; 137 goto rrturn;
139 } 138 }
@@ -149,11 +148,11 @@ static void conescape(void)
149 148
150 write_str(1, "continuing...\r\n"); 149 write_str(1, "continuing...\r\n");
151 150
152 if (G.gotsig) 151 if (bb_got_signal)
153 cookmode(); 152 cookmode();
154 153
155 rrturn: 154 rrturn:
156 G.gotsig = 0; 155 bb_got_signal = 0;
157 156
158} 157}
159 158
@@ -524,12 +523,6 @@ static int subneg(byte c)
524 return FALSE; 523 return FALSE;
525} 524}
526 525
527static void fgotsig(int sig)
528{
529 G.gotsig = sig;
530}
531
532
533static void rawmode(void) 526static void rawmode(void)
534{ 527{
535 if (G.do_termios) 528 if (G.do_termios)
@@ -592,7 +585,7 @@ int telnet_main(int argc UNUSED_PARAM, char **argv)
592 585
593 setsockopt(netfd, SOL_SOCKET, SO_KEEPALIVE, &const_int_1, sizeof(const_int_1)); 586 setsockopt(netfd, SOL_SOCKET, SO_KEEPALIVE, &const_int_1, sizeof(const_int_1));
594 587
595 signal(SIGINT, fgotsig); 588 signal(SIGINT, record_signo);
596 589
597#ifdef USE_POLL 590#ifdef USE_POLL
598 ufds[0].fd = 0; ufds[1].fd = netfd; 591 ufds[0].fd = 0; ufds[1].fd = netfd;
@@ -617,7 +610,7 @@ int telnet_main(int argc UNUSED_PARAM, char **argv)
617 /* timeout */ 610 /* timeout */
618 case -1: 611 case -1:
619 /* error, ignore and/or log something, bay go to loop */ 612 /* error, ignore and/or log something, bay go to loop */
620 if (G.gotsig) 613 if (bb_got_signal)
621 conescape(); 614 conescape();
622 else 615 else
623 sleep(1); 616 sleep(1);