From 4f676455c4543ee5d58fbe2ac1907372bf38fec4 Mon Sep 17 00:00:00 2001
From: "Leigh B. Stoller" <stoller@flux.utah.edu>
Date: Thu, 16 Aug 2001 16:33:27 +0000
Subject: [PATCH] Minor fix when socket based tip fails, and we revert to tty
 based; Need to reset the getremote state so that we can do a second search in
 /etc/remote file.

---
 tip/cmdtab.c |  3 ++-
 tip/hunt.c   |  5 +++--
 tip/remote.c | 14 ++++++++++++--
 3 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/tip/cmdtab.c b/tip/cmdtab.c
index b7b974e338..5e9fd315e8 100644
--- a/tip/cmdtab.c
+++ b/tip/cmdtab.c
@@ -36,7 +36,7 @@
 static char sccsid[] = "@(#)cmdtab.c	8.1 (Berkeley) 6/6/93";
 #endif
 static const char rcsid[] =
-	"$Id: cmdtab.c,v 1.2 2000-12-27 00:49:33 mike Exp $";
+	"$Id: cmdtab.c,v 1.3 2001-08-16 16:33:27 stoller Exp $";
 #endif /* not lint */
 
 #include "tip.h"
@@ -49,6 +49,7 @@ esctable_t etable[] = {
 	{ '!',	NORM,	"shell",			 shell },
 	{ 'c',	NORM,	"change directory",		 chdirectory },
 	{ '.',	NORM,	"exit from tip",		 finish },
+	{ ',',	NORM,	"exit from tip",		 finish },
 	{CTRL('d'),NORM,"exit from tip",		 finish },
 	{CTRL('y'),NORM,"suspend tip (local+remote)",	 suspend },
 	{CTRL('z'),NORM,"suspend tip (local only)",	 suspend },
diff --git a/tip/hunt.c b/tip/hunt.c
index 245a70c36e..a429406cc7 100644
--- a/tip/hunt.c
+++ b/tip/hunt.c
@@ -36,7 +36,7 @@
 static char sccsid[] = "@(#)hunt.c	8.1 (Berkeley) 6/6/93";
 #endif
 static const char rcsid[] =
-	"$Id: hunt.c,v 1.6 2001-08-14 19:05:12 stoller Exp $";
+	"$Id: hunt.c,v 1.7 2001-08-16 16:33:27 stoller Exp $";
 #endif /* not lint */
 
 #ifdef USESOCKETS
@@ -172,9 +172,10 @@ socket_hunt(name)
 	}
 	alarm(0);
 	if (FD < 0) {
-		warn("%s", name);
 		deadfl = 1;
 	}
+	if (deadfl)
+		getremote_reset();
 	signal(SIGALRM, f);
 	return (deadfl ? -1 : 0);
 }
diff --git a/tip/remote.c b/tip/remote.c
index ee5911f461..edeb5727a2 100644
--- a/tip/remote.c
+++ b/tip/remote.c
@@ -43,7 +43,7 @@ static const char copyright[] =
 static char sccsid[] = "@(#)remote.c	8.1 (Berkeley) 6/6/93";
 #endif
 static const char rcsid[] =
-	"$Id: remote.c,v 1.2 2000-12-27 00:49:35 mike Exp $";
+	"$Id: remote.c,v 1.3 2001-08-16 16:33:27 stoller Exp $";
 #endif /* not lint */
 
 #include "tip.h"
@@ -258,13 +258,14 @@ getremcap(host)
 		ET = 10;
 }
 
+static int lookedup = 0;
+
 char *
 getremote(host)
 	char *host;
 {
 	register char *cp;
 	static char *next;
-	static int lookedup = 0;
 
 	if (!lookedup) {
 		if (host == NOSTR && (host = getenv("HOST")) == NOSTR)
@@ -289,3 +290,12 @@ getremote(host)
 	}
 	return (DV);
 }
+
+void
+getremote_reset()
+{
+	lookedup = 0;
+	DV = 0;
+	BR = 0;
+	HW = 0;
+}
-- 
GitLab