#! /bin/sh
#
# @(#)setBANNERTRAY	1.3	LPS_UNX_COM	2/19/95
#
# Copyright 1993   Digital Equipment Corporation, Maynard, MA
#
# setBANNERTRAY
#
# A script that produces a value for attribute BANNERTRAY.
#
# Parameters:
#    $1 - LPS class identifier, one of {PC, MC, PS, ENV}
#    $2 - Operating system type identifier (eg: SV2, BSD, etc)
#    $3 - Print client type identifier (eg: AIX, BSD, SV3, etc)
#    $4 - PrintServer printer model (eg: LPS17, LPS20)
#    $5 - Default value for the attribute
#    $6 - Path of the output file to receive the final attribute value
#
# Global variables:
#    ECHON
#    FUNCS
#    PAGER
#    TR    (for the checknumrange() function)
#
# Exit values:
#    0 - Success, output file contains newly set attribute value.
#    1 - Error or interruption occurred, error messages go to stderr,
#	 contents of the output file are undefined.
###

CLASS=$1
OSTYPE=$2
PCTYPE=$3
PSMODEL=$4
DEFVAL=$5
OUTFILE=$6

. $FUNCS   # Import the standard LPS shell functions

if [ "$CLASS" = "ENV" ]
then
   NOTES="
The choices for the input tray depend on the PrintServer printer used
with the corresponding Print Client.  The response you provide for
this question will be used as the default response when a Print Client
is actually configured; if the PrintServer printer associated with the
Print Client does not support the input tray you select here, then an
alternate default response will be used when the Print Client is
configured.
"
fi

showhelp true "
Banner sheet input tray?

A Print Client can be configured so that the banner sheet is drawn
from a special input tray rather than being drawn from the default
input tray.  Often a site will load one of the input trays (usually
the \"top\" input tray) with colored paper stock, making it easier
to separate print jobs.
$NOTES
Note that the \"default\" input tray indicates that the input tray
designated as the default input tray for the printer should be used.
"

# Ensure the default value is valid for the specified printer model,
# and if not, then reset the default value to "default".

if validtray input "$DEFVAL" $PSMODEL
then
    :
else
    DEFVAL="default"
fi

list="`gettraylist input $PSMODEL`"

choose "$DEFVAL" "Banner sheet input tray" $list

if [ -z "$RESPONSE" ]
then
    RESPONSE="$DEFVAL"
fi

echo "$RESPONSE" > $OUTFILE

exit 0
