#!/bin/csh -f
#+
# slider -- show or select the DEIMOS grating slider position
#
# Purpose:
#	With no arguments, print the name of the current DEIMOS
#	slider. With one argument, select the named DEIMOS slider
#	position. 
#
# Usage:
#	slider [n]
# 
# Arguments:
#	n	= number of the grating slider to select
# 
# Output:
#	- With no arguments, the name of the slider is printed
# 
# Restrictions:
# 
# Exit values:
#	0 = normal completion
#	1 = wrong number of arguments
#	2 = invalid slider number
#
# Example:
#	1) show the current slider position:
#		slider
# 
# 	2) set to slider position 4:
#		slider 4
#
# 	2) send slider 3 to the unload position:
#		slider -3
#
#-
# Modification history:
#	2002-Aug-14	GDW	Original version
#	2003-Mar-25	GDW	Enable unload positions
#-----------------------------------------------------------------------

set buf = $0
set cmd = $buf:t
set usage = "Usage: $cmd"

# verify args...
if ( $#argv > 1 ) then
  printf "$usage\n"
  exit 1
endif

# grab arg...
if ( $#argv >= 1 ) then
    @ n = $1
    shift

    # validate arg...
    if ( $n < -4 || $n > 4 ) then
	printf "ERROR: invalid slider number requested\n"
	exit 2
    endif

endif

if ( $?n ) then
    modify -s deimot GRATEPOS=$n
    exit $status
else
    show -s deimot -terse GRATEPOS
endif
