1#! /bin/sh
2
3: 'This file is in the public domain, so clarified as of'
4: '2006-07-17 by Arthur David Olson.'
5
6: '@(#)yearistype.sh	8.2'
7
8case $#-$1 in
9	2-|2-0*|2-*[!0-9]*)
10		echo "$0: wild year - $1" >&2
11		exit 1 ;;
12esac
13
14case $#-$2 in
15	2-even)
16		case $1 in
17			*[24680])			exit 0 ;;
18			*)				exit 1 ;;
19		esac ;;
20	2-nonpres|2-nonuspres)
21		case $1 in
22			*[02468][048]|*[13579][26])	exit 1 ;;
23			*)				exit 0 ;;
24		esac ;;
25	2-odd)
26		case $1 in
27			*[13579])			exit 0 ;;
28			*)				exit 1 ;;
29		esac ;;
30	2-uspres)
31		case $1 in
32			*[02468][048]|*[13579][26])	exit 0 ;;
33			*)				exit 1 ;;
34		esac ;;
35	2-*)
36		echo "$0: wild type - $2" >&2 ;;
37esac
38
39echo "$0: usage is $0 year even|odd|uspres|nonpres|nonuspres" >&2
40exit 1
41