diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-22 14:12:08 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-22 14:12:08 +0000 |
commit | 703e20235aa0624d3ff4335c1e86edaa6e21efe2 (patch) | |
tree | 49e8451efad93b75c0be74ee553d3b3f8c04a25d /networking/nc.c | |
parent | 6cd2d2bcba37a13d0d73326dd7bca64bbccce4f8 (diff) | |
download | busybox-w32-703e20235aa0624d3ff4335c1e86edaa6e21efe2.tar.gz busybox-w32-703e20235aa0624d3ff4335c1e86edaa6e21efe2.tar.bz2 busybox-w32-703e20235aa0624d3ff4335c1e86edaa6e21efe2.zip |
cleanups: unnecessary casts, unified const_1, eliminate cross-.c file
prototypes (heresy!), add spaces in places like "flags&NETSTAT_CONNECTED",
removed unused #defines, #ifdef -> #if, use uint32_t for ipv4 addrs.
Diffstat (limited to 'networking/nc.c')
-rw-r--r-- | networking/nc.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/networking/nc.c b/networking/nc.c index 09d89b0a8..dc9102b2a 100644 --- a/networking/nc.c +++ b/networking/nc.c | |||
@@ -43,10 +43,10 @@ int nc_main(int argc, char **argv) | |||
43 | else if (ENABLE_NC_SERVER && opt=='p') { | 43 | else if (ENABLE_NC_SERVER && opt=='p') { |
44 | USE_NC_SERVER(lport = bb_lookup_port(optarg, "tcp", 0)); | 44 | USE_NC_SERVER(lport = bb_lookup_port(optarg, "tcp", 0)); |
45 | } | 45 | } |
46 | else if (ENABLE_NC_EXTRA && opt=='w') USE_NC_EXTRA( wsecs = xatou(optarg)); | 46 | else if (ENABLE_NC_EXTRA && opt=='w') USE_NC_EXTRA( wsecs = xatou(optarg)); |
47 | else if (ENABLE_NC_EXTRA && opt=='i') USE_NC_EXTRA( delay = xatou(optarg)); | 47 | else if (ENABLE_NC_EXTRA && opt=='i') USE_NC_EXTRA( delay = xatou(optarg)); |
48 | else if (ENABLE_NC_EXTRA && opt=='f') USE_NC_EXTRA( cfd = xopen(optarg, O_RDWR)); | 48 | else if (ENABLE_NC_EXTRA && opt=='f') USE_NC_EXTRA( cfd = xopen(optarg, O_RDWR)); |
49 | else if (ENABLE_NC_EXTRA && opt=='e' && optind<=argc) { | 49 | else if (ENABLE_NC_EXTRA && opt=='e' && optind<=argc) { |
50 | /* We cannot just 'break'. We should let getopt finish. | 50 | /* We cannot just 'break'. We should let getopt finish. |
51 | ** Or else we won't be able to find where | 51 | ** Or else we won't be able to find where |
52 | ** 'host' and 'port' params are | 52 | ** 'host' and 'port' params are |
@@ -91,8 +91,6 @@ int nc_main(int argc, char **argv) | |||
91 | 91 | ||
92 | if (!cfd) { | 92 | if (!cfd) { |
93 | if (do_listen) { | 93 | if (do_listen) { |
94 | socklen_t addrlen; | ||
95 | |||
96 | /* create_and_bind_stream_or_die(NULL, lport) | 94 | /* create_and_bind_stream_or_die(NULL, lport) |
97 | * would've work wonderfully, but we need | 95 | * would've work wonderfully, but we need |
98 | * to know lsa */ | 96 | * to know lsa */ |
@@ -105,15 +103,14 @@ int nc_main(int argc, char **argv) | |||
105 | /* If we didn't specify a port number, | 103 | /* If we didn't specify a port number, |
106 | * query and print it after listen() */ | 104 | * query and print it after listen() */ |
107 | if (!lport) { | 105 | if (!lport) { |
108 | addrlen = lsa->len; | 106 | socklen_t addrlen = lsa->len; |
109 | getsockname(sfd, &lsa->sa, &addrlen); | 107 | getsockname(sfd, &lsa->sa, &addrlen); |
110 | lport = get_nport(lsa); | 108 | lport = get_nport(lsa); |
111 | fdprintf(2, "%d\n", ntohs(lport)); | 109 | fdprintf(2, "%d\n", ntohs(lport)); |
112 | } | 110 | } |
113 | fcntl(sfd, F_SETFD, FD_CLOEXEC); | 111 | fcntl(sfd, F_SETFD, FD_CLOEXEC); |
114 | accept_again: | 112 | accept_again: |
115 | addrlen = lsa->len; | 113 | cfd = accept(sfd, NULL, 0); |
116 | cfd = accept(sfd, NULL, 0); /* &lsa->sa, &addrlen); */ | ||
117 | if (cfd < 0) | 114 | if (cfd < 0) |
118 | bb_perror_msg_and_die("accept"); | 115 | bb_perror_msg_and_die("accept"); |
119 | if (!execparam) | 116 | if (!execparam) |