summaryrefslogtreecommitdiffstats
path: root/src/c_init.c
diff options
context:
space:
mode:
authorsalad <fmoenne-@student.le-101.fr>2020-10-23 18:50:31 +0200
committersalad <fmoenne-@student.le-101.fr>2020-10-23 18:50:31 +0200
commit56a96bd9313cd2df8714f2427437fbc2f6d6da7c (patch)
tree841e53e4e02671b41eb0bdf06baf6a2f178d4ec2 /src/c_init.c
parentloadsamoney (diff)
download42-minishell-56a96bd9313cd2df8714f2427437fbc2f6d6da7c.tar.gz
42-minishell-56a96bd9313cd2df8714f2427437fbc2f6d6da7c.tar.bz2
42-minishell-56a96bd9313cd2df8714f2427437fbc2f6d6da7c.tar.xz
42-minishell-56a96bd9313cd2df8714f2427437fbc2f6d6da7c.tar.zst
42-minishell-56a96bd9313cd2df8714f2427437fbc2f6d6da7c.zip
qweqwe
Diffstat (limited to '')
-rw-r--r--src/c_init.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/c_init.c b/src/c_init.c
index 7ea11ac..2718ac8 100644
--- a/src/c_init.c
+++ b/src/c_init.c
@@ -81,6 +81,11 @@ static int16_t
return (c_end_key(ft_strlen(line), plen, tcaps));
else if ((*((unsigned int *)buf)) == CTRL_L)
return (c_ctrl_l(line, tcaps, msh));
+ else if ((*((unsigned int *)buf)) == CTRL_C)
+ {
+ msh->ret = 130;
+ return (1);
+ }
else
return (0);
}
@@ -108,7 +113,10 @@ static char
c_redraw_line(line, tcaps, msh);
}
else
- c_read_cap(buf, line, tcaps, msh);
+ if (c_read_cap(buf, line, tcaps, msh) == 130)
+ {
+ return (c_new_line(ft_strdup("\n"), tcaps));
+ }
if (buf[0] == '\n')
return (c_new_line(line, tcaps));
return (NULL);
@@ -133,6 +141,11 @@ int16_t
return (-1);
while (!(ft_strchr(nread, '\n')))
{
+ if (msh->ret == 130)
+ {
+ *line = ft_strdup("\0");
+ return (1);
+ }
ft_bzero(nread, 5);
if (!(read(fd, nread, 4)))
return (0);