#ident	"@(#)osadmin3b2:admin/menu/diskmgmt/harddisk/display	1.2"
#menu# display hard disk partitioning
#help# 
#help#	Display the partitioning of a hard disk.  Also shows the
#help#	hardware location of the selected disk.

flags="-qq -k$$"
trap 'exit 0' 1 2  15

DIRPATH=$MENUTOP/menu/diskmgmt/harddisk
PATTERN=`ls $DIRPATH/display.d`
ddrive=`selectdevice -c $$ /dev/rSA $PATTERN`
if [ "$ddrive" = "" ]
then
	exit 0
fi
ndrive=`drivename ${ddrive}`

. $DIRPATH/display.d/`basename $ddrive | sed s/[0-9]*$//p`

dskname=`samedev ${ddrive} /dev/rdsk/c*d*s6`
dskname=`basename ${dskname}`
havet=`expr ${dskname} : '.*\(t\).*'`
if [ -n "${havet}" ]
then
  eval `echo ${dskname} | sed -e 's:^c\([0-9]*\)t\([0-9]*\)d\([0-9]*\).*$:slot=\1 tc=\2 drv=\3:'`
  echo "Displaying ${ndrive} partitioning (hardware slot ${slot},"
  echo "target controller ${tc}, drive ${drv}):\n"
else
  eval `echo ${dskname} | sed -e 's:^c\([0-9]*\)d\([0-9]*\).*$:slot=\1 drv=\2:'`
  slot=`expr ${slot} - 1`
  echo "Displaying ${ndrive} partitioning (hardware slot ${slot} drive ${drv}):\n"
fi

/usr/sbin/prtvtoc ${ddrive}	
if [ $? -ne 0 ]
then
	echo "\tDisplay of the hard disk partitioning failed."
	echo "\tSuggestions:  1) The disk may not be partitioned."
	echo "\t              2) There may be a problem with the hard disk itself."
	echo "\t                 Call your service representative."
	exit 1
fi
exit 0
