From 08ea11ab0749a7977e6d47cd0fa7b3c9cc10af32 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Thu, 11 Sep 2008 19:51:11 +0000 Subject: runsvd: shrink by Vladimir *: use unified trivial signal handler function old new delta record_signo - 10 +10 process_stdin 433 443 +10 bbunpack 383 391 +8 wc_main 598 605 +7 conescape 293 296 +3 nmeter_main 670 672 +2 fallbackSort 1717 1719 +2 bb_got_signal - 1 +1 microcom_main 713 712 -1 signalled 2 - -2 pack_gzip 1661 1659 -2 evalvar 1376 1374 -2 compare_keys 737 735 -2 parse_command 1460 1456 -4 expand 1748 1744 -4 s_term 37 29 -8 s_hangup 8 - -8 fgotsig 10 - -10 find_pair 187 169 -18 signal_handler 190 170 -20 runsvdir_main 1701 1583 -118 ------------------------------------------------------------------------------ (add/remove: 2/3 grow/shrink: 6/10 up/down: 43/-199) Total: -156 bytes --- networking/telnet.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'networking/telnet.c') 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 { byte telwish; /* DO, DONT, WILL, WONT */ byte charmode; byte telflags; - byte gotsig; byte do_termios; #if ENABLE_FEATURE_TELNET_TTYPE char *ttype; @@ -113,7 +112,7 @@ static void conescape(void) { char b; - if (G.gotsig) /* came from line mode... go raw */ + if (bb_got_signal) /* came from line mode... go raw */ rawmode(); write_str(1, "\r\nConsole escape. Commands are:\r\n\n" @@ -127,13 +126,13 @@ static void conescape(void) switch (b) { case 'l': - if (!G.gotsig) { + if (!bb_got_signal) { do_linemode(); goto rrturn; } break; case 'c': - if (G.gotsig) { + if (bb_got_signal) { will_charmode(); goto rrturn; } @@ -149,11 +148,11 @@ static void conescape(void) write_str(1, "continuing...\r\n"); - if (G.gotsig) + if (bb_got_signal) cookmode(); rrturn: - G.gotsig = 0; + bb_got_signal = 0; } @@ -524,12 +523,6 @@ static int subneg(byte c) return FALSE; } -static void fgotsig(int sig) -{ - G.gotsig = sig; -} - - static void rawmode(void) { if (G.do_termios) @@ -592,7 +585,7 @@ int telnet_main(int argc UNUSED_PARAM, char **argv) setsockopt(netfd, SOL_SOCKET, SO_KEEPALIVE, &const_int_1, sizeof(const_int_1)); - signal(SIGINT, fgotsig); + signal(SIGINT, record_signo); #ifdef USE_POLL ufds[0].fd = 0; ufds[1].fd = netfd; @@ -617,7 +610,7 @@ int telnet_main(int argc UNUSED_PARAM, char **argv) /* timeout */ case -1: /* error, ignore and/or log something, bay go to loop */ - if (G.gotsig) + if (bb_got_signal) conescape(); else sleep(1); -- cgit v1.2.3