From: Daniel Liu Date: Sat, 12 Dec 2020 04:50:27 +0000 (-0500) Subject: file reading and config X-Git-Url: https://git.danieliu.xyz/?a=commitdiff_plain;h=1de5e2eefa511626bc6dbbff4bc3ad098237989a;p=taskasaur.git file reading and config --- 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;