From b9a8d20bc5dba484a6ab23ac715dc02a3ae86f7d Mon Sep 17 00:00:00 2001 From: Andy Spencer Date: Fri, 12 Oct 2012 04:43:10 +0000 Subject: [PATCH] Some organization --- cal/dummy.c | 3 +- config.mk.example | 3 +- makefile | 12 ++-- src/date.c | 160 ++++++++++++++++++++++++++++++++++++++++++++++ src/date.h | 76 ++++++++++++++++++++++ src/event.c | 16 +++++ src/event.h | 11 ++-- src/main.c | 69 ++++---------------- src/main.h | 37 ----------- src/screen.c | 5 +- src/screen.h | 7 +- src/test.c | 6 +- src/util.c | 144 +++++++++-------------------------------- src/util.h | 61 ++---------------- view/day.c | 4 +- view/month.c | 2 +- view/week.c | 9 +-- view/year.c | 2 +- 18 files changed, 330 insertions(+), 297 deletions(-) create mode 100644 src/date.c create mode 100644 src/date.h delete mode 100644 src/main.h diff --git a/cal/dummy.c b/cal/dummy.c index da4b8ee..1e40fec 100644 --- a/cal/dummy.c +++ b/cal/dummy.c @@ -17,7 +17,8 @@ #include -#include "main.h" +#include "util.h" +#include "date.h" #include "event.h" /* Test data */ diff --git a/config.mk.example b/config.mk.example index 1942a0c..d3ce06a 100644 --- a/config.mk.example +++ b/config.mk.example @@ -1 +1,2 @@ -default: run-lackey +CFLAGS = -g -Wall -Werror --std=c99 +default: all run-lackey diff --git a/makefile b/makefile index 08012b6..e8bd692 100644 --- a/makefile +++ b/makefile @@ -8,9 +8,9 @@ LDFLAGS ?= -lncursesw # Sources PROG = lackey +PROG_SRC = main screen date event util TEST = test -SOURCES = main screen event util -TESTS = test util +TEST_SRC = test date VIEWS = day week month year todo notes settings help CALS = dummy @@ -25,14 +25,14 @@ run-$(TEST): $(TEST) ./$< clean: - rm -f src/*.o view/*.o $(PROG) $(TEST) + rm -f src/*.o view/*.o cal/*.o $(PROG) $(TEST) # Rules -$(PROG): $(SOURCES:%=src/%.o) $(VIEWS:%=view/%.o) $(CALS:%=cal/%.o) +$(PROG): $(PROG_SRC:%=src/%.o) $(VIEWS:%=view/%.o) $(CALS:%=cal/%.o) $(CC) $(CFLAGS) -o $@ $+ $(LDFLAGS) -$(TEST): $(TESTS:%=src/%.o) $(VIEWS:%=view/%.o) $(CALS:%=cal/%.o) +$(TEST): $(TEST_SRC:%=src/%.o) $(CALS:%=cal/%.o) $(CC) $(CFLAGS) -o $@ $+ $(LDFLAGS) -%.o: %.c $(SOURCES:%=src/%.h) makefile +%.o: %.c $(wildcard src/*.h) makefile $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< diff --git a/src/date.c b/src/date.c new file mode 100644 index 0000000..eebbe79 --- /dev/null +++ b/src/date.c @@ -0,0 +1,160 @@ +/* + * Copyright (C) 2012 Andy Spencer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/* Time Keeping Bugs Abound! */ + +#include +#include + +#include "date.h" + +/* Global data */ +year_t YEAR; +month_t MONTH; +day_t DAY; + +/* Initialize */ +void date_init(void) +{ + time_t sec = time(NULL); + struct tm *tm = localtime(&sec); + + YEAR = tm->tm_year+1900; + MONTH = tm->tm_mon; + DAY = tm->tm_mday-1; +} + +/* Time functions */ +int is_leap_year(year_t year) +{ + return (year % 400 == 0) ? 1 : + (year % 100 == 0) ? 0 : + (year % 4 == 0) ? 1 : 0; +} + +int days_in_year(year_t year) +{ + return 365 + is_leap_year(year); +} + +int days_in_month(year_t year, month_t month) +{ + static int mdays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; + int days = mdays[month]; + if (month == FEB) + days += is_leap_year(year); + return days; +} + +int weeks_in_month(year_t year, month_t month) +{ + int start = start_of_month(year, month); + int days = days_in_month(year, month); + return ((start + days)-1) / 7 + 1; +} + +wday_t day_of_week(year_t year, month_t month, day_t day) +{ + static int tmp[] = {0, 3, 2, 5, 0, 3, + 5, 1, 4, 6, 2, 4}; + if (month < MAR) + year--; + int start = year + year / 4 + - year / 100 + + year / 400 + + tmp[month]; + return (start + day + 1) % 7; +} + +wday_t start_of_month(year_t year, month_t month) +{ + return day_of_week(year, month, 0); +} + +void add_days(year_t *year, month_t *month, day_t *day, int days) +{ + time_t time = mktime(&(struct tm){ + .tm_year = *year-1900, + .tm_mon = *month, + .tm_mday = *day+1, + .tm_hour = 12}); + time += days*24*60*60; + struct tm *tm = localtime(&time); + *year = tm->tm_year+1900; + *month = tm->tm_mon; + *day = tm->tm_mday-1; +} + +void add_months(year_t *year, month_t *month, int months) +{ + int total = *year*12 + *month + months; + *year = total / 12; + *month = total % 12; +} + +/* Debug functions */ +const char *month_to_str(month_t month) +{ + static const char *map[] = + { "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", }; + return map[month%12]; +} +const char *month_to_string(month_t month) +{ + static const char *map[] = + { "January", "February", "March", "April", + "May", "June", "July", "August", + "September", "October", "November", "December" }; + return map[month%12]; +} + +const char *day_to_st(wday_t day) +{ + static const char *map[] = + { "Su","Mo", "Tu", "We", "Th", "Fr", "Sa" }; + return map[day%7]; +} +const char *day_to_str(wday_t day) +{ + static const char *map[] = + { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; + return map[day%7]; +} +const char *day_to_string(wday_t day) +{ + static const char *map[] = + { "Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday" }; + return map[day%7]; +} + +/* Test functions */ +void test_time(void) +{ + printf("Info\n"); + printf(" Year Month Start Weeks Days\n"); + for (int y = 2012; y <= 2012; y++) + for (int m = JAN; m <= DEC; m++) { + printf(" %-5d", y); + printf(" %-10s", month_to_string(m)); + printf(" %-6s", day_to_str(start_of_month(y,m))); + printf(" %-6d", weeks_in_month(y,m)); + printf(" %-2d", days_in_month(y,m)); + printf("\n"); + } +} diff --git a/src/date.h b/src/date.h new file mode 100644 index 0000000..77f7341 --- /dev/null +++ b/src/date.h @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2012 Andy Spencer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/* Time types */ +typedef int year_t; +typedef int day_t; +typedef int hour_t; +typedef int min_t; + +typedef enum { + JAN = 0, + FEB = 1, + MAR = 2, + APR = 3, + MAY = 4, + JUN = 5, + JUL = 6, + AUG = 7, + SEP = 8, + OCT = 9, + NOV = 10, + DEC = 11, +} month_t; + +typedef enum { + SUN = 0, + MON = 1, + TUE = 2, + WED = 3, + THU = 4, + FRI = 5, + SAT = 6, +} wday_t; + +/* Global data */ +extern year_t YEAR; +extern month_t MONTH; +extern day_t DAY; + +/* Initialize */ +void date_init(void); + +/* Time functions */ +int is_leap_year(year_t year); +int days_in_year(year_t year); +int days_in_month(year_t year, month_t month); +int weeks_in_month(year_t year, month_t month); +wday_t day_of_week(year_t year, month_t month, day_t day); +wday_t start_of_month(year_t year, month_t month); +day_t start_of_week(year_t year, month_t month, day_t day); +void add_days(year_t *year, month_t *month, day_t *day, int days); +void add_months(year_t *year, month_t *month, int months); + +/* Time to string functions */ +const char *month_to_str(month_t month); +const char *month_to_string(month_t month); +const char *day_to_st(wday_t day); +const char *day_to_str(wday_t day); +const char *day_to_string(wday_t day); + +/* Tests */ +void test_time(void); diff --git a/src/event.c b/src/event.c index ed3a343..76d33ce 100644 --- a/src/event.c +++ b/src/event.c @@ -16,8 +16,24 @@ */ #include "util.h" +#include "date.h" #include "event.h" +/* Global data */ +event_t *EVENTS; + +/* Initialize */ +void event_init(void) +{ + EVENTS = event_get(2012, JAN, 0, 366); + + /* Debug */ + for (event_t *e = EVENTS; e; e = e->next) + debug("event: %04d-%02d-%02d %02d:%02d: %s - %s\n", + e->start.year, e->start.month, e->start.day, + e->start.hour, e->start.min, e->name, e->desc); +} + /* Event get */ event_t *event_get(year_t year, month_t month, day_t day, int days) { diff --git a/src/event.h b/src/event.h index 501741d..199e1dc 100644 --- a/src/event.h +++ b/src/event.h @@ -15,11 +15,6 @@ * along with this program. If not, see . */ -#ifndef EVENT_H -#define EVENT_H - -#include "util.h" - /* Calendar types */ typedef struct { char *name; @@ -45,10 +40,12 @@ typedef struct event_t { struct event_t *next; } event_t; +/* Global data */ +extern event_t *EVENTS; + /* Event functions */ +void event_init(void); event_t *event_get(year_t year, month_t month, day_t day, int days); /* Calendar implementation functions */ event_t *dummy_get(cal_t *cal, year_t year, month_t month, day_t day, int days); - -#endif diff --git a/src/main.c b/src/main.c index 6daa8f8..4be8750 100644 --- a/src/main.c +++ b/src/main.c @@ -15,26 +15,16 @@ * along with this program. If not, see . */ -#include #include #include -#include #include #include -#include "main.h" +#include "util.h" +#include "date.h" +#include "event.h" #include "screen.h" -/* Debugging */ -year_t YEAR = 2012; -month_t MONTH = 8; -day_t DAY = 29; - -event_t *EVENTS = NULL; - -/* Static data */ -static FILE *debug_fd = NULL; - /* Control-C handler, so we don't hose the therminal */ static void on_sigint(int signum) { @@ -42,47 +32,13 @@ static void on_sigint(int signum) exit(0); } -/* Debugging functions */ -int debug(char *fmt, ...) -{ - int rval; - va_list ap; - - /* Log to debug file */ - va_start(ap, fmt); - vfprintf(debug_fd, "debug: ", ap); - rval = vfprintf(debug_fd, fmt, ap); - - /* Log to status bar */ - va_start(ap, fmt); - mvhline(LINES-2, 0, ACS_HLINE, COLS); - move(LINES-1, 0); - attron(COLOR_PAIR(COLOR_ERROR)); - vwprintw(stdscr, fmt, ap); - attroff(COLOR_PAIR(COLOR_ERROR)); - clrtoeol(); - - va_end(ap); - return rval; -} - /* Main */ int main(int argc, char **argv) { /* Misc setup */ signal(SIGINT, on_sigint); - debug_fd = fopen("/tmp/lackey.log", "w+"); - - /* Time setup */ - time_t sec = time(NULL); - struct tm *tm = localtime(&sec); - YEAR = tm->tm_year+1900; - MONTH = tm->tm_mon; - DAY = tm->tm_mday-1; - - EVENTS = event_get(2012, JAN, 0, 366); - /* Curses setup */ + /* Setup Curses */ setlocale(LC_ALL, ""); initscr(); cbreak(); @@ -93,14 +49,15 @@ int main(int argc, char **argv) mousemask(ALL_MOUSE_EVENTS, NULL); init_pair(COLOR_TITLE, COLOR_GREEN, COLOR_BLACK); init_pair(COLOR_ERROR, COLOR_RED, COLOR_BLACK); + + /* Initialize */ + util_init(); + date_init(); + event_init(); screen_init(); - screen_draw(); - /* Debug */ - for (event_t *e = EVENTS; e; e = e->next) - debug("event: %04d-%02d-%02d %02d:%02d: %s - %s\n", - e->start.year, e->start.month, e->start.day, - e->start.hour, e->start.min, e->name, e->desc); + /* Draw initial screen */ + screen_draw(); /* Run */ while (1) { @@ -128,8 +85,8 @@ int main(int argc, char **argv) } if (screen_run(chr, btn.bstate, btn.y, btn.x)) continue; - //debug("Unhandled key: Dec %3d, Hex %02x, Oct %03o, Chr <%c>\n", - // chr, chr, chr, chr); + debug("main: Unhandled key - Dec %3d, Hex %02x, Oct %03o, Chr <%c>\n", + chr, chr, chr, chr); } /* Cleanup, see also on_sigint */ diff --git a/src/main.h b/src/main.h deleted file mode 100644 index cdc5c82..0000000 --- a/src/main.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2012 Andy Spencer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef MAIN_H -#define MAIN_H - -#define COLOR_TITLE 1 -#define COLOR_ERROR 2 - -#include "util.h" -#include "event.h" - -/* Debugging */ -extern year_t YEAR; -extern month_t MONTH; -extern day_t DAY; - -extern event_t *EVENTS; - -/* Debug functions */ -int debug(char *fmt, ...); - -#endif diff --git a/src/screen.c b/src/screen.c index c1c655a..1618f10 100644 --- a/src/screen.c +++ b/src/screen.c @@ -17,9 +17,10 @@ #include #include -#include "main.h" -#include "screen.h" + #include "util.h" +#include "date.h" +#include "screen.h" /* Types */ typedef struct { diff --git a/src/screen.h b/src/screen.h index f5b8671..bce2383 100644 --- a/src/screen.h +++ b/src/screen.h @@ -15,8 +15,9 @@ * along with this program. If not, see . */ -#ifndef SCREEN_H -#define SCREEN_H +/* Configuration */ +#define COLOR_TITLE 1 +#define COLOR_ERROR 2 /* Screen functions */ void screen_init(void); @@ -53,5 +54,3 @@ int todo_run(int,mmask_t,int,int); int notes_run(int,mmask_t,int,int); int settings_run(int,mmask_t,int,int); int help_run(int,mmask_t,int,int); - -#endif diff --git a/src/test.c b/src/test.c index 86eb8c5..9255c94 100644 --- a/src/test.c +++ b/src/test.c @@ -15,11 +15,7 @@ * along with this program. If not, see . */ -#include "util.h" - -int YEAR = 2012; -int MONTH = 8; -int DAY = 29; +#include "date.h" int main(int argc, char **argv) { diff --git a/src/util.c b/src/util.c index e40fa8e..53f5cef 100644 --- a/src/util.c +++ b/src/util.c @@ -15,130 +15,44 @@ * along with this program. If not, see . */ -/* Time Keeping Bugs Abound! */ - #include -#include +#include -#include "util.h" +#include "screen.h" -/* Time functions */ -int is_leap_year(year_t year) -{ - return (year % 400 == 0) ? 1 : - (year % 100 == 0) ? 0 : - (year % 4 == 0) ? 1 : 0; -} +/* Static data */ +static FILE *debug_fd = NULL; -int days_in_year(year_t year) +/* Initialize */ +void util_init(void) { - return 365 + is_leap_year(year); + debug_fd = fopen("/tmp/lackey.log", "w+"); } -int days_in_month(year_t year, month_t month) +/* Debugging functions */ +int debug(char *fmt, ...) { - static int mdays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; - int days = mdays[month]; - if (month == FEB) - days += is_leap_year(year); - return days; -} + int rval; + va_list ap; -int weeks_in_month(year_t year, month_t month) -{ - int start = start_of_month(year, month); - int days = days_in_month(year, month); - return ((start + days)-1) / 7 + 1; -} - -wday_t day_of_week(year_t year, month_t month, day_t day) -{ - static int tmp[] = {0, 3, 2, 5, 0, 3, - 5, 1, 4, 6, 2, 4}; - if (month < MAR) - year--; - int start = year + year / 4 - - year / 100 - + year / 400 - + tmp[month]; - return (start + day + 1) % 7; -} - -wday_t start_of_month(year_t year, month_t month) -{ - return day_of_week(year, month, 0); -} - -void add_days(year_t *year, month_t *month, day_t *day, int days) -{ - time_t time = mktime(&(struct tm){ - .tm_year = *year-1900, - .tm_mon = *month, - .tm_mday = *day+1, - .tm_hour = 12}); - time += days*24*60*60; - struct tm *tm = localtime(&time); - *year = tm->tm_year+1900; - *month = tm->tm_mon; - *day = tm->tm_mday-1; -} - -void add_months(year_t *year, month_t *month, int months) -{ - int total = *year*12 + *month + months; - *year = total / 12; - *month = total % 12; -} - -/* Debug functions */ -const char *month_to_str(month_t month) -{ - static const char *map[] = - { "Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", }; - return map[month%12]; -} -const char *month_to_string(month_t month) -{ - static const char *map[] = - { "January", "February", "March", "April", - "May", "June", "July", "August", - "September", "October", "November", "December" }; - return map[month%12]; -} - -const char *day_to_st(wday_t day) -{ - static const char *map[] = - { "Su","Mo", "Tu", "We", "Th", "Fr", "Sa" }; - return map[day%7]; -} -const char *day_to_str(wday_t day) -{ - static const char *map[] = - { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; - return map[day%7]; -} -const char *day_to_string(wday_t day) -{ - static const char *map[] = - { "Sunday", "Monday", "Tuesday", "Wednesday", - "Thursday", "Friday", "Saturday" }; - return map[day%7]; -} + /* Log to debug file */ + if (debug_fd) { + va_start(ap, fmt); + vfprintf(debug_fd, "debug: ", ap); + rval = vfprintf(debug_fd, fmt, ap); + } -/* Test functions */ -void test_time(void) -{ - printf("Info\n"); - printf(" Year Month Start Weeks Days\n"); - for (int y = 2012; y <= 2012; y++) - for (int m = JAN; m <= DEC; m++) { - printf(" %-5d", y); - printf(" %-10s", month_to_string(m)); - printf(" %-6s", day_to_str(start_of_month(y,m))); - printf(" %-6d", weeks_in_month(y,m)); - printf(" %-2d", days_in_month(y,m)); - printf("\n"); + /* Log to status bar */ + if (stdscr) { + va_start(ap, fmt); + mvhline(LINES-2, 0, ACS_HLINE, COLS); + move(LINES-1, 0); + attron(COLOR_PAIR(COLOR_ERROR)); + vwprintw(stdscr, fmt, ap); + attroff(COLOR_PAIR(COLOR_ERROR)); + clrtoeol(); } + + va_end(ap); + return rval; } diff --git a/src/util.h b/src/util.h index 9b27551..98fb332 100644 --- a/src/util.h +++ b/src/util.h @@ -15,65 +15,18 @@ * along with this program. If not, see . */ -#ifndef UTIL_H -#define UTIL_H - /* Macros */ #define MIN(a,b) ((a) < (b) ? (a) : (b)) #define MAX(a,b) ((a) > (b) ? (a) : (b)) #define ROUND(x) ((int)((x)+0.5)) #define N_ELEMENTS(x) (sizeof(x)/sizeof((x)[0])) -/* Time types */ -typedef int year_t; -typedef int day_t; -typedef int hour_t; -typedef int min_t; - -typedef enum { - JAN = 0, - FEB = 1, - MAR = 2, - APR = 3, - MAY = 4, - JUN = 5, - JUL = 6, - AUG = 7, - SEP = 8, - OCT = 9, - NOV = 10, - DEC = 11, -} month_t; - -typedef enum { - SUN = 0, - MON = 1, - TUE = 2, - WED = 3, - THU = 4, - FRI = 5, - SAT = 6, -} wday_t; - -/* Time functions */ -int is_leap_year(year_t year); -int days_in_year(year_t year); -int days_in_month(year_t year, month_t month); -int weeks_in_month(year_t year, month_t month); -wday_t day_of_week(year_t year, month_t month, day_t day); -wday_t start_of_month(year_t year, month_t month); -day_t start_of_week(year_t year, month_t month, day_t day); -void add_days(year_t *year, month_t *month, day_t *day, int days); -void add_months(year_t *year, month_t *month, int months); - -/* Time to string functions */ -const char *month_to_str(month_t month); -const char *month_to_string(month_t month); -const char *day_to_st(wday_t day); -const char *day_to_str(wday_t day); -const char *day_to_string(wday_t day); - -/* Tests */ -void test_time(void); +/* Debug functions */ +void util_init(void); +/* Debug functions */ +#ifdef DEBUG +int debug(char *fmt, ...); +#else +#define debug(...) #endif diff --git a/view/day.c b/view/day.c index 5d20672..7761c95 100644 --- a/view/day.c +++ b/view/day.c @@ -15,11 +15,9 @@ * along with this program. If not, see . */ -#include #include -#include "main.h" -#include "util.h" +#include "date.h" /* Static data */ static WINDOW *win; diff --git a/view/month.c b/view/month.c index 60f6b60..5642c6d 100644 --- a/view/month.c +++ b/view/month.c @@ -20,8 +20,8 @@ #include #include -#include "main.h" #include "util.h" +#include "date.h" /* Static data */ static WINDOW *win; diff --git a/view/week.c b/view/week.c index 40d5b08..230a7c5 100644 --- a/view/week.c +++ b/view/week.c @@ -17,11 +17,11 @@ #define _XOPEN_SOURCE_EXTENDED -#include #include -#include "main.h" #include "util.h" +#include "date.h" +#include "event.h" /* Static data */ static WINDOW *win; @@ -33,7 +33,8 @@ static void print_event(event_t *event, wday_t day, hour_t hour, min_t min, floa int y = 3+hour*4; int l = (event->end.min - event->start.min)/15; mvwprintw(win, y, x, "%s", event->name); - debug("event: %s\n", event->name); + debug("week: event = %s\n", event->name); + (void)l; } static int before(datetime_t *start, int year, int month, int day, int hour, int min) @@ -43,7 +44,7 @@ static int before(datetime_t *start, int year, int month, int day, int hour, int start->day < day ? 1 : start->day > day ? 0 : start->hour < hour ? 1 : start->hour > hour ? 0 : start->min < min ? 1 : start->min > min ? 0 : 0; - debug("%04d-%02d-%02d %02d:%02d < %04d-%02d-%02d %02d:%02d == %d\n", + debug("week: %04d-%02d-%02d %02d:%02d < %04d-%02d-%02d %02d:%02d == %d\n", start->year, start->month, start->day, start->hour, start->min, year, month, day, hour, min, rval); return rval; diff --git a/view/year.c b/view/year.c index 16522c8..04beba6 100644 --- a/view/year.c +++ b/view/year.c @@ -18,8 +18,8 @@ #include #include -#include "main.h" #include "util.h" +#include "date.h" /* Constants */ #define MW (2*7+6) -- 2.43.2