Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/networking/nc.c
- Timestamp:
- Dec 20, 2016, 4:07:32 PM (7 years ago)
- Location:
- branches/3.3
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mindi-busybox/networking/nc.c
r3232 r3621 9 9 10 10 #include "libbb.h" 11 #include "common_bufsiz.h" 11 12 12 13 //config:config NC … … 25 26 //config: 26 27 //config:config NC_EXTRA 27 //config: bool "Netcat extensions (-eiw and filename)"28 //config: bool "Netcat extensions (-eiw and -f FILE)" 28 29 //config: default y 29 30 //config: depends on NC … … 41 42 //config: The code is about 2.5k bigger. It enables 42 43 //config: -s ADDR, -n, -u, -v, -o FILE, -z options, but loses 43 //config: busybox-specific extensions: -f FILE and -ll.44 //config: busybox-specific extensions: -f FILE. 44 45 45 46 #if ENABLE_NC_110_COMPAT … … 61 62 //usage: "Open a pipe to IP:PORT" IF_NC_EXTRA(" or FILE") 62 63 //usage: NC_OPTIONS_STR 63 //usage: IF_NC_EXTRA(64 //usage: "\n -e PROG Run PROG after connect"65 64 //usage: IF_NC_SERVER( 66 65 //usage: "\n -l Listen mode, for inbound connects" 67 66 //usage: IF_NC_EXTRA( 68 //usage: "\n (use -l twice with -e for persistent server)") 67 //usage: "\n (use -ll with -e for persistent server)" 68 //usage: ) 69 69 //usage: "\n -p PORT Local port" 70 70 //usage: ) 71 //usage: "\n -w SEC Timeout for connect" 71 //usage: IF_NC_EXTRA( 72 //usage: "\n -w SEC Connect timeout" 72 73 //usage: "\n -i SEC Delay interval for lines sent" 73 74 //usage: "\n -f FILE Use file (ala /dev/ttyS0) instead of network" 75 //usage: "\n -e PROG Run PROG after connect" 74 76 //usage: ) 75 77 //usage: … … 148 150 } 149 151 ) 150 /* optind points to argv[ar vc] (NULL) now.152 /* optind points to argv[argc] (NULL) now. 151 153 ** FIXME: we assume that getopt will not count options 152 154 ** possibly present on "-e PROG ARGS" and will not … … 227 229 xmove_fd(cfd, 0); 228 230 xdup2(0, 1); 229 xdup2(0, 2);231 /*xdup2(0, 2); - original nc 1.10 does this, we don't */ 230 232 IF_NC_EXTRA(BB_EXECVP(execparam[0], execparam);) 231 /* Don't print stuff or it will go over the wire... */ 232 _exit(127); 233 IF_NC_EXTRA(bb_perror_msg_and_die("can't execute '%s'", execparam[0]);) 233 234 } 234 235 … … 239 240 FD_SET(STDIN_FILENO, &readfds); 240 241 242 #define iobuf bb_common_bufsiz1 243 setup_common_bufsiz(); 241 244 for (;;) { 242 245 int fd; … … 249 252 bb_perror_msg_and_die("select"); 250 253 251 #define iobuf bb_common_bufsiz1252 254 fd = STDIN_FILENO; 253 255 while (1) { 254 256 if (FD_ISSET(fd, &testfds)) { 255 nread = safe_read(fd, iobuf, sizeof(iobuf));257 nread = safe_read(fd, iobuf, COMMON_BUFSIZE); 256 258 if (fd == cfd) { 257 259 if (nread < 1) … … 262 264 /* Close outgoing half-connection so they get EOF, 263 265 * but leave incoming alone so we can see response */ 264 shutdown(cfd, 1);266 shutdown(cfd, SHUT_WR); 265 267 FD_CLR(STDIN_FILENO, &readfds); 266 268 }
Note:
See TracChangeset
for help on using the changeset viewer.