diff options
Diffstat (limited to 'src/c_init.c')
-rw-r--r-- | src/c_init.c | 34 |
1 files changed, 9 insertions, 25 deletions
diff --git a/src/c_init.c b/src/c_init.c index ac0c579..8870b27 100644 --- a/src/c_init.c +++ b/src/c_init.c @@ -11,15 +11,13 @@ /* ************************************************************************** */ #include <unistd.h> -#include <termios.h> #include <stdlib.h> -#include <string.h> #include <term.h> -#include <signal.h> #include <libft.h> #include "c_init.h" #include "c_input.h" +#include "c_keys.h" #include "c_utils.h" #include "s_struct.h" #include "m_prompt.h" @@ -83,34 +81,20 @@ int16_t } else { - if (strncmp(buf, tcaps->KL, 4) == 0) - { + if (ft_strncmp(buf, tcaps->KL, 4) == 0) return (c_key_left(ft_strlen(line), tcaps)); - } - else if (strncmp(buf, tcaps->KR, 4) == 0) - { + else if (ft_strncmp(buf, tcaps->KR, 4) == 0) return (c_key_right(ft_strlen(line), tcaps)); - } - else if (strncmp(buf, tcaps->HM, 4) == 0) - { + else if (ft_strncmp(buf, tcaps->HM, 4) == 0) return (c_home_key(tcaps)); - } - else if (strncmp(buf, tcaps->ND, 4) == 0) - { + else if (ft_strncmp(buf, tcaps->ND, 4) == 0) return (c_end_key(ft_strlen(line), tcaps)); - } - else if (strncmp(buf, tcaps->CC, 4) == 0) - { - return (c_new_line(NULL, msh, tcaps)); - } - else if (strncmp(buf, tcaps->CL, 4) == 0) - { + else if (ft_strncmp(buf, tcaps->CC, 4) == 0) + return (c_ctrl_c(NULL, tcaps, msh)); + else if (ft_strncmp(buf, tcaps->CL, 4) == 0) return (c_ctrl_l(line, tcaps, msh)); - } - else if (strncmp(buf, tgetstr("kb", NULL), ft_strlen(tgetstr("kb", NULL))) == 0) - { + else if (ft_strncmp(buf, tgetstr("kb", NULL), ft_strlen(tgetstr("kb", NULL))) == 0) return (c_back_slash(&line, tcaps)); - } else if (buf[0] == '\n') { c_new_line(ft_strdup(line), msh, tcaps); |