aboutsummaryrefslogtreecommitdiff
path: root/toys/pending/telnet.c
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2021-01-26 09:59:27 -0800
committerRob Landley <rob@landley.net>2021-01-26 18:56:46 -0600
commit612ad45d51ca39df671c4b50906cd9606117fc53 (patch)
tree893648daaf2b72806073005c15f08afc6ad1546a /toys/pending/telnet.c
parent2b4abd05efcc96061eaa87a6fdbc3f7121fd2c08 (diff)
downloadtoybox-612ad45d51ca39df671c4b50906cd9606117fc53.tar.gz
getty/telnet/tftpd: minor cleanup.
Remove STDIN_FILENO and use FLAG(). Use xsetspeed() rather than have a duplicate table. Inline getty's print_prompt(). There's still a lot of cleanup needed here, in particular use of toybuf and removal of the inappropriately-named HOSTNAME_SIZE (and ideally sharing that logic with login(1) which already contains a better implementation of it).
Diffstat (limited to 'toys/pending/telnet.c')
-rw-r--r--toys/pending/telnet.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/toys/pending/telnet.c b/toys/pending/telnet.c
index 3e040864..b4d5c72f 100644
--- a/toys/pending/telnet.c
+++ b/toys/pending/telnet.c
@@ -107,7 +107,7 @@ static void handle_esc(void)
" z suspend telnet\r\n"
" e exit telnet\r\n", 114);
- if (read(STDIN_FILENO, &input, 1) <= 0) {
+ if (read(0, &input, 1) <= 0) {
if(TT.term_ok) tcsetattr(0, TCSADRAIN, &TT.def_term);
exit(0);
}
@@ -258,7 +258,7 @@ static int read_server(int len)
}
} while (TT.pbuff < len);
- if (i) xwrite(STDIN_FILENO, toybuf, i);
+ if (i) xwrite(0, toybuf, i);
return 0;
}
@@ -310,7 +310,7 @@ void telnet_main(void)
setsockopt(TT.sfd, SOL_SOCKET, SO_REUSEADDR, &set, sizeof(set));
setsockopt(TT.sfd, SOL_SOCKET, SO_KEEPALIVE, &set, sizeof(set));
- pfds[0].fd = STDIN_FILENO;
+ pfds[0].fd = 0;
pfds[0].events = POLLIN;
pfds[1].fd = TT.sfd;
pfds[1].events = POLLIN;
@@ -325,7 +325,7 @@ void telnet_main(void)
continue;
}
if(pfds[0].revents) {
- len = read(STDIN_FILENO, TT.buff, DATABUFSIZE);
+ len = read(0, TT.buff, DATABUFSIZE);
if(len > 0) write_server(len);
else return;
}