summaryrefslogtreecommitdiffstats
path: root/src/c_init.c
diff options
context:
space:
mode:
authorsalad <fmoenne-@student.le-101.fr>2020-09-17 17:27:13 +0200
committersalad <fmoenne-@student.le-101.fr>2020-09-17 17:27:13 +0200
commita223de42f7a9a81972d9cd14a46f34e4c5ab617e (patch)
tree5e681007a68a55e5ad7561a938192235ca171f01 /src/c_init.c
parentmultiligne prototype et plus de leaks (diff)
download42-minishell-a223de42f7a9a81972d9cd14a46f34e4c5ab617e.tar.gz
42-minishell-a223de42f7a9a81972d9cd14a46f34e4c5ab617e.tar.bz2
42-minishell-a223de42f7a9a81972d9cd14a46f34e4c5ab617e.tar.xz
42-minishell-a223de42f7a9a81972d9cd14a46f34e4c5ab617e.tar.zst
42-minishell-a223de42f7a9a81972d9cd14a46f34e4c5ab617e.zip
norm, new file, ctrl + c
Diffstat (limited to 'src/c_init.c')
-rw-r--r--src/c_init.c34
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);