summaryrefslogtreecommitdiffstats
path: root/usr.bin/calendar/ostern.c
diff options
context:
space:
mode:
authoredwin <edwin@FreeBSD.org>2008-08-05 08:11:54 +0000
committeredwin <edwin@FreeBSD.org>2008-08-05 08:11:54 +0000
commit8a75d14908eac0b506537bc0476a339cb9b13f7d (patch)
tree207ef0ba038d902b3008c892f508249448bae268 /usr.bin/calendar/ostern.c
parent484fc19a89996c8f1e57aa48768f139ab220c5b6 (diff)
downloadFreeBSD-src-8a75d14908eac0b506537bc0476a339cb9b13f7d.zip
FreeBSD-src-8a75d14908eac0b506537bc0476a339cb9b13f7d.tar.gz
style(9)ify usr.bin/calendar
PR: bin/118644 Approved by: bde@ (mentor) MFC after: 1 week
Diffstat (limited to 'usr.bin/calendar/ostern.c')
-rw-r--r--usr.bin/calendar/ostern.c67
1 files changed, 33 insertions, 34 deletions
diff --git a/usr.bin/calendar/ostern.c b/usr.bin/calendar/ostern.c
index 833d623..76e5933 100644
--- a/usr.bin/calendar/ostern.c
+++ b/usr.bin/calendar/ostern.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 1996 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
- * All rights reserved.
+ * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -46,28 +46,28 @@ __FBSDID("$FreeBSD$");
int
easter(int year) /* 0 ... abcd, NOT since 1900 */
{
- int G, /* Golden number - 1 */
- C, /* Century */
- H, /* 23 - epact % 30 */
- I, /* days from 21 March to Paschal full moon */
- J, /* weekday of full moon */
- L; /* days from 21 March to Sunday on of before full moon */
-
- G = year % 19;
- C = year / 100;
- H = (C - C/4 - (8*C+13)/25 + 19*G + 15) % 30;
- I = H - (H/28)*(1 - (H/28)*(29/(H + 1))*((21 - G)/11));
- J = (year + year/4 + I + 2 - C + C/4) % 7;
-
- L = I - J;
-
- if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0))
- return 31 + 29 + 21 + L + 7;
- else
- return 31 + 28 + 21 + L + 7;
+ int G, /* Golden number - 1 */
+ C, /* Century */
+ H, /* 23 - epact % 30 */
+ I, /* days from 21 March to Paschal full moon */
+ J, /* weekday of full moon */
+ L; /* days from 21 March to Sunday on of before full moon */
+
+ G = year % 19;
+ C = year / 100;
+ H = (C - C / 4 - (8 * C + 13) / 25 + 19 * G + 15) % 30;
+ I = H - (H / 28) * (1 - (H / 28) * (29 / (H + 1)) * ((21 - G) / 11));
+ J = (year + year / 4 + I + 2 - C + C / 4) % 7;
+
+ L = I - J;
+
+ if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0))
+ return 31 + 29 + 21 + L + 7;
+ else
+ return 31 + 28 + 21 + L + 7;
}
-/* return year day for Easter or easter depending days
+/* return year day for Easter or easter depending days
* Match: Easter([+-][0-9]+)?
* e.g: Easter-2 is Good Friday (2 days before Easter)
*/
@@ -77,17 +77,16 @@ geteaster(char *s, int year)
{
int offset = 0;
-#define EASTER "easter"
-#define EASTERNAMELEN (sizeof(EASTER) - 1)
+#define EASTER "easter"
+#define EASTERNAMELEN (sizeof(EASTER) - 1)
if (strncasecmp(s, EASTER, EASTERNAMELEN) == 0)
- s += EASTERNAMELEN;
- else if ( neaster.name != NULL
- && strncasecmp(s, neaster.name, neaster.len) == 0
- )
- s += neaster.len;
+ s += EASTERNAMELEN;
+ else if (neaster.name != NULL
+ && strncasecmp(s, neaster.name, neaster.len) == 0)
+ s += neaster.len;
else
- return(0);
+ return (0);
#if DEBUG
printf("%s %d %d\n", s, year, EASTERNAMELEN);
@@ -96,16 +95,16 @@ geteaster(char *s, int year)
/* Easter+1 or Easter-2
* ^ ^ */
- switch(*s) {
+ switch (*s) {
case '-':
case '+':
- offset = atoi(s);
- break;
+ offset = atoi(s);
+ break;
default:
- offset = 0;
+ offset = 0;
}
-
+
return (easter(year) + offset);
}
OpenPOWER on IntegriCloud