aboutsummaryrefslogtreecommitdiff
path: root/toys/pending/telnet.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2015-08-05 20:32:49 -0500
committerRob Landley <rob@landley.net>2015-08-05 20:32:49 -0500
commit35dafc7b17ce23da62dcce2195bed9b370680e65 (patch)
tree944ab9be2d5e1a614d9682556e42eaf562011edd /toys/pending/telnet.c
parentea75e752f930df7b740a773294b997f46927c716 (diff)
downloadtoybox-35dafc7b17ce23da62dcce2195bed9b370680e65.tar.gz
Tweak xconnect: socket can be a string (ala "ftp") from /etc/services.
Still need a rethink on how to handle socket/bind/connect sequence.
Diffstat (limited to 'toys/pending/telnet.c')
-rw-r--r--toys/pending/telnet.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/toys/pending/telnet.c b/toys/pending/telnet.c
index 49dabd07..dc3487a5 100644
--- a/toys/pending/telnet.c
+++ b/toys/pending/telnet.c
@@ -286,14 +286,14 @@ static void write_server(int len)
void telnet_main(void)
{
+ char *port = "23";
int set = 1, len;
struct pollfd pfds[2];
- TT.port = 23; //TELNET_PORT
TT.win_width = 80; //columns
TT.win_height = 24; //rows
- if(toys.optc == 2) TT.port = atolx_range(toys.optargs[1], 0, 65535);
+ if (toys.optc == 2) port = toys.optargs[1];
TT.ttype = getenv("TERM");
if(!TT.ttype) TT.ttype = "";
@@ -306,7 +306,7 @@ void telnet_main(void)
}
terminal_size(&TT.win_width, &TT.win_height);
- TT.sfd = xconnect(*toys.optargs, TT.port, 0, SOCK_STREAM, IPPROTO_TCP, 0);
+ TT.sfd = xconnect(*toys.optargs, port, 0, SOCK_STREAM, IPPROTO_TCP, 0);
setsockopt(TT.sfd, SOL_SOCKET, SO_REUSEADDR, &set, sizeof(set));
setsockopt(TT.sfd, SOL_SOCKET, SO_KEEPALIVE, &set, sizeof(set));