#! /bin/csh -f

#
# Nice wrapper for eject command.  Pops up an inform window.
# See mediad.h for the error codes.
#
# $Id: Eject,v 1.5 1994/09/17 02:54:53 kbob 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 "Incorrect usage.  See eject man page."
	breaksw

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

case 3:
	setenv MSG "Unable to eject.  Try hardware eject."
	breaksw

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

case 5:
	setenv MSG "Software eject not supported.  Use hardware eject."
	breaksw

case 6:
	setenv MSG "No such device.  Check your scsi id, fsname, or dir."
	breaksw

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

case 13: 

	setenv MSG "The device has been unmounted.  Use hardware eject to remove the device now."
	breaksw

default:
	setenv MSG "Unable to eject.  Try hardware eject if possible."
	breaksw

endsw

inform $MSG
