From 29fe7265b8c1917ebc03283f22a3eb61e9195979 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Thu, 5 Apr 2007 20:26:28 +0000 Subject: nc: port nc 1.10 to busybox --- include/libbb.h | 10 ++++++++++ include/usage.h | 31 +++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) (limited to 'include') diff --git a/include/libbb.h b/include/libbb.h index e5413b1a4..91715c16a 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -334,6 +334,7 @@ enum { }; /* Create stream socket, and allocated suitable lsa * (lsa of correct size and lsa->sa.sa_family (AF_INET/AF_INET6)) */ +int xsocket_type(len_and_sockaddr **lsap, int sock_type); int xsocket_stream(len_and_sockaddr **lsap); /* Create server socket bound to bindaddr:port. bindaddr can be NULL, * numeric IP ("N.N.N.N") or numeric IPv6 address, @@ -388,6 +389,15 @@ struct hostent *xgethostbyname(const char *name); // + inet_common.c has additional IPv4-only stuff +void socket_want_pktinfo(int fd); +ssize_t send_to_from(int fd, void *buf, size_t len, int flags, + const struct sockaddr *from, const struct sockaddr *to, + socklen_t tolen); +ssize_t recv_from_to(int fd, void *buf, size_t len, int flags, + struct sockaddr *from, struct sockaddr *to, + socklen_t sa_size); + + extern char *xstrdup(const char *s); extern char *xstrndup(const char *s, int n); extern char *safe_strncpy(char *dst, const char *src, size_t size); diff --git a/include/usage.h b/include/usage.h index c729532e5..fe4cd903c 100644 --- a/include/usage.h +++ b/include/usage.h @@ -2314,6 +2314,8 @@ " or\n" \ "$ nameif -c /etc/my_mactab_file\n" \ +#if !ENABLE_DESKTOP + #if ENABLE_NC_SERVER || ENABLE_NC_EXTRA #define NC_OPTIONS_STR "\n\nOptions:" #else @@ -2356,6 +2358,35 @@ "quit\n" \ "221 foobar closing connection\n" +#else /* DESKTOP nc - much more compatible with nc 1.10 */ + +#define nc_trivial_usage \ + "[-options] hostname port - connect" \ + USE_NC_SERVER("\nnc [-options] -l -p port [hostname] [port] - listen") +#define nc_full_usage \ + USE_NC_SERVER( \ + "-l Listen mode, for inbound connects\n" \ + ) \ + "-n Do not do DNS resolution" \ + "\n-s addr Local address" \ + "\n-p port Local port" \ + "\n-u UDP mode" \ + "\n-v Verbose (cumulative: -vv)" \ + "\n-w secs Timeout for connects and final net reads" \ + USE_NC_EXTRA( \ + "\n-i sec Delay interval for lines sent" /* ", ports scanned" */ \ + "\n-o file Hex dump of traffic" \ + "\n-z Zero-I/O mode (scanning)" \ + ) \ + "\n-e prog [args] Program to exec after connect (must be last)" \ +/* "\n-r Randomize local and remote ports" */ +/* "\n-g gateway Source-routing hop point[s], up to 8" */ +/* "\n-G num Source-routing pointer: 4, 8, 12, ..." */ +/* "\nport numbers can be individual or ranges: lo-hi [inclusive]" */ + +#endif + + #define netstat_trivial_usage \ "[-laenrtuwx]" #define netstat_full_usage \ -- cgit v1.2.3