/* vi: set sw=4 ts=4: */
/* nc: mini-netcat - built from the ground up for LRP
- *
+ *
* Copyright (C) 1998, 1999 Charles P. Wright
* Copyright (C) 1998 Dave Cinege
- *
+ *
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
memset(&address, 0, sizeof(address));
- if (ENABLE_NC_SERVER || ENABLE_NC_EXTRA) {
+ if (ENABLE_NC_SERVER || ENABLE_NC_EXTRA) {
while ((opt = getopt(argc, argv, "lp:" USE_NC_EXTRA("i:ew:f:"))) > 0) {
if (ENABLE_NC_SERVER && opt=='l') do_listen++;
else if (ENABLE_NC_SERVER && opt=='p')
}
}
-
+
// For listen or file we need zero arguments, dialout is 2.
// For exec we need at least one more argument at the end, more ok
signal(SIGALRM, timeout);
alarm(wsecs);
}
-
- if (infile) cfd = bb_xopen(infile, O_RDWR);
+
+ if (infile) cfd = xopen(infile, O_RDWR);
else {
opt = 1;
- sfd = bb_xsocket(AF_INET, SOCK_STREAM, 0);
+ sfd = xsocket(AF_INET, SOCK_STREAM, 0);
fcntl(sfd, F_SETFD, FD_CLOEXEC);
setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof (opt));
address.sin_family = AF_INET;
if (lport != 0) {
address.sin_port = lport;
- bb_xbind(sfd, (struct sockaddr *) &address, sizeof(address));
+ xbind(sfd, (struct sockaddr *) &address, sizeof(address));
}
if (do_listen) {
socklen_t addrlen = sizeof(address);
- bb_xlisten(sfd, do_listen);
+ xlisten(sfd, do_listen);
// If we didn't specify a port number, query and print it to stderr.
}
// Select loop copying stdin to cfd, and cfd to stdout.
-
+
FD_ZERO(&readfds);
FD_SET(cfd, &readfds);
FD_SET(STDIN_FILENO, &readfds);