#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require rsv.class findhsvc
set dir /mod/var/backup
httpheader
set file [file tail [cgi_get restore_file]]
if {$file == 0} {
puts "No filename supplied."
exit
}
set ffile "/$dir/$file.rbk"
if {![file exists $ffile]} {
puts "Backup file $file does not exist."
exit
}
if {[catch { set fd [open $ffile r] } msg]} {
puts "Error opening $file - $msg"
exit
}
puts "Listing scheduled events from $file..."
set fields [lsort [[rsv] vars]]
set data [split [read $fd] "\n"]
foreach line $data {
set vals [split $line "\t"]
if {[lindex $vals 0] ne "event"} { continue }
set vars {}
set i 0
foreach f $fields {
if {$f eq "aulEventToRecordInfo"} { continue }
incr i
lappend vars $f [lindex $vals $i]
}
set rsv [rsv new $vars]
puts " [$rsv name] ([$rsv channel_name])"
}
close $fd
rsv cleanup