int run_clt(t_env *e) { char *msg; size_t lmsg; size_t alloc_size; char **tab; msg = NULL; alloc_size = 0; while (42) { if (e->chan == NULL) print_prompt(e); if ((lmsg = getline(&msg, &alloc_size, stdin)) > 0) { (lmsg) ? (msg[lmsg - 1] = 0) : (msg[lmsg] = 0); tab = NULL; if ((tab = my_str_to_wordtab(msg))) { (tab[0][0] == '/') ? check_cmd(e, tab) : send_msg(e, msg); delete_tab(tab); } } } if (alloc_size) free(msg); return (EXIT_SUCCESS); }
void handle_destroy(XEvent * evt) { /* this is where we know an xterm has quit by say, ctrl-D*/ XDestroyWindowEvent * dwe = &(evt->xdestroywindow); if (delete_tab(dwe->window) == 0) exit(0); /* exit if no more tabs */ }
void preparation(t_map **map) { char **grid; grid = NULL; g_size = size_min_square(*map); init_grid(&grid); while (backtrack(grid, *map) != 0) create_grid(&grid); print_grid(grid); delete_tab(&grid); }