#! /bin/sh
#
# @(#)setIMAGESUFFIX	1.3	LPS_UNX_COM	02/19/95
#
# Copyright 1993   Digital Equipment Corporation, Maynard, MA
#
# setIMAGESUFFIX
#
# A script that produces a value for attribute IMAGESUFFIX.
#
# This script works ONLY for the ENV and PC classes.
#
# 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
#    LPSODB
#    LPSODBLIST
#    PAGER
#
# 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

if [ "$CLASS" = "PC" ]
then
    if [ "$PC_LPSIMAGES" ]
    then
	LPSIMAGES="$PC_LPSIMAGES"
    else
	if [ "$ENV_LPSIMAGES" ]
	then
	    LPSIMAGES="$ENV_LPSIMAGES"
	else
	    if LPSIMAGES="`$LPSODBLIST -f $LPSODB -e -v lpsimages`"
	    then
		echo
		echo "FAILURE to determine the LPS images directory path"
		exit 1
	    fi
	fi
    fi
else   # Should be the ENV class
    LPSIMAGES="$ENV_LPSIMAGES"
fi

showhelp true "
What is the file suffix for banner image files?

When user image display is enabled for banner sheets, the Print Client
will look for a file in the LPS images directory with the same name as
the requesting user account and having a special suffix (to be able to
differentiate between other images possibly associated with the user).

The value for this file suffix (also referred to as a file \"extension\")
is currently set to \"$DEFVAL\".

For example, if the user account of the current print job is \"punky\",
and if image display is enabled for banner sheets, the Print Client
will look for a file with the name \"punky$DEFVAL\" in the LPS images
directory ($LPSIMAGES).

If you do not choose the default value, then be sure you enter a 
period (\".\") character as the first character if normal filename
construction is defined.  This is entirely up to you, however, and you
may specify any file suffix string to your liking.
"

echo
$ECHON "File suffix for banner image files [\"$DEFVAL\"]? "
read resp

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

echo "$resp" > $OUTFILE

exit 0
