#! /bin/sh
#
# @(#)setSYSCONTACT	1.2	LPS_UNX_COM	2/19/95
#
# Copyright 1994   Digital Equipment Corporation, Maynard, MA
#
# setSYSCONTACT
#
# A script that produces a value for PS_SYSCONTACT.
#
# 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
#    TMPDIR
#    TR
#
# 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

export ECHON FUNCS PAGER TMPDIR TR

QUESTION="Who is the primary contact for the printer"

showhelp true "
${QUESTION}?

If SNMP is enabled, the printer can respond to queries about
the contact for the printer, the person and/or organization
responsible for the overall operation of the printer.

This contact information is simply a string of text that can be very
free form in content.

Examples of contact information:

    John Doe, x9142

    Central Computer Services

    Printer Support Staff, MLO2-729

    Pat, Bill or Jean

    Automation Universal (603-555-1234)

The contact is described as a single line of text.  You may enter any
type of displayable (printable) character as part of the contact text.

For more information about SNMP and setting the contact information,
please refer to the Management Guide.
"

if [ "$DEFVAL" ]		# To catch first time definitions
then
    confirm=true
fi

RESPONSE="$DEFVAL"

while true
do
    if $confirm
    then
	if [ "$RESPONSE" ]
	then
	    echo
	    echo "The contact information is current described as:"
	    echo "$RESPONSE"
	    DEFRESP=y
	else
	    echo
	    echo "The contact information is currently blank."
	    DEFRESP=n
	fi

	if yesno $DEFRESP "Is this contact information acceptable"
	then
	    echo "$RESPONSE" > $OUTFILE
	    exit 0
	fi
    fi

    echo
    echo "Enter the contact text, press RETURN when completed:"
    read RESPONSE

    confirm=true
done
