CVS commit: src/usr.bin/rlogin

2021-08-03 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Tue Aug  3 23:21:07 UTC 2021

Modified Files:
src/usr.bin/rlogin: rlogin.c

Log Message:
revert rev 1.45:
  "PR/54435: Adjust for new kernel behavior of soreceive(9) clearing MSG_OOB"

That change was trying to make rlogin work again after the SIOCATMARK ioctl
was broken, but that kernel bug has now been fixed, so the original rlogin code
now works again.  Further, the changed rlogin code actually did the wrong thing,
by treating reception of the MSG_OOB byte as meaning that we are now
"at the mark", but that is not true... we are "at the mark" only when
we have reached the point in the stream where the MSG_OOB byte was originally,
as indicated by SIOCATMARK.  So going back to the previous code seems best
all around.  ok'd by christos.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/usr.bin/rlogin/rlogin.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/rlogin/rlogin.c
diff -u src/usr.bin/rlogin/rlogin.c:1.47 src/usr.bin/rlogin/rlogin.c:1.48
--- src/usr.bin/rlogin/rlogin.c:1.47	Sun May  3 16:32:16 2020
+++ src/usr.bin/rlogin/rlogin.c	Tue Aug  3 23:21:07 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: rlogin.c,v 1.47 2020/05/03 16:32:16 christos Exp $	*/
+/*	$NetBSD: rlogin.c,v 1.48 2021/08/03 23:21:07 chs Exp $	*/
 
 /*
  * Copyright (c) 1983, 1990, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)rlogin.c	8.4 (Berkeley) 4/29/95";
 #else
-__RCSID("$NetBSD: rlogin.c,v 1.47 2020/05/03 16:32:16 christos Exp $");
+__RCSID("$NetBSD: rlogin.c,v 1.48 2021/08/03 23:21:07 chs Exp $");
 #endif
 #endif /* not lint */
 
@@ -577,34 +577,16 @@ static pid_t ppid;
 static ssize_t rcvcnt, rcvstate;
 static char rcvbuf[8 * 1024];
 
