int ft_read(t_env **env, t_data *environ) { t_hist *hst; t_edit *lst_e; char *key; hst = NULL; lst_e = NULL; key = (char *)malloc(sizeof(char) * 7); ft_bzero(key, 7); if (ft_sigleton(0) != 3) begin_read(&hst, &lst_e, environ); while (!ENTER && ft_sigleton(0) != 3) { if (in_while(&key, env, &hst, &lst_e) == -1) { free(key); return (-2); } } if (after_while(env, environ, &lst_e, &hst) == 1) { free(key); return (0); } return (0); }
char *ft_read_htdoc(t_env **env, t_data *environ) { char *str; t_hist *hst; t_edit *lst_e; char *key; hst = NULL; lst_e = NULL; key = (char *)malloc(sizeof(char) * 7); ft_bzero(key, 7); begin_read(&hst, &lst_e, environ); while (!ENTER && ft_sigleton(0) != 3) { if (in_while(&key, &environ, &hst, &lst_e) == -1) { free(key); return (NULL); } } if ((str = after_while(env, environ, &lst_e, &hst))) { free(key); return (str); } return (NULL); }
char *take_cmd(int choice) { char *result; char *buffer; struct termios term; init_flag(&term); buffer = (char *)ft_memalloc(sizeof(char) * 3); result = in_while(buffer, choice); ft_putstr("\n"); ft_free(buffer); show_autocomplete(NULL, 0); re_flag(&term); return (result); }