#! /bin/csh -f

#
# Nice wrapper for eject command.  Pops up an xconfirm window.
# See mediad.h for the error codes.
#
# $Id: Eject,v 1.7 1998/02/13 17:40:45 rcu Exp $
#

if ("X$1" == "X") then
	/usr/sbin/eject >& /dev/null
	set eject_status = $status
else	
	/usr/sbin/eject $* >& /dev/null
	set eject_status = $status
endif

switch ($eject_status)

case 0:
	exit
	breaksw

case 1:
	setenv MSG "`gettxt uxsgidesktop:793 'Incorrect usage.  See eject man page.'`"
	breaksw

case 2:
	setenv MSG "`gettxt uxsgidesktop:794 'The drive is busy.  Make sure no programs are using the drive and close any views on drive contents.'`"
	breaksw

case 3:
	setenv MSG "`gettxt uxsgidesktop:795 'Unable to eject.  Try hardware eject.'`"
	breaksw

case 4:
	setenv MSG "`gettxt uxsgidesktop:796 'There is no media in the drive.  Make sure you are specifying the right drive.'`"
	breaksw

case 5:
	setenv MSG "`gettxt uxsgidesktop:797 'Software eject not supported.  Use hardware eject.'`"
	breaksw

case 6:
	setenv MSG "`gettxt uxsgidesktop:798 'No such device.  Check your scsi id, fsname, or dir.'`"
	breaksw

case 7:
	setenv MSG "`gettxt uxsgidesktop:799 'A system error has occured.  See /usr/adm/SYSLOG for more info.'`"
	breaksw

case 13: 
	setenv MSG "`gettxt uxsgidesktop:800 'The device has been unmounted.  Use hardware eject to remove the device now.'`"
	breaksw

default:
	setenv MSG "`gettxt uxsgidesktop:801 'Unable to eject.  Try hardware eject if possible.'`"
	breaksw

endsw

set header = `gettxt uxsgidesktop:808 'Eject Status'`
set button = `gettxt uxsgidesktop:736 'Continue'`
/usr/bin/X11/xconfirm -h "$header" -B "$button" -t "$MSG" > /dev/null
