From 1de5e2eefa511626bc6dbbff4bc3ad098237989a Mon Sep 17 00:00:00 2001 From: Daniel Liu Date: Fri, 11 Dec 2020 23:50:27 -0500 Subject: [PATCH] file reading and config --- config.h | 6 ++++++ main.c | 15 +++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 config.h diff --git a/config.h b/config.h new file mode 100644 index 0000000..b3ec85d --- /dev/null +++ b/config.h @@ -0,0 +1,6 @@ + +static char font[] = "Source Code Pro:size=12"; + +static char default_board_file[] = "board.md"; + + diff --git a/main.c b/main.c index d57ec4d..83b5aa0 100644 --- a/main.c +++ b/main.c @@ -7,9 +7,12 @@ void winch_handler(int sig); WINDOW* create_list_win(int height, int width, int y, int x); +#include "config.h" + int main(int argc, char** argv) { + FILE* board_file; int height, width; int x, y; int ch; @@ -17,6 +20,14 @@ main(int argc, char** argv) signal(SIGWINCH, winch_handler); + // read from task file + board_file = fopen(default_board_file, "r"); + if (!board_file) { + printf("File does not exist\n"); + return 1; + } + fclose(board_file); + // start ncurses initscr(); cbreak(); @@ -34,9 +45,9 @@ main(int argc, char** argv) todo_win = create_list_win(20, 20, 5, 5); move(y,x); - while ((ch = getch()) != 113) { + while ((ch = getch()) != 113) { // while not q - //ofc the first thing we need is vim keys + // ofc the first thing we need is vim keys switch (ch) { case 104: // h x -= 1; -- 2.20.1