#
#    Copyright (c) 2015-2016 Brocade Communications Systems, Inc.
#    All rights reserved.
#
#    File name:   cmdhist.sh
#    Module name: fabos/src/security
#
#    This script is wrapper to the functionality of some of the commands
#    that are defined as builtin functions in /etc/profile file.
#
if [ $1 == "clihistory" ]; then
	export CLI_HISTORY_ADD="SET"
	oldcmd=$2
	newcmd=$3
	if [ "$newcmd" != "$oldcmd" ] ; then
		echo "${newcmd#*[0-9]*  }" | clihistory --add
	fi
	export CLI_HISTORY_ADD=""
elif [ $1 == "tsTimeZone" ]; then
	if [ -x /fabos/link_bin/tsTimeZone ]
        then
		command "$@"
		eval $(tsTZ)
	else
		echo "tsTimeZone: command not found"
		exit 1
	fi
fi
