diff options
author | Rob Landley <rob@landley.net> | 2006-07-10 19:45:20 +0000 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2006-07-10 19:45:20 +0000 |
commit | 1cca9484db69971f652dfef48778da0dc56dad12 (patch) | |
tree | 71cb84ae857702f57bdced4a1e99b877499bfd4a /include | |
parent | 5d8843e451c01d8abfe6b5be772637310e9e581e (diff) | |
download | busybox-w32-1cca9484db69971f652dfef48778da0dc56dad12.tar.gz busybox-w32-1cca9484db69971f652dfef48778da0dc56dad12.tar.bz2 busybox-w32-1cca9484db69971f652dfef48778da0dc56dad12.zip |
Upgrade netcat a lot. Make -e able to take the rest of the command line as
what to exec. Add -f mode and a brief explanation of how to use it to replace
minicom. Add -l -l mode so you can turn any command into a server. And group
all of netcat's command line options under two CONFIG entries, so if you
disable both it doesn't use getopt at all.
Diffstat (limited to 'include')
-rw-r--r-- | include/libbb.h | 1 | ||||
-rw-r--r-- | include/usage.h | 42 |
2 files changed, 31 insertions, 12 deletions
diff --git a/include/libbb.h b/include/libbb.h index 6d6213901..af45511d4 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <fcntl.h> | 19 | #include <fcntl.h> |
20 | #include <inttypes.h> | 20 | #include <inttypes.h> |
21 | #include <netdb.h> | 21 | #include <netdb.h> |
22 | #include <signal.h> | ||
22 | #include <stdio.h> | 23 | #include <stdio.h> |
23 | #include <stdlib.h> | 24 | #include <stdlib.h> |
24 | #include <stdarg.h> | 25 | #include <stdarg.h> |
diff --git a/include/usage.h b/include/usage.h index 3c1fb18e9..7c63e2f85 100644 --- a/include/usage.h +++ b/include/usage.h | |||
@@ -2105,23 +2105,41 @@ USE_FEATURE_MDEV_CONFIG( \ | |||
2105 | " or\n" \ | 2105 | " or\n" \ |
2106 | "$ nameif -c /etc/my_mactab_file\n" \ | 2106 | "$ nameif -c /etc/my_mactab_file\n" \ |
2107 | 2107 | ||
2108 | #ifdef CONFIG_NC_GAPING_SECURITY_HOLE | 2108 | #if ENABLE_NC_SERVER || ENABLE_NC_EXTRA |
2109 | # define USAGE_NC_EXEC(a) a | 2109 | #define NC_BR1 "[" |
2110 | #define NC_BR2 "]" | ||
2110 | #else | 2111 | #else |
2111 | # define USAGE_NC_EXEC(a) | 2112 | #define NC_BR1 |
2113 | #define NC_BR2 | ||
2112 | #endif | 2114 | #endif |
2115 | |||
2113 | #define nc_trivial_usage \ | 2116 | #define nc_trivial_usage \ |
2114 | "[OPTIONS] [IP] [port]" | 2117 | "[" \ |
2118 | NC_BR1 USE_NC_SERVER("-lp")USE_NC_EXTRA("iwf") NC_BR2 \ | ||
2119 | " ["USE_NC_EXTRA("FILENAME|")"{IPADDR PORTNUM}]"USE_NC_EXTRA(" [-e COMMAND]") | ||
2115 | #define nc_full_usage \ | 2120 | #define nc_full_usage \ |
2116 | "Netcat opens a pipe to IP:port\n\n" \ | 2121 | "Netcat opens a pipe, either to IP:port\n\n" \ |
2117 | "Options:\n" \ | 2122 | "Options:" \ |
2118 | "\t-l\t\tlisten mode, for inbound connects\n" \ | 2123 | USE_NC_EXTRA( \ |
2119 | "\t-p PORT\t\tlocal port number\n" \ | 2124 | "\n\t-e\t\texec rest of command line after connect\n" \ |
2120 | "\t-i SECS\t\tdelay interval for lines sent\n" \ | 2125 | "\t-i SECS\t\tdelay interval for lines sent\n" \ |
2121 | USAGE_NC_EXEC( \ | 2126 | "\t-w SECS\t\ttimeout for connect\n" \ |
2122 | "\t-e PROG\t\tprogram to exec after connect (dangerous!)\n" \ | 2127 | "\t-f filename\tuse file (ala /dev/ttyS0) instead of network" \ |
2123 | ) \ | 2128 | ) \ |
2124 | "\t-w SECS\t\ttimeout for connects and final net reads" | 2129 | USE_NC_SERVER( \ |
2130 | "\n\t-l\t\tlisten mode, for inbound connects\n" \ | ||
2131 | USE_NC_EXTRA("\t\t\t(use -l twice with -e for persistent server)\n") \ | ||
2132 | "\t-p PORT\t\tlocal port number" \ | ||
2133 | ) | ||
2134 | |||
2135 | |||
2136 | #define nc_notes_usage "" \ | ||
2137 | USE_NC_EXTRA( \ | ||
2138 | "To use netcat as a terminal emulator on a serial port:\n\n" \ | ||
2139 | "$ stty 115200 -F /dev/ttyS0\n" \ | ||
2140 | "$ stty raw -echo -ctlecho && nc -f /dev/ttyS0\n" \ | ||
2141 | ) "" | ||
2142 | |||
2125 | #define nc_example_usage \ | 2143 | #define nc_example_usage \ |
2126 | "$ nc foobar.somedomain.com 25\n" \ | 2144 | "$ nc foobar.somedomain.com 25\n" \ |
2127 | "220 foobar ESMTP Exim 3.12 #1 Sat, 15 Apr 2000 00:03:02 -0600\n" \ | 2145 | "220 foobar ESMTP Exim 3.12 #1 Sat, 15 Apr 2000 00:03:02 -0600\n" \ |