diff options
author | Glenn L McGrath | 2003-12-20 01:47:18 +0000 |
---|---|---|
committer | Glenn L McGrath | 2003-12-20 01:47:18 +0000 |
commit | ffccf6eb5de311a3db8c3d7f7496e2f0cad69a23 (patch) | |
tree | 859f5849c30de6cb69bf6336af6d2228402f2395 /networking/telnet.c | |
parent | 03d8091859f45a6bb5e3aadc110b279e789399f2 (diff) | |
download | busybox-ffccf6eb5de311a3db8c3d7f7496e2f0cad69a23.zip busybox-ffccf6eb5de311a3db8c3d7f7496e2f0cad69a23.tar.gz |
Change interface to bb_lookup_host, dont try and set port inside this
function as there is no gracefull way of handling failures.
Rename bb_getport to bb_lookup_port, allow a default port to be
specified so it always returns a correct value.
Modify ftpgetput/rdate/wget to use the new interface.
wget/rdate now use etc/services with a falback default value.
Diffstat (limited to 'networking/telnet.c')
-rw-r--r-- | networking/telnet.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/networking/telnet.c b/networking/telnet.c index 92ddfae..110c9d1 100644 --- a/networking/telnet.c +++ b/networking/telnet.c @@ -570,8 +570,6 @@ static void cookmode(void) extern int telnet_main(int argc, char** argv) { - char *host; - char *port; int len; struct sockaddr_in s_in; #ifdef USE_POLL @@ -597,12 +595,12 @@ extern int telnet_main(int argc, char** argv) G.termios_raw = G.termios_def; cfmakeraw(&G.termios_raw); - if (argc < 2) bb_show_usage(); - port = (argc > 2)? argv[2] : "23"; + if (argc < 2) + bb_show_usage(); - host = argv[1]; + bb_lookup_host(&s_in, argv[1]); + s_in.sin_port = bb_lookup_port((argc == 3) ? argv[2] : "telnet", 23); - bb_lookup_host(&s_in, host, port); G.netfd = xconnect(&s_in); setsockopt(G.netfd, SOL_SOCKET, SO_KEEPALIVE, &one, sizeof one); |