char *my_read(t_caps *caps) { if (raw_mode(caps) == -1) return (NULL); aff_cmd(caps); while (caps->buff[0] != '\n' && nll == 0) { memset(caps->buff, 0, 4); if (read(0, caps->buff, 4) <= 0) return (NULL); if (is_print_char(caps->buff[0])) { caps->cmd = put_char_str(caps->cmd, caps->buff[0], caps->cursor_pos++); aff_cmd(caps); } else buff_read_cmd(caps); if (caps->ok == 0) return (NULL); } if ((caps->cmd = strcatrealloc(caps->cmd, "\n", 1)) == NULL) return (NULL); if (tcsetattr(0, 0, &(caps->save)) == -1) return (NULL); if (caps->cmd != NULL) caps->hist = add_history(caps->hist, caps->cmd); return (caps->cmd); }
static void show_argument_completion(char **tab, char *str) { int i; i = 0; ft_putstr("\n"); while (tab[i]) { if (ft_strcmp(tab[i], ft_strjoin(str, "*"))) { aff_cmd(tab[i], str); ft_putstr("\n"); } ++i; } }
static t_bool bentor(t_shell *shell, int *i, char *c, char *buff) { if (complete_part(shell, buff, i, c) == FALSE) return (FALSE); if (g_sigint == 1) { bzero(buff, sizeof(char) * BUFF_SIZE); shell->history_on = FALSE; shell->com.on = FALSE; aff_prompt(shell); g_sigint = 0; return (FALSE); } process_keys(shell, i, c, buff); aff_cmd(shell, buff, i); return (TRUE); }