erasemem2
author A.M. Thurnherr <ant@ldeo.columbia.edu>
Tue, 14 Sep 2010 13:34:39 -0400
changeset 4 fda11de1826e
parent 0 648bde652211
child 12 5e67754f6457
permissions -rwxr-xr-x
version left on Poseidon at end of P403

#!/usr/bin/expect -f
#======================================================================
#                    E R A S E M E M 2 
#                    doc: Mon Mar  8 02:57:35 2004
#                    dlm: Thu Aug 26 00:28:51 2010
#                    (c) 2004 A.M. Thurnherr
#                    uE-Info: 18 39 NIL 0 0 72 2 2 8 NIL ofnI
#======================================================================

# HISTORY:
#  Mar  8, 2004: - created
#  Nov 19, 2008: - added version
#  Aug 25, 2010: - DEFAULTS.expect -> CRUISE_SETUP.expect
#		 - libBB.expect -> libRDI.expect

log_user 0;

regsub {dir1} [exec which dir1] {libRDI.expect} path;
source $path;
source CRUISE_SETUP.expect;

print_version;

set_color;
send_user "Connecting to instruments..."
spawn bbabble -ms $tty0 $tty1;
wait_for_startup;
reset_two_instruments;

set must_erase 0;
select_master 0;
if {[memory_empty]} {
	select_slave;
	if {[memory_empty]} {
		send_user "\nMemory is empty --- nothing to erase.\n";
	} else {
		send_user "\n"; list_dir;
		set must_erase 1;
	}
} else {
	send_user "\n"; list_dir;
	set must_erase 1;
	select_slave;
	if {![memory_empty]} {
		send_user "\n"; list_dir;
		set must_erase 1;
	}
}
	
if {$must_erase == 1} {
	if {[affirm "\nERASE FILES? (Y/n) --- timeout erases! " 10 1]} {
		send_user "Erasing memory...";
		select_master; erase_memory;
		select_slave; erase_memory;
		send_user "\n";
	}
}

send_user "Putting instruments to sleep..."
select_master; put_to_sleep; select_slave; put_to_sleep;

send_user "\nDone\n"