7 void winch_handler(int sig);
9 char** read_todo(FILE* file);
11 WINDOW* create_list_win(int height, int width, int y, int x);
16 main(int argc, char** argv)
25 signal(SIGWINCH, winch_handler);
27 // read command line args
28 flag = getopt(argc, argv, "o:n:");
32 // read from task file (might need to check for read and write permissions)
33 board_file = fopen(optarg, "r");
35 printf("%s does not exist\n", optarg);
39 char** todos = read_todo(board_file);
47 // make sure file does not exist
48 // however, it maybe be possible that an different error has occured (besides the file not existing)
49 if (access(optarg, F_OK) == 0) {
50 printf("%s already exists\n", optarg);
54 printf("Successfully created %s\n", optarg);
59 printf("Help string\n");
74 init_pair(1, COLOR_CYAN, COLOR_BLACK);
75 init_pair(2, COLOR_BLACK, COLOR_CYAN);
77 getmaxyx(stdscr, height, width);
81 todo_win = create_list_win(20, 20, 5, 5);
84 while ((ch = getch()) != 113) { // while not q
86 // ofc the first thing we need is vim keys
112 winch_handler(int sig)
120 read_todo(FILE* file)
121 { // apparently getline isn't rly that portable, so consider other options
133 while ((nread = getline(&lineptr, &len, file)) != -1) {
135 out_arr = realloc(out_arr, (sizeof(char*))*out_len); // bad to keep resizing?
136 printf("Pointer set to: %p\n", lineptr);
137 out_arr[out_len-1] = lineptr;
147 create_list_win(int height, int width, int y, int x)
149 WINDOW* new_win = newwin(height, width, y, x);