#!/bin/ksh
#
# Copyright (c) 2001 by Sun Microsystems, Inc.
# All rights reserved.
#
#ident	"@(#)did2ctd	1.2	01/02/05 SMI"
#
# Given a did integer number, the CTD name is returned.  e.g. 4 ->
# c3t1d0

did=$1
bin_dir=/usr/cluster/bin

ctd=$($bin_dir/scdidadm -l -o path -o name | grep "d${did}[ ]*$" | awk -F'/' '{print $4}' | awk '{print $1}')

if [[ -z $ctd ]]
then
	echo "Error in converting the DID name to CTD format."
	return 1
else
	echo $ctd
	return 0
fi


