#! /usr/bin/ksh
#
# Function compMvSingleAttr: run pdls on a single multi-valued attribute and
# compares its output to a single fourth positional parameter (a value).
# If the value exists in the list return 0 (success) else return 1.
# The parameters are as follows:
#
# Input positional parameters:
#     $1. the class of the object
#     $2. The attribute name you are searching for
#     $3. The target i.e. spooler or supervisor name
#     $4. The value that you expect somewhere in multi value return
#
# This function returns 0 if success, else an error
#
# Author: Tim Unser

# run the pdls command and get its answer
LOC_ANS=`$PD_PATH/pdls -s lin -c $1 -g -r $2 $3`

#echo $LOC_ANS

# check the return of the pdls
if [ $? != 0 ]
then
	reportError "compMvSingleAttr: pdls failure"
    exit 1
fi

# test to see if pdls returned what we expected - return 0 if yes
#echo $LOC_ANS | grep "^${4}"
echo $LOC_ANS | grep "${4}"

# check the return of the grep
if [ $? != 0 ]
then
    reportError "compMvSingleAttr: attribute value ${4} missing"
else
    exit 0
fi

exit 1
#
#    Version      Date     Time    Owner   Comment
# ------------- -------- -------- -------- ----------------------------
# V1.2          11/17/94 17:48:17 nrjbehrs iut -g fix; media object validation
