#!/bin/bash
#
#FM_OptionChk ver1.0.0	
#
# usage: 
# FM_OptionChk callfunc CurrentTraceLogLevel cmdoption param1 param2
#		  param3 param4
#
# Description: 
#	for check command option
# Copyright (C) 2012 NEC Corporation.
#####################################################################


#define value
callfunc=$1
CurrentTraceLogLevel=$2
cmdoption=$3
param1=$4
param2=$5
param3=$6
param4=$7
calib=1
autodetect=2
detect=3
status=4
set=5
save=6
restore=7
get=8
graph=9
test=10
log=11
usage=0
SetPath=/etc/FilterMonitor
#define functions########################################################
#select options
SelectOption(){
case "$1" in
	"-calib")
		if [ $# -eq 1 ]
		then
			#tracelog
			return $calib
		fi;;

	"-autodetect")
		if [ $# -eq 1 ]
		then
			#tracelog
			return $autodetect
		fi;;

	"-detect")
		if [ $# -eq 1 ]
		then
			#tracelog
			return $detect
		fi;;

	"-status")
		if [ $# -eq 1 ]
		then
			#tracelog
			return $status
		fi;;

	"-set")
		if [ $# -eq 5 ]
		then
			#tracelog
			return $set
		fi;;

	"-save")
		if [ $# -eq 2 ]
		then
			return $save
		fi;;

	"-restore")
		if [ $# -eq 2 ]
		then
			return $restore
		fi;;

	"-get")
		if [ $# -eq 1 ]
		then
			return $get
		fi;;

	"-graph")
		if [ $# -eq 3 ]
		then
			return $graph
		fi;;
	"-test")
		if [ $# -eq 2 ]
		then
			return $test
		fi;;
	"-test")
		if [ $# -eq 2 ]
		then
			return $test
		fi;;

	"-log")
		if [ $# -eq 2 ]
		then
			return $log
		fi;;

	"-h")
		if [ $# -eq 1 ]
		then
			return $usage
		fi;;
esac
}


FM_OptionChk(){
#parameter is invalid
SelectOption $cmdoption $param1 $param2 $param3 $param4
}
#####tracelog start######

FM_OptionChk $callfunc $CurrentTraceLogLevel $cmdoption $param1 $param2 $param3 $param4

#####tracelog end######









