summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjeremy <>2011-01-09 22:16:46 +0000
committerjeremy <>2011-01-09 22:16:46 +0000
commitd3c652ff017fa6f88b4f612912306f2529cfb213 (patch)
tree2f77324cb63f86865bf8a318c24675517bdec589
parent4d7b7131e400dc1324f2daa39f007c5ac043b349 (diff)
downloadopenbsd-d3c652ff017fa6f88b4f612912306f2529cfb213.tar.gz
openbsd-d3c652ff017fa6f88b4f612912306f2529cfb213.tar.bz2
openbsd-d3c652ff017fa6f88b4f612912306f2529cfb213.zip
Minor tweaks to nc(1) man page and usage.
OK jmc@, nicm@, tedu@
-rw-r--r--src/usr.bin/nc/nc.133
-rw-r--r--src/usr.bin/nc/netcat.c6
2 files changed, 23 insertions, 16 deletions
diff --git a/src/usr.bin/nc/nc.1 b/src/usr.bin/nc/nc.1
index 8745528040..f9bd5b153e 100644
--- a/src/usr.bin/nc/nc.1
+++ b/src/usr.bin/nc/nc.1
@@ -1,4 +1,4 @@
1.\" $OpenBSD: nc.1,v 1.56 2011/01/08 00:44:19 jeremy Exp $ 1.\" $OpenBSD: nc.1,v 1.57 2011/01/09 22:16:46 jeremy Exp $
2.\" 2.\"
3.\" Copyright (c) 1996 David Sacerdote 3.\" Copyright (c) 1996 David Sacerdote
4.\" All rights reserved. 4.\" All rights reserved.
@@ -25,7 +25,7 @@
25.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27.\" 27.\"
28.Dd $Mdocdate: January 8 2011 $ 28.Dd $Mdocdate: January 9 2011 $
29.Dt NC 1 29.Dt NC 1
30.Os 30.Os
31.Sh NAME 31.Sh NAME
@@ -40,7 +40,7 @@
40.Op Fl O Ar length 40.Op Fl O Ar length
41.Op Fl P Ar proxy_username 41.Op Fl P Ar proxy_username
42.Op Fl p Ar source_port 42.Op Fl p Ar source_port
43.Op Fl s Ar source_ip_address 43.Op Fl s Ar source
44.Op Fl T Ar ToS 44.Op Fl T Ar ToS
45.Op Fl V Ar rtable 45.Op Fl V Ar rtable
46.Op Fl w Ar timeout 46.Op Fl w Ar timeout
@@ -49,7 +49,7 @@
49.Fl x Ar proxy_address Ns Oo : Ns 49.Fl x Ar proxy_address Ns Oo : Ns
50.Ar port Oc 50.Ar port Oc
51.Xc Oc 51.Xc Oc
52.Op Ar hostname 52.Op Ar destination
53.Op Ar port 53.Op Ar port
54.Ek 54.Ek
55.Sh DESCRIPTION 55.Sh DESCRIPTION
@@ -57,8 +57,10 @@ The
57.Nm 57.Nm
58(or 58(or
59.Nm netcat ) 59.Nm netcat )
60utility is used for just about anything under the sun involving TCP 60utility is used for just about anything under the sun involving TCP,
61or UDP. 61UDP, or
62.Ux Ns -domain
63sockets.
62It can open TCP connections, send UDP packets, listen on arbitrary 64It can open TCP connections, send UDP packets, listen on arbitrary
63TCP and UDP ports, do port scanning, and deal with both IPv4 and 65TCP and UDP ports, do port scanning, and deal with both IPv4 and
64IPv6. 66IPv6.
@@ -153,7 +155,7 @@ instead of sequentially within a range or in the order that the system
153assigns them. 155assigns them.
154.It Fl S 156.It Fl S
155Enables the RFC 2385 TCP MD5 signature option. 157Enables the RFC 2385 TCP MD5 signature option.
156.It Fl s Ar source_ip_address 158.It Fl s Ar source
157Specifies the IP of the interface which is used to send the packets. 159Specifies the IP of the interface which is used to send the packets.
158For 160For
159.Ux Ns -domain 161.Ux Ns -domain
@@ -234,7 +236,7 @@ If the protocol is not specified, SOCKS version 5 is used.
234Requests that 236Requests that
235.Nm 237.Nm
236should connect to 238should connect to
237.Ar hostname 239.Ar destination
238using a proxy at 240using a proxy at
239.Ar proxy_address 241.Ar proxy_address
240and 242and
@@ -252,16 +254,22 @@ It is an error to use this option in conjunction with the
252option. 254option.
253.El 255.El
254.Pp 256.Pp
255.Ar hostname 257.Ar destination
256can be a numerical IP address or a symbolic hostname 258can be a numerical IP address or a symbolic hostname
257(unless the 259(unless the
258.Fl n 260.Fl n
259option is given). 261option is given).
260In general, a hostname must be specified, 262In general, a destination must be specified,
261unless the 263unless the
262.Fl l 264.Fl l
263option is given 265option is given
264(in which case the local host is used). 266(in which case the local host is used).
267For
268.Ux Ns -domain
269sockets, a destination is required and is the socket path to connect to
270(or listen on if the
271.Fl l
272option is given).
265.Pp 273.Pp
266.Ar port 274.Ar port
267can be a single integer or a range of ports. 275can be a single integer or a range of ports.
@@ -270,8 +278,7 @@ In general,
270a destination port must be specified, 278a destination port must be specified,
271unless the 279unless the
272.Fl U 280.Fl U
273option is given 281option is given.
274(in which case a socket must be specified).
275.Sh CLIENT/SERVER MODEL 282.Sh CLIENT/SERVER MODEL
276It is quite simple to build a very basic client/server model using 283It is quite simple to build a very basic client/server model using
277.Nm . 284.Nm .
@@ -404,7 +411,7 @@ IP for the local end of the connection:
404.Pp 411.Pp
405Create and listen on a 412Create and listen on a
406.Ux Ns -domain 413.Ux Ns -domain
407socket: 414stream socket:
408.Pp 415.Pp
409.Dl $ nc -lU /var/tmp/dsocket 416.Dl $ nc -lU /var/tmp/dsocket
410.Pp 417.Pp
diff --git a/src/usr.bin/nc/netcat.c b/src/usr.bin/nc/netcat.c
index 7b9fe41ba4..5c81e43e85 100644
--- a/src/usr.bin/nc/netcat.c
+++ b/src/usr.bin/nc/netcat.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: netcat.c,v 1.99 2011/01/08 00:44:19 jeremy Exp $ */ 1/* $OpenBSD: netcat.c,v 1.100 2011/01/09 22:16:46 jeremy Exp $ */
2/* 2/*
3 * Copyright (c) 2001 Eric Jackson <ericj@monkey.org> 3 * Copyright (c) 2001 Eric Jackson <ericj@monkey.org>
4 * 4 *
@@ -930,9 +930,9 @@ usage(int ret)
930{ 930{
931 fprintf(stderr, 931 fprintf(stderr,
932 "usage: nc [-46DdhklnrStUuvz] [-I length] [-i interval] [-O length]\n" 932 "usage: nc [-46DdhklnrStUuvz] [-I length] [-i interval] [-O length]\n"
933 "\t [-P proxy_username] [-p source_port] [-s source_ip_address] [-T ToS]\n" 933 "\t [-P proxy_username] [-p source_port] [-s source] [-T ToS]\n"
934 "\t [-V rtable] [-w timeout] [-X proxy_protocol]\n" 934 "\t [-V rtable] [-w timeout] [-X proxy_protocol]\n"
935 "\t [-x proxy_address[:port]] [hostname] [port]\n"); 935 "\t [-x proxy_address[:port]] [destination] [port]\n");
936 if (ret) 936 if (ret)
937 exit(1); 937 exit(1);
938} 938}