summaryrefslogtreecommitdiffstats
path: root/bin/cat5rancid.in
diff options
context:
space:
mode:
authorTar Committer <tar@ocjtech.us>2004-01-12 03:17:26 +0000
committerTar Committer <tar@ocjtech.us>2004-01-12 03:17:26 +0000
commit989312339ea2e16579803a48700628c5469e327a (patch)
tree967ee77195819d70f2dc675444e92340bb98e0d6 /bin/cat5rancid.in
parentff168ecfe045c690c24d5bbc5a3062bf9d64120c (diff)
downloadrancid-989312339ea2e16579803a48700628c5469e327a.tar.gz
rancid-989312339ea2e16579803a48700628c5469e327a.tar.xz
rancid-989312339ea2e16579803a48700628c5469e327a.zip
Imported from rancid-2.3.rc1.tar.gz.rancid-2.3.rc1
Diffstat (limited to 'bin/cat5rancid.in')
-rw-r--r--[-rwxr-xr-x]bin/cat5rancid.in31
1 files changed, 22 insertions, 9 deletions
diff --git a/bin/cat5rancid.in b/bin/cat5rancid.in
index c8219d8..f1214a1 100755..100644
--- a/bin/cat5rancid.in
+++ b/bin/cat5rancid.in
@@ -1,19 +1,22 @@
-#!@PERLV_PATH@
+#! @PERLV_PATH@
##
+## $Id: cat5rancid.in,v 1.36 2004/01/11 03:49:13 heas Exp $
##
-## Copyright (C) 1997-2001 by Henry Kilmer.
+## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
##
-## This software may be freely copied, modified and redistributed without
-## fee for non-commerical purposes provided that this copyright notice is
-## preserved intact on all copies and modified copies.
+## This software may be freely copied, modified and redistributed
+## without fee for non-commerical purposes provided that this license
+## remains intact and unmodified with any RANCID distribution.
##
## There is no warranty or other guarantee of fitness of this software.
-## It is provided solely "as is". The author(s) disclaim(s) all
+## It is provided solely "as is". The author(s) disclaim(s) all
## responsibility and liability with respect to this software's usage
## or its effect upon hardware, computer systems, other software, or
## anything else.
##
+## Except where noted otherwise, rancid was written by and is maintained by
+## Henry Kilmer, John Heasley, Andrew Partan, Pete Whiting, and Austin Schutz.
##
#
# RANCID - Really Awesome New Cisco confIg Differ
@@ -21,7 +24,7 @@
# usage: rancid [-d] [-l] [-f filename | $host]
#
use Getopt::Std;
-getopts('dflm');
+getopts('dfl');
$log = $opt_l;
$debug = $opt_d;
$file = $opt_f;
@@ -783,7 +786,7 @@ sub ShowPortIfindex {
}
}
-# This routine processes a "write term"
+# This routine processes a "write term {all}"
sub WriteTerm {
print STDERR " In WriteTerm: $_" if ($debug);
@@ -791,7 +794,10 @@ sub WriteTerm {
while (<INPUT>) {
tr/\015//d;
last if (/^$prompt/);
+ last if (/^Unknown host /); # error when write term all
+ # is not supported
next if (/^\.+$/ | /^$/);
+ return(0) if ($found_end);
/Non-Volatile memory is in use/ && return(-1); # NvRAM is locked
# skip the crap
next if (/^This command shows non-default configurations only./i);
@@ -862,6 +868,7 @@ sub WriteTerm {
next;
}
/fair-queue individual-limit/ && next;
+ /^set port security \d+\/\d+ \S+-\S+\-/ && next;
# sort ip explicit-paths.
if (/^ip explicit-path name (\S+)/) {
my($key) = $1;
@@ -995,6 +1002,7 @@ sub DoNothing {print STDOUT;}
'dir sup-microcode:' => "DirSlotN",
'show module' => "ShowModule",
'show port ifindex' => "ShowPortIfindex",
+ 'write term all' => "WriteTerm",
'write term' => "WriteTerm"
);
# keys() doesnt return things in the order entered and the order of the
@@ -1010,6 +1018,7 @@ sub DoNothing {print STDOUT;}
"dir sup-microcode:",
"show module",
"show port ifindex",
+ "write term all",
"write term"
);
$cisco_cmds=join(";",@commands);
@@ -1062,7 +1071,11 @@ TOP: while(<INPUT>) {
}
while (/> \(enable\)\s*($cmds_regexp)\s*$/) {
$cmd = $1;
- if (!defined($prompt)) {$prompt = ($_ =~ /^([^>]+>)/)[0]; }
+ if (!defined($prompt)) {
+ $prompt = ($_ =~ /^([^>]+>)/)[0];
+ $prompt =~ s/([][}{)(\\])/\\$1/g;
+ print STDERR ("PROMPT MATCH: $prompt\n") if ($debug);
+ }
print STDERR ("HIT COMMAND:$_") if ($debug);
if (! defined($commands{$cmd})) {
print STDERR "$host: found unexpected command - \"$cmd\"\n";