#!/pkg/bin/ksh
###
### June 2004, Simon Osborne
###
### Copyright (c) 2004-2005, 2008 by cisco Systems, Inc.
### All rights reserved.
###
### This shell is called when debug (or no debug) static is requested,
### and exists to allow the afi-all parameter to be supported.
###
### The first parameters given will be the flags to be specified for the call
### to debug, followed by -X and the AFI tag, and then the two strings which,
### when appended and prepended to the afi, determines the sysdb tuple to be
### set.
###

#
# Initialise the variables we will use.
#
flag1=

#
# The first arguments given will be the flags to be passed to the debug
# command. The -X flag is used to indicate where the end of these flags is.
#
# Supported flags are:
# -n  Indicates that the 'no' form of this command was selected.
#
param="$1";
shift;
until test "$param" = -X
do
    if test "$param" = -n
    then
        flag1=-n
    else
        exit 1
    fi
    
    param="$1";
    shift;
done

#
# Following the -X flag, is an argument specifying the AFI for which debug
# has been requested. If this is ipv4 or ipv6 we call the respective commands.
# If this is afi-all we must call both commands.
#
afi="$1"
shift
if test "$afi" = ipv4 -o "$afi" = ipv6
then
    debug $flag1 $1$afi$2
elif test "$afi" = all
then
    debug $flag1 ${1}ipv4${2}
    debug $flag1 ${1}ipv6${2}    
else
    exit 1
fi 

