#! /usr/bin/ksh
#
# Function verprint:
# Use to verify printing (pdpr) to the special file created in /dev.
# The full path name must be passed as the only
# parameter.
# The special file must also be cleared to a size of zero (0) bytes before
# the first call to this function in a test case, using for example ...
#
#       echo -n "" > /dev/SpecialFileName
#
# The function will then clear the file size (after it's verified) for
# subsequent use.
#
# Input positional parameter:
#     $1. Special print file
#
# This function returns 0 if success, else an error
#
# Author: Giovanni Perrone/Bob Payne

# Get the file size.
typeset ret_code

SIZE=`du -a $1 | awk '{ print $1 }'`
if [[ $SIZE = "0" ]]
  then
    sleep 30
    SIZE=`du -a $1 | awk '{ print $1 }'`
    if [[ $SIZE = "0" ]]
    then
	    reportError "Function verprint: pdpr did not print file"
	    ret_code=1
    else
	    print -n "" > $1  # clean the output file
	    ret_code=0
    fi
  else
	print -n "" > $1  # clean the output file
	ret_code=0
fi

exit $ret_code
#
#    Version      Date     Time    Owner   Comment
# ------------- -------- -------- -------- ----------------------------
# V1.2          07/20/94 14:53:01 nrjbehrs bogus->nrjbehrs
# V1.3          07/26/94 15:55:09 nrjbehrs IUT cleanup
