summaryrefslogtreecommitdiffstats
path: root/src/c_init.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/c_init.c')
-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);
}