#! /usr/bin/ksh
#
# @(#)cmsmreport.sh	1.2	98/05/21 SMI
#
# Copyright (c) 1998, by Sun Microsystems, Inc.
# All rights reserved.
#
# cmsmreport name number attribute value class num ...
#
# Purpose:	This function sets the attribute named in $3 to the 
#		value in $4 in the objects named from $5 onwards using
#		cmsreport
#
# name          	- class name of CMS Object setting attribute
# number        	- instance number of CMS Object setting attribute
# attribute     	- attribute to be set
# value         	- value that attribute is to be set to
# class num ...         - a string of target CMS object instances
#
# Error Codes:
# Return 0 on success, non-zero otherwise
#

if [[ $# -lt 4 ]]
then
        $CMSHOME/lib/cmsdebug "cmsmreport: wrong no. of args $1 $2 $3 $4"
	exit 1
fi

name="$1"
number="$2"
attribute="$3"
value="$4"

shift 4;
integer i=1
while [[ i -lt $# ]]
do
	integer x=i+1
	eval class="\${$i}"
	eval inst=\${$x}
	if [[ "$class" != "null" ]]
	then
		$CMSHOME/lib/cmsreport $class $inst $attribute "$value"
	fi
	i=i+2
done
exit 0
