| 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 |
case $#-$1 in |
| 7 |
2-|2-0*|2-*[!0-9]*) |
| 8 |
echo "$0: wild year - $1" >&2 |
| 9 |
exit 1 ;; |
| 10 |
esac |
| 11 |
|
| 12 |
case $#-$2 in |
| 13 |
2-even) |
| 14 |
case $1 in |
| 15 |
*[24680]) exit 0 ;; |
| 16 |
*) exit 1 ;; |
| 17 |
esac ;; |
| 18 |
2-nonpres|2-nonuspres) |
| 19 |
case $1 in |
| 20 |
*[02468][048]|*[13579][26]) exit 1 ;; |
| 21 |
*) exit 0 ;; |
| 22 |
esac ;; |
| 23 |
2-odd) |
| 24 |
case $1 in |
| 25 |
*[13579]) exit 0 ;; |
| 26 |
*) exit 1 ;; |
| 27 |
esac ;; |
| 28 |
2-uspres) |
| 29 |
case $1 in |
| 30 |
*[02468][048]|*[13579][26]) exit 0 ;; |
| 31 |
*) exit 1 ;; |
| 32 |
esac ;; |
| 33 |
2-*) |
| 34 |
echo "$0: wild type - $2" >&2 ;; |
| 35 |
esac |
| 36 |
|
| 37 |
echo "$0: usage is $0 year even|odd|uspres|nonpres|nonuspres" >&2 |
| 38 |
exit 1 |