summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko2013-05-12 02:13:24 +0200
committerDenys Vlasenko2013-05-12 02:13:24 +0200
commitf76fd17d7443a2302adc2bdc401cdfc3c83ce59e (patch)
tree6836d305ca35000615d8995d7b1fba4a0f68a10e
parent041baf272082173fe8abf6fe8e7e4a16d26b9b88 (diff)
downloadbusybox-f76fd17d7443a2302adc2bdc401cdfc3c83ce59e.zip
busybox-f76fd17d7443a2302adc2bdc401cdfc3c83ce59e.tar.gz
telnet: code shrink
function old new delta telnet_main 1519 1515 -4 con_escape 296 285 -11 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/telnet.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/networking/telnet.c b/networking/telnet.c
index 58a6919..a255797 100644
--- a/networking/telnet.c
+++ b/networking/telnet.c
@@ -125,12 +125,10 @@ static void subneg(byte c);
static void iac_flush(void)
{
- write(netfd, G.iacbuf, G.iaclen);
+ full_write(netfd, G.iacbuf, G.iaclen);
G.iaclen = 0;
}
-#define write_str(fd, str) write(fd, str, sizeof(str) - 1)
-
static void doexit(int ev) NORETURN;
static void doexit(int ev)
{
@@ -145,7 +143,7 @@ static void con_escape(void)
if (bb_got_signal) /* came from line mode... go raw */
rawmode();
- write_str(1, "\r\nConsole escape. Commands are:\r\n\n"
+ full_write1_str("\r\nConsole escape. Commands are:\r\n\n"
" l go to line mode\r\n"
" c go to character mode\r\n"
" z suspend telnet\r\n"
@@ -176,7 +174,7 @@ static void con_escape(void)
doexit(EXIT_SUCCESS);
}
- write_str(1, "continuing...\r\n");
+ full_write1_str("continuing...\r\n");
if (bb_got_signal)
cookmode();
@@ -383,10 +381,11 @@ static void put_iac_naws(byte c, int x, int y)
put_iac(SB);
put_iac(c);
- put_iac((x >> 8) & 0xff);
- put_iac(x & 0xff);
- put_iac((y >> 8) & 0xff);
- put_iac(y & 0xff);
+ /* "... & 0xff" implicitly done below */
+ put_iac(x >> 8);
+ put_iac(x);
+ put_iac(y >> 8);
+ put_iac(y);
put_iac(IAC);
put_iac(SE);