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.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/src/c_init.c b/src/c_init.c
index d50daf4..7296a2b 100644
--- a/src/c_init.c
+++ b/src/c_init.c
@@ -14,7 +14,6 @@
#include <stdlib.h>
#include <term.h>
#include <libft.h>
-#include <signal.h>
#include "c_init.h"
#include "c_input.h"
@@ -91,7 +90,7 @@ char
int i;
i = -1;
- if (line == NULL || line[0] == '\0')
+ if (line == NULL)
{
if (!(line = ft_calloc(1, sizeof(char))))
return (NULL);
@@ -103,23 +102,18 @@ char
tcaps->cpos++;
}
else if ((*((unsigned int *)buf)) == DEL_K)
- {
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 (line);
+ return (NULL);
}
int16_t
- c_init_tcaps(char **line,
- t_msh *msh)
+c_init_tcaps(int32_t fd,
+ char **line,
+ t_msh *msh)
{
t_caps tcaps;
char *term;
@@ -128,19 +122,17 @@ int16_t
term = getenv("TERM");
if (!tgetent(NULL, term))
return (-1);
- c_set_term_raw(1);
c_get_struct(1, &tcaps);
c_init_line(&tcaps);
tputs(tgetstr("cr", NULL), 1, ft_putchar);
m_prompt_psx(1, msh);
- signal(SIGINT, SIG_IGN);
ft_bzero(nread, 5);
if (!(c_get_win_size(&tcaps.ws)))
return (-1);
while (!(ft_strchr(nread, '\n')))
{
ft_bzero(nread, 5);
- if (!(read(STDIN_FILENO, nread, 4)))
+ if (!(read(fd, nread, 4)))
return (0);
else
*line = c_process_key(nread, &tcaps, msh);