Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Apr 2010 19:15:05 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r206675 - head/contrib/netcat
Message-ID:  <201004151915.o3FJF5wP092481@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Thu Apr 15 19:15:05 2010
New Revision: 206675
URL: http://svn.freebsd.org/changeset/base/206675

Log:
  Diff reduction with OpenBSD:
  
   - Remove unused locally added variable;
   - Deprecate -o: it's the default behavior on OpenBSD.
  
  X-MFC:	along with nc 4.7.

Modified:
  head/contrib/netcat/nc.1
  head/contrib/netcat/netcat.c

Modified: head/contrib/netcat/nc.1
==============================================================================
--- head/contrib/netcat/nc.1	Thu Apr 15 18:30:21 2010	(r206674)
+++ head/contrib/netcat/nc.1	Thu Apr 15 19:15:05 2010	(r206675)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 23, 2010
+.Dd April 15, 2010
 .Dt NC 1
 .Os
 .Sh NAME
@@ -36,7 +36,7 @@
 .Sh SYNOPSIS
 .Nm nc
 .Bk -words
-.Op Fl 46DdEhklnorStUuvz
+.Op Fl 46DdEhklnrStUuvz
 .Op Fl e Ar IPsec_policy
 .Op Fl I Ar length
 .Op Fl i Ar interval
@@ -159,15 +159,6 @@ socket option.
 .It Fl O Ar length
 Specifies the size of the TCP send buffer.
 When
-.It Fl o
-.Dq Once-only mode .
-By default,
-.Nm
-does not terminate on EOF condition on input,
-but continues until the network side has been closed down.
-Specifying
-.Fl o
-will make it terminate on EOF as well.
 .It Fl P Ar proxy_username
 Specifies a username to present to a proxy server that requires authentication.
 If no username is specified then authentication will not be attempted.

Modified: head/contrib/netcat/netcat.c
==============================================================================
--- head/contrib/netcat/netcat.c	Thu Apr 15 18:30:21 2010	(r206674)
+++ head/contrib/netcat/netcat.c	Thu Apr 15 19:15:05 2010	(r206675)
@@ -72,14 +72,12 @@
 #define PORT_MAX_LEN	6
 
 /* Command Line Options */
-int	Eflag;					/* Use IPsec ESP */
 int	dflag;					/* detached, no stdin */
 unsigned int iflag;				/* Interval Flag */
 int	jflag;					/* use jumbo frames if we can */
 int	kflag;					/* More than one connect */
 int	lflag;					/* Bind to local port */
 int	nflag;					/* Don't do name look up */
-int	oflag;					/* Once only: stop on EOF */
 int	FreeBSD_Oflag;				/* Do not use TCP options */
 char   *Pflag;					/* Proxy username */
 char   *pflag;					/* Localport flag */
@@ -151,7 +149,7 @@ main(int argc, char *argv[])
 	sv = NULL;
 
 	while ((ch = getopt_long(argc, argv,
-	    "46DdEe:hI:i:jklnO:oP:p:rSs:tT:UuV:vw:X:x:z",
+	    "46DdEe:hI:i:jklnoO:P:p:rSs:tT:UuV:vw:X:x:z",
 	    longopts, NULL)) != -1) {
 		switch (ch) {
 		case '4':
@@ -214,7 +212,7 @@ main(int argc, char *argv[])
 			nflag = 1;
 			break;
 		case 'o':
-			oflag = 1;
+			fprintf(stderr, "option -o is deprecated.\n");
 			break;
 		case 'P':
 			Pflag = optarg;
@@ -282,8 +280,6 @@ main(int argc, char *argv[])
 		case 'T':
 			Tflag = parse_iptos(optarg);
 			break;
-		case 0:
-			break;
 		default:
 			usage(1);
 		}
@@ -729,10 +725,9 @@ readwrite(int nfd)
 		}
 
 		if (!dflag && pfd[1].revents & POLLIN) {
-			if ((n = read(wfd, buf, plen)) < 0 ||
-			    (oflag && n == 0)) {
+			if ((n = read(wfd, buf, plen)) < 0)
 				return;
-			} else if (n == 0) {
+			else if (n == 0) {
 				shutdown(nfd, SHUT_WR);
 				pfd[1].fd = -1;
 				pfd[1].events = 0;
@@ -945,7 +940,6 @@ help(void)
 	\t-n		Suppress name/port resolutions\n\
 	\t--no-tcpopt	Disable TCP options\n\
 	\t-O length	TCP send buffer length\n\
-	\t-o		Terminate on EOF on input\n\
 	\t-P proxyuser\tUsername for proxy authentication\n\
 	\t-p port\t	Specify local port for remote connects\n\
 	\t-r		Randomize remote ports\n\
@@ -995,9 +989,9 @@ usage(int ret)
 {
 	fprintf(stderr,
 #ifdef IPSEC
-	    "usage: nc [-46DdEhklnorStUuvz] [-e policy] [-I length] [-i interval] [-O length]\n"
+	    "usage: nc [-46DdEhklnrStUuvz] [-e policy] [-I length] [-i interval] [-O length]\n"
 #else
-	    "usage: nc [-46DdhklnorStUuvz] [-I length] [-i interval] [-O length]\n"
+	    "usage: nc [-46DdhklnrStUuvz] [-I length] [-i interval] [-O length]\n"
 #endif
 	    "\t  [-P proxy_username] [-p source_port] [-s source_ip_address] [-T ToS]\n"
 	    "\t  [-V fib] [-w timeout] [-X proxy_protocol]\n"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201004151915.o3FJF5wP092481>