#! /bin/sh
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
# bos720 src/bos/usr/sbin/svcmd/zic/yearistype.sh 1.4.1.1 
#  
# Licensed Materials - Property of IBM 
#  
# Restricted Materials of IBM 
#  
# COPYRIGHT International Business Machines Corp. 2001,2011 
# All Rights Reserved 
#  
# US Government Users Restricted Rights - Use, duplication or 
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp. 
#  
# IBM_PROLOG_END_TAG 
# @(#)42        1.4.1.1  src/bos/usr/sbin/svcmd/zic/yearistype.sh, uw7cmds, bos720 7/15/11 04:05:02
# Portability: check for AIX dspmsg utility.
DSPMSG=/usr/bin/dspmsg

type $DSPMSG >/dev/null
DM=$?

case $#-$1 in
	2-|2-0*|2-*[!0-9]*)
		if [ $DM = 0 ]
		then
			$DSPMSG -s 1 sysvyearistype.cat  1 "yearistype : wild year - %s" $1 >&2
		else
			echo "$0: wild year - $1" >&2
		fi
		exit 1 ;;
esac

case $#-$2 in
	2-even)
		case $1 in
			*[24680])			exit 0 ;;
			*)				exit 1 ;;
		esac ;;
	2-nonpres|2-nonuspres)
		case $1 in
			*[02468][048]|*[13579][26])	exit 1 ;;
			*)				exit 0 ;;
		esac ;;
	2-odd)
		case $1 in
			*[13579])			exit 0 ;;
			*)				exit 1 ;;
		esac ;;
	2-uspres)
		case $1 in
			*[02468][048]|*[13579][26])	exit 0 ;;
			*)				exit 1 ;;
		esac ;;
	2-*)
		if [ $DM = 0 ]
		then
			$DSPMSG -s 1 sysvyearistype.cat  2 "yearistype : wild type - %s" $2 >&2
		else
			echo "$0: wild type - $2" >&2 
		fi
		exit 1 ;;
esac
if [ $DM = 0 ]
then
	$DSPMSG -s 1 sysvyearistype.cat  3 "yearistype : usage is %s year even|odd|uspres|nonpres|nonuspres" $0 >&2
else
	echo "$0: usage is $0 year even|odd|uspres|nonpres|nonuspres" >&2
fi
exit 1
