int main() { char *line; char **cmd; uneditedLine = (char*)malloc(256 * sizeof(char)); while (1) { my_setup(); my_prompt(); line = my_read(); strcpy(uneditedLine, line); if (line == 0) return 0; if (line[0] == '\0') { free(line); continue; } cmd = my_parse(line); my_execute(cmd); my_clean(line, cmd); } free(uneditedLine); return 0; }
int main() { t_list *newlist; t_listel *elem; struct termios term; elem = xmalloc(sizeof(*elem)); tcgetattr(0, &term); term.c_lflag &= ~ECHO; term.c_lflag &= ~ICANON; term.c_cc[VMIN] = 1; term.c_cc[VTIME] = 0; tcsetattr(0, TCSANOW, &term); my_clean(); newlist = initialisation(); open_file(newlist, "./"); afflistsel(newlist); fleches(term, &newlist, elem); return (0); }
void cleanprint(t_list **newlist, t_listel *elem) { my_clean(); listprint(newlist, elem); }