1
0
mirror of https://github.com/rfivet/BCG101.git synced 2026-04-05 05:25:23 -04:00
Files
BCG101/expect/elvira-basic
Renaud Fivet f4dd8c282a Add uploading files with multi-line statements under one line number to RSTS-E expect script.
Add ANIMAL listing after successful upload and execution.
Add note that ANIMAL needs NOEXTEND mode and has some lines ending with LF instead of CR during keyboard entry.
2025-04-10 12:09:31 +08:00

71 lines
1.8 KiB
Plaintext

#!/usr/bin/expect --
# rsts-basic -- start a BASIC PLUS session on RSTS/E uploading a file
# Copyright (c) 2025 Renaud Fivet
set file_f [expr { $argv != ""}]
if { $file_f} {
if [catch { set file [open $argv "r"]}] { puts "can't open $argv." ; exit }
close $file
}
#spawn telnet pingouin.local 4000
spawn telnet elvira.stacken.kth.se 4000
#log_file session.log
set timeout 5
expect "<Dial-up>" { sleep 1 }
while 1 {
expect {
"User: " { send "99,99\r" ; break }
timeout { send "\r" ; sleep 1 ; send "\r" ; puts "." }
}
}
expect "Password: " { send "user\r" }
#expect "Ready\r\n\n" { send "NOEXTEND\r" }
expect "Ready\r\n\n" { send "SET WIDTH 132\r" }
expect "Ready\r\n\n" {
if { $file_f } {
set file [open $argv]
if {[gets $file line] != -1} {
set line [string trimleft $line]
while 1 {
set line [string toupper $line]
set len [string length $line]
while {$len > 40} {
set outs [string range $line 0 39]
set line [string range $line 40 end]
incr len -40
send -- $outs
expect -ex $outs
}
if {$len > 0} {
send -- $line
expect -ex $line
}
if {[gets $file line] == -1} {
send "\r"
expect "\r\n"
break
}
if {[regexp {^( *)([0-9]+)} $line]} {
set line [string trimleft $line]
send "\r"
} else {
send "\n"
}
expect "\r\n"
}
}
close $file
}
}
puts ">>>"
interact