7 #define MAX_TODO_LENGTH 200
9 void winch_handler(int sig);
11 char* read_todo(FILE* file);
13 WINDOW* create_list_win(int height, int width, int y, int x);
18 main(int argc, char** argv)
27 signal(SIGWINCH, winch_handler);
29 // read command line args
30 flag = getopt(argc, argv, "o:n:");
34 // read from task file (might need to check for read and write permissions)
35 board_file = fopen(optarg, "r");
37 printf("%s does not exist\n", optarg);
41 char* lineptr = read_todo(board_file);
42 printf("lineptr: %p\n", lineptr);
43 printf("first: %c\n", *lineptr);
51 // make sure file does not exist
52 // however, it maybe be possible that an different error has occured (besides the file not existing)
53 if (access(optarg, F_OK) == 0) {
54 printf("%s already exists\n", optarg);
58 printf("Successfully created %s\n", optarg);
63 printf("Help string\n");
78 init_pair(1, COLOR_CYAN, COLOR_BLACK);
79 init_pair(2, COLOR_BLACK, COLOR_CYAN);
81 getmaxyx(stdscr, height, width);
85 todo_win = create_list_win(20, 20, 5, 5);
88 while ((ch = getch()) != 113) { // while not q
90 // ofc the first thing we need is vim keys
116 winch_handler(int sig)
124 read_todo(FILE* file)
125 { // apparently getline isn't rly that portable, so consider other options
133 while ((nread = getline(&lineptr, &len, file)) != -1) {
134 printf("Read line of size %zd\n", nread);
141 create_list_win(int height, int width, int y, int x)
143 WINDOW* new_win = newwin(height, width, y, x);