[Midnightbsd-cvs] src [11440] trunk/usr.bin/rsh/rsh.c: add N flag
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sat Jul 7 11:52:48 EDT 2018
Revision: 11440
http://svnweb.midnightbsd.org/src/?rev=11440
Author: laffer1
Date: 2018-07-07 11:52:47 -0400 (Sat, 07 Jul 2018)
Log Message:
-----------
add N flag
Modified Paths:
--------------
trunk/usr.bin/rsh/Makefile
trunk/usr.bin/rsh/rsh.1
trunk/usr.bin/rsh/rsh.c
Property Changed:
----------------
trunk/usr.bin/rsh/rsh.1
Modified: trunk/usr.bin/rsh/Makefile
===================================================================
--- trunk/usr.bin/rsh/Makefile 2018-07-07 15:52:29 UTC (rev 11439)
+++ trunk/usr.bin/rsh/Makefile 2018-07-07 15:52:47 UTC (rev 11440)
@@ -1,5 +1,6 @@
+# $MidnightBSD$
# @(#)Makefile 8.1 (Berkeley) 7/19/93
-# $MidnightBSD$
+# $FreeBSD: stable/10/usr.bin/rsh/Makefile 201386 2010-01-02 10:27:05Z ed $
PROG= rsh
CFLAGS+=-I${.CURDIR}/../../libexec/rlogind
Modified: trunk/usr.bin/rsh/rsh.1
===================================================================
--- trunk/usr.bin/rsh/rsh.1 2018-07-07 15:52:29 UTC (rev 11439)
+++ trunk/usr.bin/rsh/rsh.1 2018-07-07 15:52:47 UTC (rev 11440)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
.\" Copyright (c) 1983, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
@@ -26,9 +27,9 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)rsh.1 8.1 (Berkeley) 6/6/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/usr.bin/rsh/rsh.1 325474 2017-11-06 12:45:51Z eugen $
.\"
-.Dd October 16, 2002
+.Dd July 3, 2017
.Dt RSH 1
.Os
.Sh NAME
@@ -36,11 +37,20 @@
.Nd remote shell
.Sh SYNOPSIS
.Nm
-.Op Fl 46dn
+.Op Fl 46dnN
.Op Fl l Ar username
.Op Fl t Ar timeout
.Ar host
.Op command
+.Sh DEPRECATION NOTICE
+.Nm
+is deprecated and will be removed from future versions of the
+.Fx
+base system.
+If
+.Nm
+is still required, it can be installed from ports or packages
+(net/bsdrcmds).
.Sh DESCRIPTION
The
.Nm
@@ -78,12 +88,22 @@
Authorization is determined
as in
.Xr rlogin 1 .
+.It Fl N
+Opposite to
+.Fl n
+option: do not send the "end of file" (EOF) indication for input stream
+to the remote host. This option makes the
+.Nm
+utility compatible with protocol implementations confused by receiving
+EOF, like some Cisco IOS versions. Disables
+.Fl n .
.It Fl n
Redirect input from the special device
.Pa /dev/null
(see the
.Sx BUGS
-section of this manual page).
+section of this manual page). Disables
+.Fl N .
.It Fl t Ar timeout
Allow a
.Ar timeout
Property changes on: trunk/usr.bin/rsh/rsh.1
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/usr.bin/rsh/rsh.c
===================================================================
--- trunk/usr.bin/rsh/rsh.c 2018-07-07 15:52:29 UTC (rev 11439)
+++ trunk/usr.bin/rsh/rsh.c 2018-07-07 15:52:47 UTC (rev 11440)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1983, 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -51,7 +52,7 @@
#endif
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/rsh/rsh.c 325474 2017-11-06 12:45:51Z eugen $");
#include <sys/param.h>
#include <sys/signal.h>
@@ -85,7 +86,7 @@
void connect_timeout(int);
char *copyargs(char * const *);
void sendsig(int);
-void talk(int, long, pid_t, int, int);
+void talk(int, int, long, pid_t, int, int);
void usage(void);
int
@@ -94,13 +95,13 @@
struct passwd const *pw;
struct servent const *sp;
long omask;
- int argoff, asrsh, ch, dflag, nflag, one, rem;
+ int argoff, asrsh, ch, dflag, nflag, Nflag, one, rem;
pid_t pid = 0;
uid_t uid;
char *args, *host, *p, *user;
int timeout = 0;
- argoff = asrsh = dflag = nflag = 0;
+ argoff = asrsh = dflag = nflag = Nflag = 0;
one = 1;
host = user = NULL;
@@ -120,7 +121,7 @@
argoff = 1;
}
-#define OPTIONS "468Lde:l:nt:w"
+#define OPTIONS "468LNde:l:nt:w"
while ((ch = getopt(argc - argoff, argv + argoff, OPTIONS)) != -1)
switch(ch) {
case '4':
@@ -131,6 +132,10 @@
family = PF_INET6;
break;
+ case 'N':
+ Nflag = 1;
+ nflag = 0;
+ break;
case 'L': /* -8Lew are ignored to allow rlogin aliases */
case 'e':
case 'w':
@@ -144,6 +149,7 @@
break;
case 'n':
nflag = 1;
+ Nflag = 0;
break;
case 't':
timeout = atoi(optarg);
@@ -227,7 +233,7 @@
(void)ioctl(rfd2, FIONBIO, &one);
(void)ioctl(rem, FIONBIO, &one);
- talk(nflag, omask, pid, rem, timeout);
+ talk(nflag, Nflag, omask, pid, rem, timeout);
if (!nflag)
(void)kill(pid, SIGKILL);
@@ -235,7 +241,7 @@
}
void
-talk(int nflag, long omask, pid_t pid, int rem, int timeout)
+talk(int nflag, int Nflag, long omask, pid_t pid, int rem, int timeout)
{
int cc, wc;
fd_set readfrom, ready, rembits;
@@ -276,8 +282,8 @@
if (cc == 0)
goto reread;
goto rewrite;
-done:
- (void)shutdown(rem, SHUT_WR);
+done: if (!Nflag)
+ (void)shutdown(rem, SHUT_WR);
exit(0);
}
@@ -371,6 +377,6 @@
{
(void)fprintf(stderr,
- "usage: rsh [-46dn] [-l username] [-t timeout] host [command]\n");
+ "usage: rsh [-46Ndn] [-l username] [-t timeout] host [command]\n");
exit(1);
}
More information about the Midnightbsd-cvs
mailing list