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