summaryrefslogtreecommitdiff
path: root/networking/nc.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2009-04-21 11:09:40 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2009-04-21 11:09:40 +0000
commit5e34ff29bcc870936ab18172f438a34d042d4e03 (patch)
treea5e7a528f2f916eb883f1161eadceacdf2dca4be /networking/nc.c
parent8b814b4a349e2262c0ad25793b05206a14651ebb (diff)
downloadbusybox-w32-5e34ff29bcc870936ab18172f438a34d042d4e03.tar.gz
busybox-w32-5e34ff29bcc870936ab18172f438a34d042d4e03.tar.bz2
busybox-w32-5e34ff29bcc870936ab18172f438a34d042d4e03.zip
*: mass renaming of USE_XXXX to IF_XXXX
and SKIP_XXXX to IF_NOT_XXXX - the second one was especially badly named. It was not skipping anything!
Diffstat (limited to 'networking/nc.c')
-rw-r--r--networking/nc.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/networking/nc.c b/networking/nc.c
index fe845f582..857d63570 100644
--- a/networking/nc.c
+++ b/networking/nc.c
@@ -29,11 +29,11 @@ int nc_main(int argc, char **argv)
29 int sfd = sfd; /* for gcc */ 29 int sfd = sfd; /* for gcc */
30 int cfd = 0; 30 int cfd = 0;
31 unsigned lport = 0; 31 unsigned lport = 0;
32 SKIP_NC_SERVER(const) unsigned do_listen = 0; 32 IF_NOT_NC_SERVER(const) unsigned do_listen = 0;
33 SKIP_NC_EXTRA (const) unsigned wsecs = 0; 33 IF_NOT_NC_EXTRA (const) unsigned wsecs = 0;
34 SKIP_NC_EXTRA (const) unsigned delay = 0; 34 IF_NOT_NC_EXTRA (const) unsigned delay = 0;
35 SKIP_NC_EXTRA (const int execparam = 0;) 35 IF_NOT_NC_EXTRA (const int execparam = 0;)
36 USE_NC_EXTRA (char **execparam = NULL;) 36 IF_NC_EXTRA (char **execparam = NULL;)
37 len_and_sockaddr *lsa; 37 len_and_sockaddr *lsa;
38 fd_set readfds, testfds; 38 fd_set readfds, testfds;
39 int opt; /* must be signed (getopt returns -1) */ 39 int opt; /* must be signed (getopt returns -1) */
@@ -42,24 +42,24 @@ int nc_main(int argc, char **argv)
42 /* getopt32 is _almost_ usable: 42 /* getopt32 is _almost_ usable:
43 ** it cannot handle "... -e prog -prog-opt" */ 43 ** it cannot handle "... -e prog -prog-opt" */
44 while ((opt = getopt(argc, argv, 44 while ((opt = getopt(argc, argv,
45 "" USE_NC_SERVER("lp:") USE_NC_EXTRA("w:i:f:e:") )) > 0 45 "" IF_NC_SERVER("lp:") IF_NC_EXTRA("w:i:f:e:") )) > 0
46 ) { 46 ) {
47 if (ENABLE_NC_SERVER && opt=='l') 47 if (ENABLE_NC_SERVER && opt=='l')
48 USE_NC_SERVER(do_listen++); 48 IF_NC_SERVER(do_listen++);
49 else if (ENABLE_NC_SERVER && opt=='p') 49 else if (ENABLE_NC_SERVER && opt=='p')
50 USE_NC_SERVER(lport = bb_lookup_port(optarg, "tcp", 0)); 50 IF_NC_SERVER(lport = bb_lookup_port(optarg, "tcp", 0));
51 else if (ENABLE_NC_EXTRA && opt=='w') 51 else if (ENABLE_NC_EXTRA && opt=='w')
52 USE_NC_EXTRA( wsecs = xatou(optarg)); 52 IF_NC_EXTRA( wsecs = xatou(optarg));
53 else if (ENABLE_NC_EXTRA && opt=='i') 53 else if (ENABLE_NC_EXTRA && opt=='i')
54 USE_NC_EXTRA( delay = xatou(optarg)); 54 IF_NC_EXTRA( delay = xatou(optarg));
55 else if (ENABLE_NC_EXTRA && opt=='f') 55 else if (ENABLE_NC_EXTRA && opt=='f')
56 USE_NC_EXTRA( cfd = xopen(optarg, O_RDWR)); 56 IF_NC_EXTRA( cfd = xopen(optarg, O_RDWR));
57 else if (ENABLE_NC_EXTRA && opt=='e' && optind <= argc) { 57 else if (ENABLE_NC_EXTRA && opt=='e' && optind <= argc) {
58 /* We cannot just 'break'. We should let getopt finish. 58 /* We cannot just 'break'. We should let getopt finish.
59 ** Or else we won't be able to find where 59 ** Or else we won't be able to find where
60 ** 'host' and 'port' params are 60 ** 'host' and 'port' params are
61 ** (think "nc -w 60 host port -e prog"). */ 61 ** (think "nc -w 60 host port -e prog"). */
62 USE_NC_EXTRA( 62 IF_NC_EXTRA(
63 char **p; 63 char **p;
64 // +2: one for progname (optarg) and one for NULL 64 // +2: one for progname (optarg) and one for NULL
65 execparam = xzalloc(sizeof(char*) * (argc - optind + 2)); 65 execparam = xzalloc(sizeof(char*) * (argc - optind + 2));
@@ -154,7 +154,7 @@ int nc_main(int argc, char **argv)
154 xmove_fd(cfd, 0); 154 xmove_fd(cfd, 0);
155 xdup2(0, 1); 155 xdup2(0, 1);
156 xdup2(0, 2); 156 xdup2(0, 2);
157 USE_NC_EXTRA(BB_EXECVP(execparam[0], execparam);) 157 IF_NC_EXTRA(BB_EXECVP(execparam[0], execparam);)
158 /* Don't print stuff or it will go over the wire.... */ 158 /* Don't print stuff or it will go over the wire.... */
159 _exit(127); 159 _exit(127);
160 } 160 }