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** todos = read_todo(board_file);
49 // make sure file does not exist
50 // however, it maybe be possible that an different error has occured (besides the file not existing)
51 if (access(optarg, F_OK) == 0) {
52 printf("%s already exists\n", optarg);
56 printf("Successfully created %s\n", optarg);
61 printf("Help string\n");
76 init_pair(1, COLOR_CYAN, COLOR_BLACK);
77 init_pair(2, COLOR_BLACK, COLOR_CYAN);
79 getmaxyx(stdscr, height, width);
83 todo_win = create_list_win(20, 20, 5, 5);
86 while ((ch = getch()) != 113) { // while not q
88 // ofc the first thing we need is vim keys
114 winch_handler(int sig)
122 read_todo(FILE* file)
123 { // apparently getline isn't rly that portable, so consider other options
135 while ((nread = getline(&lineptr, &len, file)) != -1) {
137 out_arr = realloc(out_arr, (sizeof(char*))*out_len); // bad to keep resizing?
138 printf("Pointer set to: %p\n", lineptr);
139 out_arr[out_len-1] = lineptr;
149 create_list_win(int height, int width, int y, int x)
151 WINDOW* new_win = newwin(height, width, y, x);