~fultonbrowne/rc-scripts

ref: 68da554c01b584108eb3c7cffe86961ca09e1d2b rc-scripts/util/calendar -rwxr-xr-x 466 bytes
68da554c — glenda so I clearly don't know rc very well 6 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/ape/sh
awk < $home/lib/calendar '
BEGIN{
	x = "Jan 31 Feb 28 Mar 31 Apr 30 May 31 Jun 30 Jul 31 Aug 31 Sep 30 Oct 31 Nov 30 Dec 31 Jan 31"
	split(x, data)
	for (i = 1; i < 24; i+= 2) {
		days[data[i]] = data[i+2]
		nextmon[data[i]] = data[i+2]
	}
	split("'"`date`"'", date)
	mon1 = date[2]; day1 = date[3]
	mon2 = mon1; day2 = day1 + 1
	if (day1 >= days[mon1]) {
		day2 = 1
		mon2 = nextmon[mon1] 
	}
}
$1 == mon1 && $2 == day1 || $1 ==  mon2 && $2 == day2
'