summaryrefslogtreecommitdiffstats
path: root/src/c_init.c
diff options
context:
space:
mode:
authorsalad <fmoenne-@student.le-101.fr>2020-09-14 15:59:30 +0200
committersalad <fmoenne-@student.le-101.fr>2020-09-14 15:59:30 +0200
commitb6806c73f4ae94dd76ad7a51ad25255b3493e9c9 (patch)
tree6d5d530cdd8b282caff2436651697d273e0f315e /src/c_init.c
parentgrep TODO c_utils.c (diff)
download42-minishell-b6806c73f4ae94dd76ad7a51ad25255b3493e9c9.tar.gz
42-minishell-b6806c73f4ae94dd76ad7a51ad25255b3493e9c9.tar.bz2
42-minishell-b6806c73f4ae94dd76ad7a51ad25255b3493e9c9.tar.xz
42-minishell-b6806c73f4ae94dd76ad7a51ad25255b3493e9c9.tar.zst
42-minishell-b6806c73f4ae94dd76ad7a51ad25255b3493e9c9.zip
quelques additions
Diffstat (limited to '')
-rw-r--r--src/c_init.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/c_init.c b/src/c_init.c
index ee6782d..2bc0be3 100644
--- a/src/c_init.c
+++ b/src/c_init.c
@@ -10,12 +10,12 @@
/* */
/* ************************************************************************** */
-
#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"
@@ -71,15 +71,17 @@ int16_t
i = -1;
if (line == NULL)
- if (!(line = ft_calloc(2, sizeof(char))))
- return (0);
+ {
+ if (!(line = ft_calloc(1, sizeof(char))))
+ return (-1);
+ }
if (ft_isprint(buf[0]))
{
if (tcaps->cpos == ft_strlen(line))
line = ft_strjoin(line, buf);
else
line = c_insert_char(line, buf[0], tcaps);
- c_redraw_line(line, tcaps->cpos, msh);
+ c_redraw_line(line, tcaps, msh);
tcaps->cpos++;
}
else
@@ -116,6 +118,8 @@ int16_t
{
return (c_new_line(buf, &line, msh, tcaps));
}
+ else
+ return (0);
}
return (0);
}