summaryrefslogtreecommitdiffstats
path: root/src/c_init.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/c_init.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/c_init.c b/src/c_init.c
index d78a8f2..d50daf4 100644
--- a/src/c_init.c
+++ b/src/c_init.c
@@ -91,9 +91,11 @@ char
int i;
i = -1;
- if (line == NULL)
+ if (line == NULL || line[0] == '\0')
+ {
if (!(line = ft_calloc(1, sizeof(char))))
return (NULL);
+ }
if (ft_isprint(buf[0]))
{
line = c_insert_char(line, buf[0], tcaps);
@@ -104,11 +106,15 @@ char
{
c_back_slash(&line, ft_strlen(msh->ps[0]), tcaps);
}
+ else if (buf[0] == '\n')
+ {
+ return (c_new_line(line, tcaps, msh));
+ }
else
{
c_read_cap(buf, line, tcaps, msh);
}
- return (ft_strdup(line));
+ return (line);
}
int16_t
@@ -128,7 +134,7 @@ int16_t
tputs(tgetstr("cr", NULL), 1, ft_putchar);
m_prompt_psx(1, msh);
signal(SIGINT, SIG_IGN);
- ft_bzero(nread, 5);
+ ft_bzero(nread, 5);
if (!(c_get_win_size(&tcaps.ws)))
return (-1);
while (!(ft_strchr(nread, '\n')))
@@ -138,11 +144,6 @@ int16_t
return (0);
else
*line = c_process_key(nread, &tcaps, msh);
- if (*line == NULL)
- {
- ft_printf("FUCK");
- return (0);
- }
tputs(tgetstr("ve", NULL), 1, ft_putchar);
}
return (1);