summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRob Landley2006-07-10 19:45:20 +0000
committerRob Landley2006-07-10 19:45:20 +0000
commit1cca9484db69971f652dfef48778da0dc56dad12 (patch)
tree71cb84ae857702f57bdced4a1e99b877499bfd4a /include
parent5d8843e451c01d8abfe6b5be772637310e9e581e (diff)
downloadbusybox-1cca9484db69971f652dfef48778da0dc56dad12.zip
busybox-1cca9484db69971f652dfef48778da0dc56dad12.tar.gz
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.h1
-rw-r--r--include/usage.h42
2 files changed, 31 insertions, 12 deletions
diff --git a/include/libbb.h b/include/libbb.h
index 6d62139..af45511 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -19,6 +19,7 @@
#include <fcntl.h>
#include <inttypes.h>
#include <netdb.h>
+#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
diff --git a/include/usage.h b/include/usage.h
index 3c1fb18..7c63e2f 100644
--- a/include/usage.h
+++ b/include/usage.h
@@ -2105,23 +2105,41 @@ USE_FEATURE_MDEV_CONFIG( \
" or\n" \
"$ nameif -c /etc/my_mactab_file\n" \
-#ifdef CONFIG_NC_GAPING_SECURITY_HOLE
-# define USAGE_NC_EXEC(a) a
+#if ENABLE_NC_SERVER || ENABLE_NC_EXTRA
+#define NC_BR1 "["
+#define NC_BR2 "]"
#else
-# define USAGE_NC_EXEC(a)
+#define NC_BR1
+#define NC_BR2
#endif
+
#define nc_trivial_usage \
- "[OPTIONS] [IP] [port]"
+ "[" \
+ NC_BR1 USE_NC_SERVER("-lp")USE_NC_EXTRA("iwf") NC_BR2 \
+ " ["USE_NC_EXTRA("FILENAME|")"{IPADDR PORTNUM}]"USE_NC_EXTRA(" [-e COMMAND]")
#define nc_full_usage \
- "Netcat opens a pipe to IP:port\n\n" \
- "Options:\n" \
- "\t-l\t\tlisten mode, for inbound connects\n" \
- "\t-p PORT\t\tlocal port number\n" \
- "\t-i SECS\t\tdelay interval for lines sent\n" \
- USAGE_NC_EXEC( \
- "\t-e PROG\t\tprogram to exec after connect (dangerous!)\n" \
+ "Netcat opens a pipe, either to IP:port\n\n" \
+ "Options:" \
+ USE_NC_EXTRA( \
+ "\n\t-e\t\texec rest of command line after connect\n" \
+ "\t-i SECS\t\tdelay interval for lines sent\n" \
+ "\t-w SECS\t\ttimeout for connect\n" \
+ "\t-f filename\tuse file (ala /dev/ttyS0) instead of network" \
) \
- "\t-w SECS\t\ttimeout for connects and final net reads"
+ USE_NC_SERVER( \
+ "\n\t-l\t\tlisten mode, for inbound connects\n" \
+ USE_NC_EXTRA("\t\t\t(use -l twice with -e for persistent server)\n") \
+ "\t-p PORT\t\tlocal port number" \
+ )
+
+
+#define nc_notes_usage "" \
+ USE_NC_EXTRA( \
+ "To use netcat as a terminal emulator on a serial port:\n\n" \
+ "$ stty 115200 -F /dev/ttyS0\n" \
+ "$ stty raw -echo -ctlecho && nc -f /dev/ttyS0\n" \
+ ) ""
+
#define nc_example_usage \
"$ nc foobar.somedomain.com 25\n" \
"220 foobar ESMTP Exim 3.12 #1 Sat, 15 Apr 2000 00:03:02 -0600\n" \