#! /usr/bin/ksh
#
# Function compNullAttr: run pdls on a single attribute and
# compare its output to a null attribute.
# If they are equal, return 0 (success) else return 1.
# in this function the parameters are as follows:
#
# Input positional parameters:
#     $1. the class of the object
#     $2. The attribute you are searching for
#     $3. The target i.e. spooler or supervisor name
#
# 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 -c $1 -r $2 $3 | awk '{ print $4 }'`

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

# test to see if pdls returned what we expected - return 0 if yes
if [ "${LOC_ANS}" = "" ]
then
   exit 0
fi

# error - didn't get back what we wanted
reportError compNullAttr: attribute $2 - value got '-->'"${LOC_ANS}"'<--' wanted NULL
exit 1
