Here is an new version of the 5 patches with changes to two files: calendars/calendar.christian advent.c
The file, calendar.christian, Advent entries are changed from: 11/SunLast First Sunday of Advent (4th Sunday before Christmas) 12/SunFirst First Sunday of Advent (4th Sunday before Christmas) to: Advent First Sunday of Advent (4th Sunday before Christmas) The file, advent.c, the calculation is changed from: /* find 4 weeks (28 days) before the Sunday before Christmas */ yearday = yearday - 28; to: /* If Christmas is not Sunday subtract 3 weeks otherwise subtract 4 */ if ( dayofweek > 0 ) yearday = yearday - 21; else yearday = yearday - 28; Here are all 5 of the patch files: --- calendar-7.2/calendars/calendar.christian.orig 1998-11-07 20:38:00.000000000 -0800 +++ calendar-7.2/calendars/calendar.christian 2022-12-05 08:49:24.668905247 -0800 @@ -21,8 +21,7 @@ Easter+56 Trinity Sunday (7 days after Pentecost) Easter+60 Corpus Christi (11 days after Pentecost) 10/18 Feast Day of St. Luke -11/SunLast First Sunday of Advent (4th Sunday before Christmas) -12/SunFirst First Sunday of Advent (4th Sunday before Christmas) +Advent First Sunday of Advent (4th Sunday before Christmas) 12/06 St. Nicholas' Day 12/25 Christmas --- calendar-7.2/Makefile.orig 2016-09-10 23:40:57.000000000 -0700 +++ calendar-7.2/Makefile 2022-12-02 17:28:49.720561727 -0800 @@ -1,7 +1,7 @@ # $OpenBSD: Makefile,v 1.11 2016/09/11 06:40:57 natano Exp $ PROG= calendar -SRCS= calendar.c io.c day.c pesach.c ostern.c paskha.c +SRCS= calendar.c io.c day.c pesach.c ostern.c paskha.c advent.c INTER= de_DE.UTF-8 hr_HR.UTF-8 ru_RU.UTF-8 fr_FR.UTF-8 beforeinstall: --- calendar-7.2/calendar.h.orig 2022-12-02 12:24:15.858386699 -0800 +++ calendar-7.2/calendar.h 2022-12-02 13:21:12.184331976 -0800 @@ -80,6 +80,7 @@ int getmonth(char *); int pesach(int); int easter(int); int paskha(int); +int advent(int); void insert(struct event **, struct event *); struct match *isnow(char *, int); FILE *opencal(void); @@ -113,12 +114,14 @@ extern int f_Setday; /* calendar invoked #define EASTERNAMELEN (sizeof(EASTER) - 1) #define PASKHA "paskha" #define PASKHALEN (sizeof(PASKHA) - 1) +#define ADVENT "advent" +#define ADVENTLEN (sizeof(ADVENT) - 1) /* calendars */ extern enum calendars { GREGORIAN = 0, JULIAN, LUNAR } calendar; extern u_long julian; -#define NUMEV 3 /* Total number of such special events */ +#define NUMEV 4 /* Total number of such special events */ extern struct specialev spev[NUMEV]; /* For calendar -a, specify a maximum time (in seconds) to spend parsing --- calendar-7.2/day.c.orig 2019-08-12 13:03:28.000000000 -0700 +++ calendar-7.2/day.c 2022-12-02 13:25:46.483327583 -0800 @@ -143,6 +143,9 @@ setnnames(void) spev[2].name = strdup(PASKHA); spev[2].nlen = PASKHALEN; spev[2].getev = paskha; + spev[3].name = strdup(ADVENT); + spev[3].nlen = ADVENTLEN; + spev[3].getev = advent; for (i = 0; i < NUMEV; i++) { if (spev[i].name == NULL) err(1, NULL); --- calendar-7.2/advent.c.orig 2022-12-05 08:40:50.753913479 -0800 +++ calendar-7.2/advent.c 2022-12-05 08:56:11.084898737 -0800 @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2022 by Richard Narron <rich...@aaazen.com>, California + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include <stdio.h> + +#include "calendar.h" + +/* return year day for Advent, the 4th Sunday before Christmas */ + +int +advent(int year) +{ + int dayofweek = 0; + int nextyear = 0; + int yearday = 0; + + /* Christmas and the next New years are the same day of the week */ + nextyear = year + 1; + dayofweek = foy(nextyear); + + /* find Christmas day of year */ + if isleap(year) + yearday = 360; + else + yearday = 359; + + /* find the year day of the Sunday on or before Christmas */ + yearday = yearday - dayofweek; + + /* If Christmas is not Sunday subtract 3 weeks otherwise subtract 4 */ + if ( dayofweek > 0 ) + yearday = yearday - 21; + else + yearday = yearday - 28; + + return (yearday); +}