summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--src/c_init.c2
-rw-r--r--src/c_input.c7
-rw-r--r--src/c_input.h5
-rw-r--r--src/c_keys.c4
-rw-r--r--src/c_utils.c13
6 files changed, 20 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index fb85687..550ae5a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-default: all
+default: debug
#==============================================================================#
#--------------------------------- SHELL --------------------------------------#
#==============================================================================#
diff --git a/src/c_init.c b/src/c_init.c
index 5ba6a67..1d2f588 100644
--- a/src/c_init.c
+++ b/src/c_init.c
@@ -209,7 +209,7 @@ short
t_caps tcaps;
char nread[4];
- c_init_line(psx, &tcaps);
+ c_init_line(psx, &tcaps, msh);
tputs(tgetstr("cr", NULL), 1, ft_putchar);
m_prompt_psx(psx, msh);
ft_bzero(nread, 4);
diff --git a/src/c_input.c b/src/c_input.c
index 9023f37..874d55a 100644
--- a/src/c_input.c
+++ b/src/c_input.c
@@ -22,15 +22,16 @@
#include "c_utils.h"
#include "m_prompt.h"
#include "m_loop.h"
+#include "u_vars.h"
short
- c_init_line(char psx, t_caps *tcaps)
+ c_init_line(char psx, t_caps *tcaps, t_msh *msh)
{
- char *term;
+ char term[4096];
if (tcaps)
{
- term = getenv("TERM");
+ u_get_var_value(term, "$TERM", 4096, msh);
if (!tgetent(NULL, term))
return (-1);
c_set_term_raw(1);
diff --git a/src/c_input.h b/src/c_input.h
index f2ccba8..cd582eb 100644
--- a/src/c_input.h
+++ b/src/c_input.h
@@ -13,10 +13,13 @@
#ifndef C_INPUT_H
# define C_INPUT_H
+#include "c_init.h"
+#include "s_struct.h"
+
short c_back_slash(char **line, unsigned int plen, t_caps *tcaps);
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);
+short c_init_line(char psx, t_caps *tcaps, t_msh *msh);
unsigned short c_get_win_size(struct winsize *ws);
#endif
diff --git a/src/c_keys.c b/src/c_keys.c
index 3d80327..f0e67fd 100644
--- a/src/c_keys.c
+++ b/src/c_keys.c
@@ -48,8 +48,8 @@ short
short
c_end_key(unsigned short size, unsigned int plen, t_caps *tcaps)
{
- unsigned short i;
- unsigned short j;
+ unsigned short i;
+ unsigned short j;
i = tcaps->cpos;
j = tcaps->lpos;
diff --git a/src/c_utils.c b/src/c_utils.c
index a25a35a..95ad28d 100644
--- a/src/c_utils.c
+++ b/src/c_utils.c
@@ -70,8 +70,8 @@ char
j++;
}
}
- ft_memdel((void**)&str);
- return (dst);
+ ft_memdel((void*)&str);
+return (dst);
}
char
@@ -134,6 +134,7 @@ short
{
unsigned int i;
unsigned int j;
+ size_t len;
(void)msh;
tcaps->nlines = c_get_line_num(line, tcaps->cpos,
@@ -150,7 +151,9 @@ short
while (i++ < tcaps->plen)
tputs(tgetstr("nd", NULL), 1, ft_putchar);
ft_printf("%s", line);
- return ((tcaps->cpos != ft_strlen(line)) ?
- c_redraw_next(tcaps->plen, ft_strlen(line), tcaps) :
- ft_strlen(line));
+ len = ft_strlen(line);
+ /* ft_memdel((void*)&line); */
+ return ((tcaps->cpos != len) ?
+ c_redraw_next(tcaps->plen, len, tcaps) :
+ len);
}