shithub: 9scripts

Download patch

ref: 8968279351539eb300d4092503b1d0ea7d727c82
parent: b7084dac107fc28a73f55a4b3466d5ef10b2737b
author: glenda <[email protected]>
date: Wed Feb 24 19:08:09 EST 2021

oh the rc shell

--- /dev/null
+++ b/util/calendar
@@ -1,0 +1,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
+'