summaryrefslogtreecommitdiffstats
path: root/usr.bin/calendar/ostern.c
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1996-05-10 17:32:06 +0000
committerache <ache@FreeBSD.org>1996-05-10 17:32:06 +0000
commitdf58ec580d62b91cdd59aa7806163c0bb3e9fa8e (patch)
tree35650da73c5ea4db017c33335e7f268ed8fdb6bf /usr.bin/calendar/ostern.c
parent02fead7e055f8da6555c29a488d8a0b2569cf17c (diff)
downloadFreeBSD-src-df58ec580d62b91cdd59aa7806163c0bb3e9fa8e.zip
FreeBSD-src-df58ec580d62b91cdd59aa7806163c0bb3e9fa8e.tar.gz
Allow to configure national Easter names.
Speedup my national months/days handling code.
Diffstat (limited to 'usr.bin/calendar/ostern.c')
-rw-r--r--usr.bin/calendar/ostern.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/usr.bin/calendar/ostern.c b/usr.bin/calendar/ostern.c
index e0ae0f5..8ff646d 100644
--- a/usr.bin/calendar/ostern.c
+++ b/usr.bin/calendar/ostern.c
@@ -1,11 +1,14 @@
/*
* Copyright (c) 1995 Wolfram Schneider. Public domain.
*
- * $Id: ostern.c,v 1.1 1996/02/02 06:02:40 wosch Exp $
+ * $Id: ostern.c,v 1.2 1996/05/10 16:29:42 ache Exp $
*/
#include <string.h>
#include <stdlib.h>
+#include <stdio.h>
+
+#include "calendar.h"
/* return year day for Easter */
@@ -62,12 +65,18 @@ geteaster(s, year)
int year;
{
register int offset = 0;
+ extern struct fixs neaster;
#define EASTER "easter"
#define EASTERNAMELEN (sizeof(EASTER) - 1)
- /* no easter */
- if (strncasecmp(s, EASTER, EASTERNAMELEN))
+ if (strncasecmp(s, EASTER, EASTERNAMELEN) == 0)
+ s += EASTERNAMELEN;
+ else if ( neaster.name != NULL
+ && strncasecmp(s, neaster.name, neaster.len) == 0
+ )
+ s += neaster.len;
+ else
return(0);
#if DEBUG
@@ -77,14 +86,11 @@ geteaster(s, year)
/* Easter+1 or Easter-2
* ^ ^ */
- switch(*(s + EASTERNAMELEN)) {
+ switch(*s) {
case '-':
- offset = -(atoi(s + EASTERNAMELEN + 1));
- break;
-
case '+':
- offset = atoi(s + EASTERNAMELEN + 1);
+ offset = atoi(s);
break;
default:
OpenPOWER on IntegriCloud