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.
This commit is contained in:
Xin LI 2010-04-15 19:15:05 +00:00
parent c6491946d8
commit 55e999851d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=206675
2 changed files with 8 additions and 23 deletions

View File

@ -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.

View File

@ -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"