-static int
-recvx(int fd, void *buf, size_t len, int flags, int *msgflags)
-{
-	struct msghdr msg;
-	struct iovec iov;
-	int error;
-
-	memset(, 0, sizeof(msg));
-	msg.msg_iov = 
-	iov.iov_base = buf;
-	iov.iov_len = len;
-	error = recvmsg(fd, , flags);
-	if (error)
-		return error;
-	*msgflags = msg.msg_flags;
-	return 0;
-}
-
 static void
 oob(int signo)
 {
 	struct termios tty;
-	int atmark = 0;
+	int atmark;
 	ssize_t n, rcvd;
 	char waste[BUFSIZ], mark;
 
 	rcvd = 0;
-	while (recvx(rem, , 1, MSG_OOB, ) == -1) {
+	while (recv(rem, , 1, MSG_OOB) == -1) {
 		switch (errno) {
 		case EWOULDBLOCK:
 			/*
@@ -628,7 +610,6 @@ oob(int signo)
 			return;
 		}
 	}
-	atmark &= MSG_OOB;
 	if (mark & TIOCPKT_WINDOW) {
 		/* Let server know about window size changes */
 		(void)kill(ppid, SIGUSR1);
@@ -645,8 +626,17 @@ oob(int signo)
 	}
 	if (mark & TIOCPKT_FLUSHWRITE) {
 		(void)tcflush(1, TCIOFLUSH);
-		if (!atmark)
+		for (;;) {
+			if (ioctl(rem, SIOCATMARK, ) < 0) {
+warn("ioctl SIOCATMARK (ignored)");
+break;
+			}
+			if (atmark)
+break;
 			n = read(rem, waste, sizeof (waste));
+			if (n <= 0)
+break;
+		}
 		/*
 		 * Don't want any pending data to be output, so clear the recv
 		 * buffer.  If we were hanging on a write when interrupted,



CVS commit: src/usr.bin/rlogin

2020-05-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun May  3 16:32:16 UTC 2020

Modified Files:
src/usr.bin/rlogin: rlogin.c

Log Message:
PR/54435: Adjust for new kernel behavior of soreceive(9) clearing MSG_OOB
when receiving the oob message. This made SIOCATMARK return always 0 since
the oob message was cleared. Instead, use recvmsg(2) to determine if
the message was oob or not. This works with both the old and new kernel
and it is not racy.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/usr.bin/rlogin/rlogin.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/rlogin/rlogin.c
diff -u src/usr.bin/rlogin/rlogin.c:1.46 src/usr.bin/rlogin/rlogin.c:1.47
--- src/usr.bin/rlogin/rlogin.c:1.46	Sun May  3 12:11:06 2020
+++ src/usr.bin/rlogin/rlogin.c	Sun May  3 12:32:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rlogin.c,v 1.46 2020/05/03 16:11:06 christos Exp $	*/
+/*	$NetBSD: rlogin.c,v 1.47 2020/05/03 16:32:16 christos Exp $	*/
 
 /*
  * Copyright (c) 1983, 1990, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)rlogin.c	8.4 (Berkeley) 4/29/95";
 #else
-__RCSID("$NetBSD: rlogin.c,v 1.46 2020/05/03 16:11:06 christos Exp $");
+__RCSID("$NetBSD: rlogin.c,v 1.47 2020/05/03 16:32:16 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -577,16 +577,34 @@ static pid_t ppid;
 static ssize_t rcvcnt, rcvstate;
 static char rcvbuf[8 * 1024];
 
+static int
+recvx(int fd, void *buf, size_t len, int flags, int *msgflags)
+{
+	struct msghdr msg;
+	struct iovec iov;
+	int error;
+
+	memset(, 0, sizeof(msg));
+	msg.msg_iov = 
+	iov.iov_base = buf;
+	iov.iov_len = len;
+	error = recvmsg(fd, , flags);
+	if (error)
+		return error;
+	*msgflags = msg.msg_flags;
+	return 0;
+}
+
 static void
 oob(int signo)
 {
 	struct termios tty;
-	int atmark;
+	int atmark = 0;
 	ssize_t n, rcvd;
 	char waste[BUFSIZ], mark;
 
 	rcvd = 0;
-	while (recv(rem, , 1, MSG_OOB) == -1) {
+	while (recvx(rem, , 1, MSG_OOB, ) == -1) {
 		switch (errno) {
 		case EWOULDBLOCK:
 			/*
@@ -610,6 +628,7 @@ oob(int signo)
 			return;
 		}
 	}
+	atmark &= MSG_OOB;
 	if (mark & TIOCPKT_WINDOW) {
 		/* Let server know about window size changes */
 		(void)kill(ppid, SIGUSR1);
@@ -626,17 +645,8 @@ oob(int signo)
 	}
 	if (mark & TIOCPKT_FLUSHWRITE) {
 		(void)tcflush(1, TCIOFLUSH);
-		for (;;) {
-			if (ioctl(rem, SIOCATMARK, ) < 0) {
-warn("ioctl SIOCATMARK (ignored)");
-break;
-			}
-			if (atmark)
-break;
+		if (!atmark)
 			n = read(rem, waste, sizeof (waste));
-			if (n <= 0)
-break;
-		}
 		/*
 		 * Don't want any pending data to be output, so clear the recv
 		 * buffer.  If we were hanging on a write when interrupted,



CVS commit: src/usr.bin/rlogin

2020-05-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun May  3 16:11:06 UTC 2020

Modified Files:
src/usr.bin/rlogin: rlogin.c

Log Message:
(foo *) 0 -> NULL
int -> ssize_t/size_t


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/usr.bin/rlogin/rlogin.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/rlogin/rlogin.c
diff -u src/usr.bin/rlogin/rlogin.c:1.45 src/usr.bin/rlogin/rlogin.c:1.46
--- src/usr.bin/rlogin/rlogin.c:1.45	Fri Oct  4 05:02:00 2019
+++ src/usr.bin/rlogin/rlogin.c	Sun May  3 12:11:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rlogin.c,v 1.45 2019/10/04 09:02:00 mrg Exp $	*/
+/*	$NetBSD: rlogin.c,v 1.46 2020/05/03 16:11:06 christos Exp $	*/
 
 /*
  * Copyright (c) 1983, 1990, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)rlogin.c	8.4 (Berkeley) 4/29/95";
 #else
-__RCSID("$NetBSD: rlogin.c,v 1.45 2019/10/04 09:02:00 mrg Exp $");
+__RCSID("$NetBSD: rlogin.c,v 1.46 2020/05/03 16:11:06 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -245,7 +245,7 @@ main(int argc, char *argv[])
 	sigemptyset(_mask);
 	sa.sa_flags = SA_RESTART;
 	sa.sa_handler = lostpeer;
-	(void)sigaction(SIGPIPE, , (struct sigaction *)0);
+	(void)sigaction(SIGPIPE, , NULL);
 	/* will use SIGUSR1 for window size hack, so hold it off */
 	sigemptyset();
 	sigaddset(, SIGURG);
@@ -258,9 +258,9 @@ main(int argc, char *argv[])
 	 * a signal by the time that they are unblocked below.
 	 */
 	sa.sa_handler = copytochild;
-	(void)sigaction(SIGURG, , (struct sigaction *) 0);
+	(void)sigaction(SIGURG, , NULL);
 	sa.sa_handler = writeroob;
-	(void)sigaction(SIGUSR1, , (struct sigaction *) 0);
+	(void)sigaction(SIGUSR1, , NULL);
 
 	/* don't dump core */
 	rlim.rlim_cur = rlim.rlim_max = 0;
@@ -306,7 +306,7 @@ doit(sigset_t *smask)
 	sigemptyset(_mask);
 	sa.sa_flags = SA_RESTART;
 	sa.sa_handler = SIG_IGN;
-	(void)sigaction(SIGINT, , (struct sigaction *) 0);
+	(void)sigaction(SIGINT, , NULL);
 	setsignal(SIGHUP);
 	setsignal(SIGQUIT);
 	mode(1);
@@ -333,9 +333,9 @@ doit(sigset_t *smask)
 	 * signals to the child. We can now unblock SIGURG and SIGUSR1
 	 * that were set above.
 	 */
-	(void)sigprocmask(SIG_SETMASK, smask, (sigset_t *) 0);
+	(void)sigprocmask(SIG_SETMASK, smask, NULL);
 	sa.sa_handler = catch_child;
-	(void)sigaction(SIGCHLD, , (struct sigaction *) 0);
+	(void)sigaction(SIGCHLD, , NULL);
 	writer();
 	msg("closed connection.");
 	done(0);
@@ -357,9 +357,9 @@ setsignal(int sig)
 	isa.sa_flags = SA_RESTART;
 	(void)sigaction(sig, , );
 	if (osa.sa_handler == SIG_IGN)
-		(void)sigaction(sig, , (struct sigaction *) 0);
+		(void)sigaction(sig, , NULL);
 
-	(void)sigprocmask(SIG_SETMASK, , (sigset_t *) 0);
+	(void)sigprocmask(SIG_SETMASK, , NULL);
 }
 
 static void
@@ -375,7 +375,7 @@ done(int status)
 		sigemptyset(_mask);
 		sa.sa_handler = SIG_DFL;
 		sa.sa_flags = 0;
-		(void)sigaction(SIGCHLD, , (struct sigaction *) 0);
+		(void)sigaction(SIGCHLD, , NULL);
 		if (kill(child, SIGKILL) >= 0)
 			while ((w = wait()) > 0 && w != child)
 continue;
@@ -399,7 +399,7 @@ writeroob(int signo)
 		sigemptyset(_mask);
 		sa.sa_handler = sigwinch;
 		sa.sa_flags = SA_RESTART;
-		(void)sigaction(SIGWINCH, , (struct sigaction *) 0);
+		(void)sigaction(SIGWINCH, , NULL);
 	}
 	dosigwinch = 1;
 }
@@ -430,7 +430,8 @@ catch_child(int signo)
 static void
 writer(void)
 {
-	int bol, local, n;
+	int bol, local;
+	ssize_t n;
 	char c;
 
 	bol = 1;			/* beginning of line */
@@ -523,10 +524,10 @@ stop(int all)
 	sigemptyset(_mask);
 	sa.sa_handler = SIG_IGN;
 	sa.sa_flags = SA_RESTART;
-	(void)sigaction(SIGCHLD, , (struct sigaction *) 0);
+	(void)sigaction(SIGCHLD, , NULL);
 	(void)kill(all ? 0 : getpid(), SIGTSTP);
 	sa.sa_handler = catch_child;
-	(void)sigaction(SIGCHLD, , (struct sigaction *) 0);
+	(void)sigaction(SIGCHLD, , NULL);
 	mode(1);
 	sigwinch(0);			/* check for size changes */
 }
@@ -573,18 +574,19 @@ sendwindow(void)
 
 static jmp_buf rcvtop;
 static pid_t ppid;
-static int rcvcnt, rcvstate;
+static ssize_t rcvcnt, rcvstate;
 static char rcvbuf[8 * 1024];
 
 static void
 oob(int signo)
 {
 	struct termios tty;
-	int atmark, n, rcvd;
+	int atmark;
+	ssize_t n, rcvd;
 	char waste[BUFSIZ], mark;
 
 	rcvd = 0;
-	while (recv(rem, , 1, MSG_OOB) < 0) {
+	while (recv(rem, , 1, MSG_OOB) == -1) {
 		switch (errno) {
 		case EWOULDBLOCK:
 			/*
@@ -592,7 +594,7 @@ oob(int signo)
 			 * to send it yet if we are blocked for output and
 			 * our input buffer is full.
 			 */
-			if (rcvcnt < (int)sizeof(rcvbuf)) {
+			if (rcvcnt < (ssize_t)sizeof(rcvbuf)) {
 n = read(rem, rcvbuf + rcvcnt,
 sizeof(rcvbuf) - rcvcnt);
 if (n <= 0)
@@ -661,7 +663,7 @@ static int
 reader(sigset_t *smask)
 {
 	pid_t pid;
-	int n, remaining;
+	ssize_t n, remaining;
 	char *bufp;
 	struct sigaction sa;
 
@@ -669,13 +671,13 @@ reader(sigset_t *smask)
 	

CVS commit: src/usr.bin/rlogin

2015-10-28 Thread Mateusz Kocielski
Module Name:src
Committed By:   shm
Date:   Wed Oct 28 08:15:53 UTC 2015

Modified Files:
src/usr.bin/rlogin: rlogin.c

Log Message:
Added missing sa_mask initialization (CID 979636)

OK kamil@ mrg@


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/usr.bin/rlogin/rlogin.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/rlogin/rlogin.c
diff -u src/usr.bin/rlogin/rlogin.c:1.43 src/usr.bin/rlogin/rlogin.c:1.44
--- src/usr.bin/rlogin/rlogin.c:1.43	Sat Mar  2 18:37:19 2013
+++ src/usr.bin/rlogin/rlogin.c	Wed Oct 28 08:15:53 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: rlogin.c,v 1.43 2013/03/02 18:37:19 wiz Exp $	*/
+/*	$NetBSD: rlogin.c,v 1.44 2015/10/28 08:15:53 shm Exp $	*/
 
 /*
  * Copyright (c) 1983, 1990, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)rlogin.c	8.4 (Berkeley) 4/29/95";
 #else
-__RCSID("$NetBSD: rlogin.c,v 1.43 2013/03/02 18:37:19 wiz Exp $");
+__RCSID("$NetBSD: rlogin.c,v 1.44 2015/10/28 08:15:53 shm Exp $");
 #endif
 #endif /* not lint */
 
@@ -741,6 +741,7 @@ lostpeer(int signo)
 	struct sigaction sa;
 	sa.sa_flags = SA_RESTART;
 	sa.sa_handler = SIG_IGN;
+	sigemptyset(_mask);
 	(void)sigaction(SIGPIPE, , (struct sigaction *)0);
 	msg("\aconnection closed.");
 	done(1);



CVS commit: src/usr.bin/rlogin

2013-03-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Mar  2 16:35:18 UTC 2013

Modified Files:
src/usr.bin/rlogin: rlogin.1 rlogin.c

Log Message:
PR/47584: Steffen Daoden: Add option to turn off Nagle to rlogin


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/rlogin/rlogin.1
cvs rdiff -u -r1.41 -r1.42 src/usr.bin/rlogin/rlogin.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/rlogin/rlogin.1
diff -u src/usr.bin/rlogin/rlogin.1:1.25 src/usr.bin/rlogin/rlogin.1:1.26
--- src/usr.bin/rlogin/rlogin.1:1.25	Sat Jul 16 08:35:59 2005
+++ src/usr.bin/rlogin/rlogin.1	Sat Mar  2 11:35:17 2013
@@ -1,4 +1,4 @@
-.\	$NetBSD: rlogin.1,v 1.25 2005/07/16 12:35:59 rpaulo Exp $
+.\	$NetBSD: rlogin.1,v 1.26 2013/03/02 16:35:17 christos Exp $
 .\
 .\ Copyright (c) 1983, 1990, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\
 .\	@(#)rlogin.1	8.2 (Berkeley) 4/29/95
 .\
-.Dd July 16, 2005
+.Dd March 2, 2013
 .Dt RLOGIN 1
 .Os
 .Sh NAME
@@ -37,20 +37,20 @@
 .Nd remote login
 .Sh SYNOPSIS
 .Nm
-.Op Fl 468Ed
+.Op Fl 468dEn
 .Op Fl e Ar char
 .Op Fl l Ar username
 .Op Fl p Ar port
 .Ar host
 .Nm
-.Op Fl 468Ed
+.Op Fl 468dEn
 .Op Fl e Ar char
 .Op Fl p Ar port
 .Ar username@host
 .Sh DESCRIPTION
 .Nm
 starts a terminal session on a remote host
-.Ar host  .
+.Ar host .
 .Pp
 .Nm
 first attempts to use the standard Berkeley
@@ -69,6 +69,12 @@ option allows an eight-bit input data pa
 parity bits are stripped except when the remote side's stop and start
 characters are other than
 .Sq \^S/^Q .
+.It Fl d
+The
+.Fl d
+option turns on socket debugging (see
+.Xr setsockopt 2 )
+on the TCP sockets used for communication with the remote host.
 .It Fl E
 The
 .Fl E
@@ -76,12 +82,6 @@ option stops any character from being re
 When used with the
 .Fl 8
 option, this provides a completely transparent connection.
-.It Fl d
-The
-.Fl d
-option turns on socket debugging (see
-.Xr setsockopt 2 )
-on the TCP sockets used for communication with the remote host.
 .It Fl e Ar char
 The
 .Fl e
@@ -97,6 +97,12 @@ option specifies an alternate
 .Ar username
 for the remote login.
 If this option is not specified, your local username will be used.
+.It Fl n
+Set the
+.Dv TCP_NODELAY
+socket option,
+which can improve interactive responsiveness at the possible downside of
+increased network load.
 .It Fl p Ar port
 Uses the given
 .Ar port

Index: src/usr.bin/rlogin/rlogin.c
diff -u src/usr.bin/rlogin/rlogin.c:1.41 src/usr.bin/rlogin/rlogin.c:1.42
--- src/usr.bin/rlogin/rlogin.c:1.41	Tue Sep  6 14:28:35 2011
+++ src/usr.bin/rlogin/rlogin.c	Sat Mar  2 11:35:18 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: rlogin.c,v 1.41 2011/09/06 18:28:35 joerg Exp $	*/
+/*	$NetBSD: rlogin.c,v 1.42 2013/03/02 16:35:18 christos Exp $	*/
 
 /*
  * Copyright (c) 1983, 1990, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = @(#)rlogin.c	8.4 (Berkeley) 4/29/95;
 #else
-__RCSID($NetBSD: rlogin.c,v 1.41 2011/09/06 18:28:35 joerg Exp $);
+__RCSID($NetBSD: rlogin.c,v 1.42 2013/03/02 16:35:18 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -56,6 +56,7 @@ __RCSID($NetBSD: rlogin.c,v 1.41 2011/0
 #include netinet/in.h
 #include netinet/in_systm.h
 #include netinet/ip.h
+#include netinet/tcp.h
 
 #include err.h
 #include errno.h
@@ -73,7 +74,6 @@ __RCSID($NetBSD: rlogin.c,v 1.41 2011/0
 
 #include getport.h
 
-
 #ifndef TIOCPKT_WINDOW
 #define	TIOCPKT_WINDOW	0x80
 #endif
@@ -134,7 +134,7 @@ main(int argc, char *argv[])
 	struct termios tty;
 	sigset_t smask;
 	uid_t uid;
-	int argoff, ch, dflag, one;
+	int argoff, ch, dflag, nflag, one;
 	int i, len, len2;
 	int family = AF_UNSPEC;
 	char *host, *p, *user, *name, term[1024] = network;
@@ -143,7 +143,7 @@ main(int argc, char *argv[])
 	char *service = NULL;
 	struct rlimit rlim;
 
-	argoff = dflag = 0;
+	argoff = dflag = nflag = 0;
 	one = 1;
 	host = user = NULL;
 	sp = NULL;
@@ -160,7 +160,7 @@ main(int argc, char *argv[])
 		argoff = 1;
 	}
 
-#define	OPTIONS	468dEe:l:p:
+#define	OPTIONS	468dEe:l:np:
 	while ((ch = getopt(argc - argoff, argv + argoff, OPTIONS)) != -1)
 		switch(ch) {
 		case '4':
@@ -185,6 +185,9 @@ main(int argc, char *argv[])
 		case 'l':
 			user = optarg;
 			break;
+		case 'n':
+			nflag = 1;
+			break;
 		case 'p':
 			sp = getport(service = optarg, tcp);
 			break;
@@ -258,34 +261,34 @@ main(int argc, char *argv[])
 	(void)sigaction(SIGURG, sa, (struct sigaction *) 0);
 	sa.sa_handler = writeroob;
 	(void)sigaction(SIGUSR1, sa, (struct sigaction *) 0);
-	
+
 	/* don't dump core */
 	rlim.rlim_cur = rlim.rlim_max = 0;
 	if (setrlimit(RLIMIT_CORE, rlim)  0)
 		warn(setrlimit);
 
 	rem = rcmd_af(host, sp-s_port, name, user, term, 0, family);
-
-
 	if (rem  0)
 		exit(1);
 
 	if (dflag 
 	setsockopt(rem, SOL_SOCKET, SO_DEBUG, one, sizeof(one))  0)
 		warn(setsockopt DEBUG (ignored));

CVS commit: src/usr.bin/rlogin

2013-03-02 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Mar  2 18:37:19 UTC 2013

Modified Files:
src/usr.bin/rlogin: rlogin.c

Log Message:
Sync usage with man page.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/usr.bin/rlogin/rlogin.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/rlogin/rlogin.c
diff -u src/usr.bin/rlogin/rlogin.c:1.42 src/usr.bin/rlogin/rlogin.c:1.43
--- src/usr.bin/rlogin/rlogin.c:1.42	Sat Mar  2 16:35:18 2013
+++ src/usr.bin/rlogin/rlogin.c	Sat Mar  2 18:37:19 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: rlogin.c,v 1.42 2013/03/02 16:35:18 christos Exp $	*/
+/*	$NetBSD: rlogin.c,v 1.43 2013/03/02 18:37:19 wiz Exp $	*/
 
 /*
  * Copyright (c) 1983, 1990, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = @(#)rlogin.c	8.4 (Berkeley) 4/29/95;
 #else
-__RCSID($NetBSD: rlogin.c,v 1.42 2013/03/02 16:35:18 christos Exp $);
+__RCSID($NetBSD: rlogin.c,v 1.43 2013/03/02 18:37:19 wiz Exp $);
 #endif
 #endif /* not lint */
 
@@ -765,7 +765,7 @@ static void
 usage(void)
 {
 	(void)fprintf(stderr,
-	Usage: %s [-468Edn] [-e char] [-l username] [-p port] 
+	Usage: %s [-468dEn] [-e char] [-l username] [-p port] 
 	[username@]host\n, getprogname());
 	exit(1);
 }



CVS commit: src/usr.bin/rlogin

2011-09-06 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue Sep  6 18:28:35 UTC 2011

Modified Files:
src/usr.bin/rlogin: rlogin.c

Log Message:
static + __dead


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/usr.bin/rlogin/rlogin.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/rlogin/rlogin.c
diff -u src/usr.bin/rlogin/rlogin.c:1.40 src/usr.bin/rlogin/rlogin.c:1.41
--- src/usr.bin/rlogin/rlogin.c:1.40	Mon Apr 13 04:37:53 2009
+++ src/usr.bin/rlogin/rlogin.c	Tue Sep  6 18:28:35 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rlogin.c,v 1.40 2009/04/13 04:37:53 lukem Exp $	*/
+/*	$NetBSD: rlogin.c,v 1.41 2011/09/06 18:28:35 joerg Exp $	*/
 
 /*
  * Copyright (c) 1983, 1990, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = @(#)rlogin.c	8.4 (Berkeley) 4/29/95;
 #else
-__RCSID($NetBSD: rlogin.c,v 1.40 2009/04/13 04:37:53 lukem Exp $);
+__RCSID($NetBSD: rlogin.c,v 1.41 2011/09/06 18:28:35 joerg Exp $);
 #endif
 #endif /* not lint */
 
@@ -87,11 +87,11 @@
 #define CCEQ(val, c)	(c == val ? val != _POSIX_VDISABLE : 0)
 #endif
 
-int eight, rem;
-struct termios deftty;
+static int eight, rem;
+static struct termios deftty;
 
-int noescape;
-u_char escapechar = '~';
+static int noescape;
+static u_char escapechar = '~';
 
 #ifdef OLDSUN
 struct winsize {
@@ -101,30 +101,29 @@
 #else
 #define	get_window_size(fd, wp)	ioctl(fd, TIOCGWINSZ, wp)
 #endif
-struct	winsize winsize;
+static struct	winsize winsize;
 
-void		catch_child(int);
-void		copytochild(int);
-void		doit(sigset_t *);
-void		done(int);
-void		echo(int);
-u_int		getescape(char *);
-void		lostpeer(int);
-int		main(int, char **);
-void		mode(int);
-void		msg(const char *);
-void		oob(int);
-int		reader(sigset_t *);
-void		sendwindow(void);
-void		setsignal(int);
-void		sigwinch(int);
-void		stop(int);
-void		usage(void);
-void		writer(void);
-void		writeroob(int);
+static void		catch_child(int);
+static void		copytochild(int);
+__dead static void	doit(sigset_t *);
+__dead static void	done(int);
+static void		echo(int);
+static u_int		getescape(char *);
+__dead static void	lostpeer(int);
+static void		mode(int);
+static void		msg(const char *);
+static void		oob(int);
+static int		reader(sigset_t *);
+static void		sendwindow(void);
+static void		setsignal(int);
+static void		sigwinch(int);
+static void		stop(int);
+__dead static void	usage(void);
+static void		writer(void);
+static void		writeroob(int);
 
 #ifdef OLDSUN
-int		get_window_size(int, struct winsize *);
+static int		get_window_size(int, struct winsize *);
 #endif
 
 int
@@ -294,9 +293,9 @@
 	return (0);
 }
 
-pid_t child;
+static pid_t child;
 
-void
+static void
 doit(sigset_t *smask)
 {
 	struct sigaction sa;
@@ -340,7 +339,7 @@
 }
 
 /* trap a signal, unless it is being ignored. */
-void
+static void
 setsignal(int sig)
 {
 	struct sigaction sa;
@@ -360,7 +359,7 @@
 	(void)sigprocmask(SIG_SETMASK, sigs, (sigset_t *) 0);
 }
 
-void
+static void
 done(int status)
 {
 	pid_t w;
@@ -381,13 +380,13 @@
 	exit(status);
 }
 
-int dosigwinch;
+static int dosigwinch;
 
 /*
  * This is called when the reader process gets the out-of-band (urgent)
  * request to turn on the window-changing protocol.
  */
-void
+static void
 writeroob(int signo)
 {
 	struct sigaction sa;
@@ -402,7 +401,7 @@
 	dosigwinch = 1;
 }
 
-void
+static void
 catch_child(int signo)
 {
 	int status;
@@ -425,7 +424,7 @@
  * ~^Zsuspend rlogin process.
  * ~delayed-suspend char	suspend rlogin process, but leave reader alone.
  */
-void
+static void
 writer(void)
 {
 	int bol, local, n;
@@ -489,7 +488,7 @@
 	}
 }
 
-void
+static void
 echo(int i)
 {
 	char c = (char)i;
@@ -512,7 +511,7 @@
 	(void)write(STDOUT_FILENO, buf, p - buf);
 }
 
-void
+static void
 stop(int all)
 {
 	struct sigaction sa;
@@ -529,7 +528,7 @@
 	sigwinch(0);			/* check for size changes */
 }
 
-void
+static void
 sigwinch(int signo)
 {
 	struct winsize ws;
@@ -544,7 +543,7 @@
 /*
  * Send the window size to the server via the magic escape
  */
-void
+static void
 sendwindow(void)
 {
 	struct winsize *wp;
@@ -569,12 +568,12 @@
 #define	READING	1
 #define	WRITING	2
 
-jmp_buf rcvtop;
-pid_t ppid;
-int rcvcnt, rcvstate;
-char rcvbuf[8 * 1024];
+static jmp_buf rcvtop;
+static pid_t ppid;
+static int rcvcnt, rcvstate;
+static char rcvbuf[8 * 1024];
 
-void
+static void
 oob(int signo)
 {
 	struct termios tty;
@@ -655,7 +654,7 @@
 }
 
 /* reader: read from remote: line - 1 */
-int
+static int
 reader(sigset_t *smask)
 {
 	pid_t pid;
@@ -703,7 +702,7 @@
 	}
 }
 
-void
+static void
 mode(int f)
 {
 	struct termios tty;
@@ -734,7 +733,7 @@
 	}
 }
 
-void
+static void
 lostpeer(int signo)
 {
 	struct sigaction sa;
@@ -746,14 +745,14 @@
 }
 
 /* copy SIGURGs to the child process. */
-void
+static void
 copytochild(int signo)
 {
 
 	(void)kill(child, SIGURG);
 }
 
-void
+static void
 msg(const char *str)
 {
 
@@ -761,7 +760,7 @@
 }
 
 
-void
+static