From edb4aa1304435b17d62a7d925df2c95bdb854079 Mon Sep 17 00:00:00 2001
From: salad <fmoenne-@student.le-101.fr>
Date: Fri, 6 Nov 2020 22:21:04 +0100
Subject: static something

---
 src/c_init.c  | 8 +-------
 src/c_input.c | 8 ++++----
 src/c_input.h | 2 ++
 3 files changed, 7 insertions(+), 11 deletions(-)

(limited to 'src')

diff --git a/src/c_init.c b/src/c_init.c
index 314baad..bf3191f 100644
--- a/src/c_init.c
+++ b/src/c_init.c
@@ -24,8 +24,6 @@
 #include "s_struct.h"
 #include "m_prompt.h"
 
-t_msh *c_get_struct(int mode, t_msh *msh);
-
 short
 	c_set_term_raw(char mode)
 {
@@ -91,6 +89,7 @@ static char
 	static char	*line = NULL;
 	int			i;
 
+	c_get_struct(1, &msh);
 	i = -1;
 	if (line == NULL)
 		if (!(line = ft_calloc(1, sizeof(char))))
@@ -108,13 +107,9 @@ static char
 		c_redraw_line(line, tcaps, msh);
 	}
 	else if ((*((unsigned int *)buf)) == CTRL_C)
-	{
 		return (c_ctrl_c(&line, buf, msh));
-	}
 	else
-	{
 		c_read_cap(buf, line, tcaps, msh);
-	}
 	return ((buf[0] == '\n') ? c_new_line(line, tcaps) : NULL);
 }
 
@@ -129,7 +124,6 @@ short
 	m_prompt_psx(psx, msh);
 	ft_bzero(nread, 4);
 	tcaps.plen = (unsigned int)m_plen(msh->ps[psx - 1]);
-	c_get_struct(1, msh);
 	if (!(c_get_win_size(&tcaps.ws)))
 		return (-1);
 	while (!(ft_strchr(nread, '\n')))
diff --git a/src/c_input.c b/src/c_input.c
index 5e7e937..f26bbad 100644
--- a/src/c_input.c
+++ b/src/c_input.c
@@ -24,13 +24,13 @@
 #include "m_loop.h"
 
 t_msh
-	*c_get_struct(int mode, t_msh *msh)
+	*c_get_struct(int mode, t_msh **msh)
 {
 	static t_msh *mstruct = NULL;
 
 	if (mode)
 	{
-		mstruct = msh;
+		mstruct = *msh;
 	}
 	return (mstruct);
 }
@@ -42,9 +42,9 @@ void    c_signal_int(int signo)
 	msh = NULL;
 	signal(SIGINT, c_signal_int);
 	(void)signo;
-	msh = c_get_struct(0, msh);
+	msh = c_get_struct(0, &msh);
+	ft_printf("[%s]\n", msh->ps[0]);
 	msh->ret = 130;
-	write(1, "qwe", 3);
 	ioctl(1, TIOCSTI, "\002");
 }
 
diff --git a/src/c_input.h b/src/c_input.h
index f2ccba8..07c4e93 100644
--- a/src/c_input.h
+++ b/src/c_input.h
@@ -18,5 +18,7 @@ unsigned int	c_get_line_num(char *line, unsigned int cpos, unsigned int plen,
 				t_caps *tcaps);
 short			c_init_line(char psx, t_caps *tcaps);
 unsigned short	c_get_win_size(struct winsize *ws);
+t_msh			*c_get_struct(int mode, t_msh **msh);
+
 
 #endif
-- 
cgit v1.2.3