matching Cisco config prompt

john heasley heas at shrubbery.net
Sun Apr 6 01:19:24 UTC 2003


Mon, Feb 17, 2003 at 12:33:38PM -0800, john heasley:
> Mon, Feb 17, 2003 at 10:09:28AM -0800, Rizzo, Joe:
> > I am slowly understanding what is going on... This is a little cleaner:
> 
> hairy isnt it.
> 
> > diff -u clogin.orig clogin 
> > --- clogin.orig Wed Feb 12 15:33:02 2003
> > +++ clogin      Mon Feb 17 10:02:03 2003
> > @@ -456,9 +456,9 @@
> >         } else {
> >             send "term length 0\r"
> >         }
> > -       regsub -all "\[)(]" $prompt {\\&} reprompt
> > +        regsub -all {[)(]} $prompt {\\&} reprompt
> >         # match cisco config mode prompts too, but not for catalyst ie:
> > (enable)
> > -       regsub -all "\[#>]$" $reprompt {(\\([^\\r\\n]+\\))?&} reprompt
> > +        regsub -- {^(.{1,14}).*([#>])$} $reprompt
> > {\1.*(\(config.*\))?\2} reprompt
>      ^^ such matches are problematic because there's no tell what
> might appear in the config or command output.  things like [^(#>]
> work more reliably.

i _finally_ had some time to look at this.  i altered your diff just a
bit.  thanks, man.

anyone care to try it?  it works for the cases i tried.  more exposure
appreciated....

	ftp://ftp.shrubbery.net/outgoing/clogin.in

> >         expect {
> >             -re $reprompt       {}
> >             -re "\[\n\r]+"      { exp_continue }
> > 
> > 



More information about the Rancid-discuss mailing list