#! /bin/sh
#
# @(#)getPSmodel	1.3	LPS_UNX_COM	2/19/95
#
# Copyright 1993   Digital Equipment Corporation, Maynard, MA
#
# getPSmodel
#
# Support script to fetch the PrintServer printer model string for
# the specified PS object.
#
# NOTE:  This script is different than most in that the PS model string
#        is output directly to stdout, instead of using the normal output
#        file mechanism.  You use this script in the following manner
#        (assume that "foobar" is the PS object name):
#
#             if PSMODEL="`getPSmodel foobar`"
#             then
#                 # Failure!
#             else
#                 # Success, the PSMODEL var contains the model string
#             fi
#
# Note carefully the REVERSE LOGIC here!  That is, a "good" exit value is
# returned only if there is an error.  This allows for simpler script
# structures that don't have to have dummy handling (ie, ":") for success.
#
# Parameters:
#    $1 - PS object name
#
# Global variables:
#    LPSODB
#    LPSODBLIST
#
# Exit values:
#    0 - Failure, an error message was written to stderr.
#    1 - Success, the model string was written to stdout.
###

PSNAME="$1"

if $LPSODBLIST -f $LPSODB -s "$PSNAME" -v model
then
    exit 1
fi

echo 1>&2
echo "    FAILURE to get the MODEL for PrintServer printer $PSNAME !!!" 1>&2
echo 1>&2

pause 1>&2

exit 0
