diff -ruN rancid-2.3.8~/bin/hlogin.in rancid-2.3.8/bin/hlogin.in
--- rancid-2.3.8~/bin/hlogin.in
+++ rancid-2.3.8/bin/hlogin.in
@@ -521,11 +521,17 @@
     set in_proc 1
 
     # Turn off the pager and escape regex meta characters in the $prompt
-    send "no page\r"
     regsub -all {[)(]} $prompt {\\&} reprompt
     regsub -all {^(.{1,11}).*([#>])$} $reprompt {\1([^#>\r\n]+)?[#>](\\([^)\\r\\n]+\\))?} reprompt
+    send "no page\r"
+    expect {
+	-re $reprompt	{}
+	-re "\[\n\r]+"	{ exp_continue }
+    }
+    send "terminal length 0\r"
     expect {
 	-re $reprompt	{}
+	-re "Invalid input: 0\[\n\r]+" { exp_continue }
 	-re "\[\n\r]+"	{ exp_continue }
     }
     # this is the only way i see to get rid of more prompts in o/p..grrrrr
@@ -780,6 +786,11 @@
 	# disable the pager
 	send "no page\r"
 	expect -re $prompt	{}
+	send "terminal length 0\r"
+	expect {
+	    -re $prompt {}
+	    -re "Invalid input: 0\[\n\r]+" { exp_continue }
+	}
 	source $sfile
 	catch {close};
     } else {
