]> Pileus Git - lackey/blob - src/cal.c
800a7f8b0f7fd00e6f3698f5edd6751c1918e35b
[lackey] / src / cal.c
1 /*
2  * Copyright (C) 2012 Andy Spencer <andy753421@gmail.com>
3  * 
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  * 
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  * 
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17
18 #include "util.h"
19 #include "date.h"
20 #include "cal.h"
21
22 /* Global data */
23 event_t *EVENTS;
24
25 /* Initialize */
26 void cal_init(void)
27 {
28         EVENTS = cal_events(2012, JAN, 0, 366);
29
30         /* Debug */
31         for (event_t *e = EVENTS; e; e = e->next)
32                 debug("event: %04d-%02d-%02d %02d:%02d: %s - %s\n",
33                                 e->start.year, e->start.month, e->start.day,
34                                 e->start.hour, e->start.min, e->name, e->desc);
35 }
36
37 /* Get events */
38 event_t *cal_events(year_t year, month_t month, day_t day, int days)
39 {
40         return ical_events(0, year, month, day, days)
41             ?: dummy_events(0, year, month, day, days);
42 }