#!/bin/sh

# If parameter already in stune, see if we're allowed to change it.
# Otherwise, append the new value to the end.

ed_stune()
{

	if [ "$sline" ]
	then
		ed - $STUNE >/dev/null 2>&1 <<-!
			/^$name[ 	]/c
			$name	= $new_value $LL
			.
			w
		!
		return $?
	else
		echo "$name\t= $new_value $LL" >>$STUNE
		return $?
	fi
}

STUNE=$1
name=$2
new_value=$3
LL=$4

if sline=`grep "^$name[ 	]" $STUNE 2>/dev/null`
then
	set - $sline
fi

if ed_stune
then
	:
else
	exit 1
fi

