#!/bin/bash
#
# (c) 2008,2009 Fabian Herschel
# GNU Public License. No warranty.
#
LIC=$(cat <<EOLIC
  whbcc: Tool to configure heartbeat2 resources
  Copyright (C) 2008,2009  Fabian Herschel

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
EOLIC
)
# 

usage()
{
	if [ "$wowmode" -eq 1 ]; then
		echo "usage: $wowprompt" '--config CONFIG_FILE AGENT'
		echo "usage: $wowprompt" '[ --help | --list-agents | --list-templates |--license ]'
	else
		echo "usage: $0" '--config CONFIG_FILE AGENT'
		echo "usage: $0" '[ --help | --list-agents | --list-templates | --license ]'
	fi
}


wowmode=0
while [ $# -gt 0 ]; do
	case "$1" in
		--wow ) 
			wowmode=1
			wowprompt="$2"
			shift
			;;
		-? | -h | --help ) usage
				exit 0
				;;
		--list-agents | --la )
			(cd /usr/lib/wow/agents; ls -1 )
				;;
		--list-templates | --lt )
			(cd /usr/share/wow/xml; ls -1 )
				;;
		--config )
			config="$2"
			agent="$3"
			/usr/lib/wow/agents/$agent --config "$config"
				;;
		--license )
			echo "$LIC"
				;;
	esac
	shift
done
