diff options
-rw-r--r-- | src/c_ctrls.c | 3 | ||||
-rw-r--r-- | src/c_ctrls.h | 2 | ||||
-rw-r--r-- | src/c_init.c | 4 | ||||
-rw-r--r-- | src/c_init.h | 2 | ||||
-rw-r--r-- | src/c_input.h | 4 |
5 files changed, 8 insertions, 7 deletions
diff --git a/src/c_ctrls.c b/src/c_ctrls.c index af0528e..485fb94 100644 --- a/src/c_ctrls.c +++ b/src/c_ctrls.c @@ -24,11 +24,12 @@ #include "s_destroy.h" #include "u_utils.h" -short c_ctrl_d(t_msh *msh) +short c_ctrl_d(char *line, t_msh *msh) { int tmp; c_set_term_raw(0); + free(line); write(STDERR_FILENO, "exit\n", 5); u_eof_fd(msh->fd); m_dump_hist(msh->curr_hist_ptr, msh); diff --git a/src/c_ctrls.h b/src/c_ctrls.h index 337a6f5..714f26b 100644 --- a/src/c_ctrls.h +++ b/src/c_ctrls.h @@ -19,7 +19,7 @@ void c_signal_int(int signo); void c_signal_ign(int signo); short c_ctrl_l(char *line, t_caps *tcaps, t_msh *msh); -short c_ctrl_d(t_msh *msh); +short c_ctrl_d(char *line, t_msh *msh); char *c_ctrl_c(char **line, char *buf, t_msh *msh); #endif diff --git a/src/c_init.c b/src/c_init.c index cea3cce..c5c2dea 100644 --- a/src/c_init.c +++ b/src/c_init.c @@ -72,7 +72,7 @@ static short return (c_ctrl_l(line, tcaps, msh)); else if ((*((unsigned int *)buf)) == CTRL_D && line[0] == '\0') - return (c_ctrl_d(msh)); + return (c_ctrl_d(line, msh)); return (0); } @@ -125,7 +125,7 @@ char static char *c_process_key(char **line, char *buf, t_caps *tcaps, t_msh *msh) { - if (ft_isprint(buf[0])) + if (ft_isprint(buf[0]) && *line != NULL) c_add_char(line, buf, tcaps); else if (((*((unsigned int *)buf)) == UP_K) || ((*((unsigned int *)buf)) == CTRL_P) || diff --git a/src/c_init.h b/src/c_init.h index a9e7605..ea58317 100644 --- a/src/c_init.h +++ b/src/c_init.h @@ -47,7 +47,7 @@ typedef struct s_caps unsigned int nlines; unsigned short psx; unsigned short plen; - short key; + short key; } t_caps; char *c_set_ptr(t_bool reset, char key, t_msh *msh); diff --git a/src/c_input.h b/src/c_input.h index cd582eb..2d33281 100644 --- a/src/c_input.h +++ b/src/c_input.h @@ -13,8 +13,8 @@ #ifndef C_INPUT_H # define C_INPUT_H -#include "c_init.h" -#include "s_struct.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, |