diff options
author | Denis Vlasenko | 2007-01-12 10:35:23 +0000 |
---|---|---|
committer | Denis Vlasenko | 2007-01-12 10:35:23 +0000 |
commit | 6536a9b5833febe719988526a095a9cacb8a1042 (patch) | |
tree | 07b65c5cf7e1f51909d4e7b516253bae7611fa48 /networking/telnet.c | |
parent | f8138d1f91c913166bffb0077a0fe06831a77ecf (diff) | |
download | busybox-6536a9b5833febe719988526a095a9cacb8a1042.zip busybox-6536a9b5833febe719988526a095a9cacb8a1042.tar.gz |
next part of ipv6-ization is here: wget & httpd
Diffstat (limited to 'networking/telnet.c')
-rw-r--r-- | networking/telnet.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/networking/telnet.c b/networking/telnet.c index 5ca64e1..8658660 100644 --- a/networking/telnet.c +++ b/networking/telnet.c @@ -617,19 +617,17 @@ int telnet_main(int argc, char** argv) #ifdef CONFIG_FEATURE_TELNET_AUTOLOGIN if (1 & getopt32(argc, argv, "al:", &autologin)) autologin = getenv("USER"); - - if (optind < argc) { - host = argv[optind++]; - port = bb_lookup_port((optind < argc) ? argv[optind++] : - "telnet", "tcp", 23); - if (optind < argc) - bb_show_usage(); - } else - bb_show_usage(); + argv += optind; #else - host = argv[1]; - port = bb_lookup_port((argc > 2) ? argv[2] : "telnet", "tcp", 23); + argv++; #endif + if (!*argv) + bb_show_usage(); + host = *argv++; + port = bb_lookup_port(*argv ? *argv++ : "telnet", "tcp", 23); + if (*argv) /* extra params?? */ + bb_show_usage(); + G.netfd = create_and_connect_stream_or_die(host, port); setsockopt(G.netfd, SOL_SOCKET, SO_KEEPALIVE, &one, sizeof one); |