From 1cc9f22072de1d314a67387aac57740fb25c5258 Mon Sep 17 00:00:00 2001 From: Tar Committer Date: Thu, 4 May 2006 21:40:56 +0000 Subject: Imported from rancid-2.3.2a4.tar.gz. --- bin/clogin.in | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'bin/clogin.in') diff --git a/bin/clogin.in b/bin/clogin.in index d03feb9..1a265a8 100644 --- a/bin/clogin.in +++ b/bin/clogin.in @@ -1,6 +1,6 @@ #! @EXPECT_PATH@ -- ## -## $Id: clogin.in,v 1.89 2005/08/14 20:18:19 heas Exp $ +## $Id: clogin.in,v 1.94 2006/04/28 15:37:40 heas Exp $ ## ## Copyright (C) 1997-2004 by Terrapin Communications, Inc. ## All rights reserved. @@ -55,8 +55,6 @@ set avautoenable 0 # tracks if we receive them on the command line. set do_passwd 1 set do_enapasswd 1 -# attempt at platform switching. -set platform "" # Find the user in the ENV, or use the unix userid. if {[ info exists env(CISCO_USER) ]} { @@ -577,7 +575,7 @@ proc run_commands { prompt command } { regsub -all {[)(]} $prompt {\\&} reprompt # match cisco config mode prompts too, such as router(config-if)#, # but catalyst does not change in this fashion. - regsub -all {^(.{1,14}).*([#>])$} $reprompt {\1([^#>\r\n]+)?[#>](\\([^)\\r\\n]+\\))?} reprompt + regsub -all {^(.{1,11}).*([#>])$} $reprompt {\1([^#>\r\n]+)?[#>](\\([^)\\r\\n]+\\))?} reprompt expect { -re $reprompt {} -re "\[\n\r]+" { exp_continue } @@ -603,6 +601,9 @@ proc run_commands { prompt command } { } -re "^\[^\n\r]*$reprompt." { send_user -- "$expect_out(buffer)" exp_continue } + -re "^--More--\r\n" { # specific match c1900 pager + send " " + exp_continue } -re "\[\n\r]+" { send_user -- "$expect_out(buffer)" exp_continue } -re "\[^\r\n]*Press to cont\[^\r\n]*" { @@ -633,6 +634,9 @@ proc run_commands { prompt command } { } -re "^\[^\n\r]*$reprompt." { send_user -- "$expect_out(buffer)" exp_continue } + -re "^--More--\r\n" { # specific match c1900 pager + send " " + exp_continue } -re "\[\n\r]+" { send_user -- "$expect_out(buffer)" exp_continue } -re "\[^\r\n]*Press to cont\[^\r\n]*" { @@ -685,7 +689,9 @@ source_password_file $password_file set in_proc 0 foreach router [lrange $argv $i end] { set router [string tolower $router] - send_user "$router\n" + # attempt at platform switching. + set platform "" + send_user -- "$router\n" # Figure out the prompt. # autoenable is off by default. If we have it defined, it was done @@ -717,11 +723,11 @@ foreach router [lrange $argv $i end] { if { $do_passwd || $do_enapasswd } { set pswd [find password $router] if { [llength $pswd] == 0 } { - send_user "\nError: no password for $router in $password_file.\n" + send_user -- "\nError: no password for $router in $password_file.\n" continue } if { $enable && $do_enapasswd && $autoenable == 0 && [llength $pswd] < 2 } { - send_user "\nError: no enable password for $router in $password_file.\n" + send_user -- "\nError: no enable password for $router in $password_file.\n" continue } set passwd [join [lindex $pswd 0] ""] @@ -809,7 +815,7 @@ foreach router [lrange $argv $i end] { send "\r" expect { -re "\[\r\n]+" { exp_continue; } - -re "^(.+:)1 $prompt" { # stoopid extreme cmd-line numbers and + -re "^(.+\[:.])1 $prompt" { # stoopid extreme cmd-line numbers and # prompt based on state of config changes, # which may have an * at the beginning. set junk $expect_out(1,string) -- cgit