diff options
author | Edwin Groothuis <edwin@FreeBSD.org> | 2008-08-05 08:11:54 +0000 |
---|---|---|
committer | Edwin Groothuis <edwin@FreeBSD.org> | 2008-08-05 08:11:54 +0000 |
commit | 35304a1641c82d5bf294317683451576fced313e (patch) | |
tree | 207ef0ba038d902b3008c892f508249448bae268 /usr.bin/calendar/ostern.c | |
parent | 7f05f04afd5f70d7d980c03caaf0f5d78afa4593 (diff) | |
download | src-35304a1641c82d5bf294317683451576fced313e.tar.gz src-35304a1641c82d5bf294317683451576fced313e.zip |
style(9)ify usr.bin/calendar
PR: bin/118644
Approved by: bde@ (mentor)
MFC after: 1 week
Notes
Notes:
svn path=/head/; revision=181322
Diffstat (limited to 'usr.bin/calendar/ostern.c')
-rw-r--r-- | usr.bin/calendar/ostern.c | 67 |
1 files changed, 33 insertions, 34 deletions
diff --git a/usr.bin/calendar/ostern.c b/usr.bin/calendar/ostern.c index 833d6233f81d..76e593327a39 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); } |