#!/bin/csh -f #+ # set_state -- reconfigure DEIMOS # # Purpose: # Change the state of DEIMOS stages or detector systems. # This script is simply a front-end to the restore_state script. # # Usage: # set_state [-verify] [-debug] # # Flags: # -(v)erify validate keywords upon completion # -(d)ebug print troubleshooting output # # Arguments: # None. # # Output: # None, unless -debug option is set # # Restrictions: # None. # # Exit values: # 0 = normal completion # 1 = error parsing input save file # 2 = fatal error # 4 = error running script file # 8 = error validating keyword # # Example: # 1) Reconfigure DEIMOS motors and stages (in script): # set_state < 0 ) # save flags... if ( "$1" =~ \-* ) then set flags = ($flags $1) shift continue endif # quit if no flags... break end # verify args... if ( $#argv > 0 ) then printf "$usage\n" exit 1 endif # allocate a save file... set save_file = ~/.$cmd.$$ if ( -e $save_file ) then printf "ERROR: specified save file $save_file already exists -- abort!\n" exit 1 endif # snarf input from STDIN and put into save file... cat > $save_file # run restore_state using the save file as input... restore_state $flags $save_file exit $status