2 * Copyright (C) 2017 Andy Spencer <andy753421@gmail.com>
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.
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.
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/>.
32 event_t *event = EVENTS;
33 for (int d = 0; d < PRINT; d++) {
34 /* Get start and end of the day */
35 date_t start = {SEL.year, SEL.month, SEL.day, 0, 0};
36 date_t end = {SEL.year, SEL.month, SEL.day, 24, 0};
38 add_days(&start.year, &start.month, &start.day, d);
39 add_days(&end.year, &end.month, &end.day, d);
41 /* Print day header */
42 wday_t wday = day_of_week(start.year, start.month, start.day);
45 printf("%s, %s %d, %d\n",
47 month_to_string(start.month),
51 /* Skip forward to the day */
52 while (event && compare(&start, &event->start) > 0)
55 /* Print event info */
57 while (event && compare(&end, &event->start) > 0) {
60 printf("* %02d:%02d - %02d:%02d",
61 event->start.hour, event->start.min,
62 event->end.hour, event->end.min);
66 printf(" %s\n", event->name);
68 printf(" Location: %s\n", event->loc);
70 printf(" Description: %s\n", event->desc);
77 printf(" No events\n");