summaryrefslogtreecommitdiffstats
path: root/bin/clogin
diff options
context:
space:
mode:
authorTar Committer <tar@ocjtech.us>1999-08-10 19:39:12 +0000
committerTar Committer <tar@ocjtech.us>1999-08-10 19:39:12 +0000
commit42de2e53682c49b050f19fdbaaf68451ba487303 (patch)
tree6f2499c6283dda9e6ab8f75342906284e7ff50fd /bin/clogin
parent82d9e178146555c8bd72b1da39eeb0cf057783df (diff)
downloadrancid-42de2e53682c49b050f19fdbaaf68451ba487303.tar.gz
rancid-42de2e53682c49b050f19fdbaaf68451ba487303.tar.xz
rancid-42de2e53682c49b050f19fdbaaf68451ba487303.zip
Imported from rancid-1.2.tar.gz.rancid-1.2
Diffstat (limited to 'bin/clogin')
-rwxr-xr-xbin/clogin15
1 files changed, 13 insertions, 2 deletions
diff --git a/bin/clogin b/bin/clogin
index e8f487b..b8b693e 100755
--- a/bin/clogin
+++ b/bin/clogin
@@ -136,6 +136,17 @@ for {set i 0} {$i < $argc} {incr i} {
-T* {
incr i
set timeout [ lindex $argv $i ]
+ } -x* -
+ -X {
+ if {! [ regexp .\[xX\](.+) $arg ignore cmd_file]} {
+ incr i
+ set cmd_file [ lindex $argv $i ]
+ }
+ set cmd_fd [open $cmd_file r]
+ set cmd_text [read $cmd_fd]
+ close $cmd_fd
+ set command [join [split $cmd_text \n] \;]
+ set do_command 1
# Do we enable?
} -noenable {
set enable 0
@@ -345,7 +356,7 @@ proc run_commands { prompt command } {
set num_commands [llength $commands]
for {set i 0} {$i < $num_commands} { incr i} {
- send "[lindex $commands $i]\r"
+ send "[subst [lindex $commands $i]]\r"
expect {
-re "^\[^\n\r]*$prompt." { exp_continue }
-re "^\[^\n\r *]*$prompt" {}
@@ -353,7 +364,7 @@ proc run_commands { prompt command } {
}
}
} else {
- send "$command\r"
+ send "[subst $command]\r"
expect {
-re "^\[^\n\r]*$prompt." { exp_continue }
-re "^\[^\n\r *]*$prompt" {}