#!/bin/sh
#
#ident	"@(#)dtadmin:dashboard/dtstatus	1.3"
#	Copyright (c) 1990, 1991, 1992, 1993, 1994 Novell, Inc. All Rights Reserved.
#	Copyright (c) 1993 Novell, Inc. All Rights Reserved.
#	  All Rights Reserved

#	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF Novell Inc.
#	The copyright notice above does not evidence any
#	actual or intended publication of such source code.


#	utility script to add or delete components for the Status Report
#	(aka "dashboard") display.

give_usage() {
	echo "USAGE: dtstatus -a filename" >& 2
	echo "       dtstatus -d entry" >& 2
	echo "       dtstatus -f newflag entry" >& 2
}

DFILE=/usr/X/desktop/dashboard/StatusFile
if [ $# -lt 2 ]
then
	give_usage
	exit 1
else	case $1 in
	-a)	if [ $# -ne 2 ]
		then
			give_usage
			exit 1
		else
			cat $2 >> $DFILE
		fi
		break;;
	-d)	shift
		for ENTRY in $*
		do
			PAT="^$ENTRY	"
#				  ---^	note the TAB; it's critical	
			ed $DFILE >/dev/null <<!
g/$PAT/d
w
q
!
		done
		break;;
	-f)	if [ $# -lt 3 ]
		then
			give_usage
			exit 1
		else
			FLAG="	$2	"
			shift 2
			for ENTRY in $*
			do
				PAT="^$ENTRY	"
				ed $DFILE >/dev/null <<!
g/$PAT/s/	.*	/$FLAG/
w
q
!
			done
		fi
		break;;
	*)	give_usage
		exit 1
		break;;
	esac
fi
