From 46f8585e463d1617bb120894afaec7f51cf85153 Mon Sep 17 00:00:00 2001 From: Salad Date: Fri, 4 Dec 2020 21:40:49 +0100 Subject: gnu c compiler compatible --- src/c_init.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/c_init.c') diff --git a/src/c_init.c b/src/c_init.c index 5ba6a67..7a1509c 100644 --- a/src/c_init.c +++ b/src/c_init.c @@ -163,10 +163,8 @@ static char *c_process_key(char *buf, t_caps *tcaps, t_msh *msh) { static char *line = NULL; - int i; char *ptr; - i = -1; if (line == NULL) if (!(line = ft_calloc(1, sizeof(char)))) return (NULL); -- cgit v1.2.3 From 3feb8a2f8b82a35df1f4c7e6f643bf8eaabb6f60 Mon Sep 17 00:00:00 2001 From: salad Date: Mon, 7 Dec 2020 15:36:45 +0100 Subject: WIP --- src/c_init.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/c_init.c') diff --git a/src/c_init.c b/src/c_init.c index 7a1509c..358f145 100644 --- a/src/c_init.c +++ b/src/c_init.c @@ -58,7 +58,7 @@ short } static void - c_add_char(char **line, char *buf, t_caps *tcaps, t_msh *msh) + c_add_char(char **line, char *buf, t_caps *tcaps) { *line = c_insert_char(*line, buf[0], tcaps); tcaps->cpos++; @@ -68,7 +68,7 @@ static void write(STDOUT_FILENO, "\n\r", 2); return ; } - c_redraw_line(*line, tcaps, msh); + c_redraw_line(*line, tcaps); } static short @@ -166,23 +166,26 @@ static char char *ptr; if (line == NULL) - if (!(line = ft_calloc(1, sizeof(char)))) + { + ft_printf("\r\nline is NULL\r\n"); + if (!(line = calloc(1, sizeof(char)))) return (NULL); + } if (ft_isprint(buf[0])) - c_add_char(&line, buf, tcaps, msh); + c_add_char(&line, buf, tcaps); else if (((*((unsigned int *)buf)) == UP_K) || ((*((unsigned int *)buf)) == CTRL_P)) { ptr = c_set_ptr(FALSE, -1, msh); c_key_up_down(&line, tcaps, ptr); - c_redraw_line(line, tcaps, msh); + c_redraw_line(line, tcaps); } else if (((*((unsigned int *)buf)) == DOWN_K) || ((*((unsigned int *)buf)) == CTRL_N)) { ptr = c_set_ptr(FALSE, 1, msh); c_key_up_down(&line, tcaps, ptr); - c_redraw_line(line, tcaps, msh); + c_redraw_line(line, tcaps); } else if ((*((unsigned int *)buf)) == DEL_K) { @@ -192,7 +195,7 @@ static char { return (NULL); } - c_redraw_line(line, tcaps, msh); + c_redraw_line(line, tcaps); } else if ((*((unsigned int *)buf)) == CTRL_C) return (c_ctrl_c(&line, buf, msh)); @@ -224,5 +227,6 @@ short *line = c_process_key(nread, &tcaps, msh); tputs(tgetstr("ve", NULL), 1, ft_putchar); } + ft_printf("[%s]\n", *line); return (1); } -- cgit v1.2.3 From cbde2aa474cc289cc6db127ebcedeb7e5502d7be Mon Sep 17 00:00:00 2001 From: salad Date: Tue, 15 Dec 2020 13:37:41 +0100 Subject: onto something --- src/c_init.c | 57 +++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 18 deletions(-) (limited to 'src/c_init.c') diff --git a/src/c_init.c b/src/c_init.c index 358f145..b1e9fb2 100644 --- a/src/c_init.c +++ b/src/c_init.c @@ -57,20 +57,6 @@ short return (1); } -static void - c_add_char(char **line, char *buf, t_caps *tcaps) -{ - *line = c_insert_char(*line, buf[0], tcaps); - tcaps->cpos++; - if ((((tcaps->cpos) + tcaps->plen) % - tcaps->ws.ws_col) == 0) - { - write(STDOUT_FILENO, "\n\r", 2); - return ; - } - c_redraw_line(*line, tcaps); -} - static short c_read_cap(char *buf, char *line, t_caps *tcaps, t_msh *msh) { @@ -159,15 +145,51 @@ char *c_set_ptr(t_bool reset, char key, t_msh *msh) return (p); } +static void + c_add_char(char **line, char *buf, t_caps *tcaps) +{ + int i; + size_t j; + size_t len; + char *dst; + + i = -1; + j = 0; + len = (ft_strlen(*line) + 2); + if (!(dst = (char*)malloc((len) * sizeof(char)))) + return ; + while (++i < (int)len) + { + if (i == (int)tcaps->cpos) + dst[i] = buf[0]; + else + { + dst[i] = line[0][j]; + j++; + } + } + dst[len - 1] = '\0'; + ft_memdel((void**)&line[0]); + *line = ft_strdup(dst); + ft_memdel((void**)&dst); + tcaps->cpos++; + if ((((tcaps->cpos) + tcaps->plen) % + tcaps->ws.ws_col) == 0) + { + write(STDOUT_FILENO, "\n\r", 2); + return ; + } + c_redraw_line(*line, tcaps); +} + static char - *c_process_key(char *buf, t_caps *tcaps, t_msh *msh) + *c_process_key(char **line, char *buf, t_caps *tcaps, t_msh *msh) { static char *line = NULL; char *ptr; - if (line == NULL) + if (line == NULL || line == (void*)0x1) { - ft_printf("\r\nline is NULL\r\n"); if (!(line = calloc(1, sizeof(char)))) return (NULL); } @@ -227,6 +249,5 @@ short *line = c_process_key(nread, &tcaps, msh); tputs(tgetstr("ve", NULL), 1, ft_putchar); } - ft_printf("[%s]\n", *line); return (1); } -- cgit v1.2.3 From 93f307f99188bdba8dc783abb8627d0abb5b871d Mon Sep 17 00:00:00 2001 From: salad Date: Tue, 15 Dec 2020 14:17:51 +0100 Subject: noleak ???????????????? --- src/c_init.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/c_init.c') diff --git a/src/c_init.c b/src/c_init.c index b1e9fb2..7fb530f 100644 --- a/src/c_init.c +++ b/src/c_init.c @@ -185,45 +185,44 @@ static void static char *c_process_key(char **line, char *buf, t_caps *tcaps, t_msh *msh) { - static char *line = NULL; char *ptr; - if (line == NULL || line == (void*)0x1) + if (*line == NULL) { - if (!(line = calloc(1, sizeof(char)))) + if (!(*line = calloc(1, sizeof(char)))) return (NULL); } if (ft_isprint(buf[0])) - c_add_char(&line, buf, tcaps); + c_add_char(line, buf, tcaps); else if (((*((unsigned int *)buf)) == UP_K) || ((*((unsigned int *)buf)) == CTRL_P)) { ptr = c_set_ptr(FALSE, -1, msh); - c_key_up_down(&line, tcaps, ptr); - c_redraw_line(line, tcaps); + c_key_up_down(line, tcaps, ptr); + c_redraw_line(*line, tcaps); } else if (((*((unsigned int *)buf)) == DOWN_K) || ((*((unsigned int *)buf)) == CTRL_N)) { ptr = c_set_ptr(FALSE, 1, msh); - c_key_up_down(&line, tcaps, ptr); - c_redraw_line(line, tcaps); + c_key_up_down(line, tcaps, ptr); + c_redraw_line(*line, tcaps); } else if ((*((unsigned int *)buf)) == DEL_K) { - c_back_slash(&line, tcaps->plen, tcaps); + c_back_slash(line, tcaps->plen, tcaps); if ((((tcaps->cpos) + tcaps->plen) % tcaps->ws.ws_col) == 0) { return (NULL); } - c_redraw_line(line, tcaps); + c_redraw_line(*line, tcaps); } else if ((*((unsigned int *)buf)) == CTRL_C) - return (c_ctrl_c(&line, buf, msh)); + 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); + c_read_cap(buf, *line, tcaps, msh); + return ((buf[0] == '\n') ? c_new_line(*line, tcaps) : NULL); } short @@ -238,6 +237,7 @@ short ft_bzero(nread, 4); msh->sig = 0; tcaps.plen = (unsigned int)m_plen(msh->ps[psx - 1]); + *line = NULL; if (!(c_get_win_size(&tcaps.ws))) return (-1); while (!(ft_strchr(nread, '\n'))) @@ -246,7 +246,7 @@ short if (!(read(fd, nread, 3))) return (0); else - *line = c_process_key(nread, &tcaps, msh); + c_process_key(line, nread, &tcaps, msh); tputs(tgetstr("ve", NULL), 1, ft_putchar); } return (1); -- cgit v1.2.3 From 2f2a2cf1d163762b9f10e0886fc1399f1bc896fa Mon Sep 17 00:00:00 2001 From: salad Date: Tue, 15 Dec 2020 16:35:22 +0100 Subject: start refactoring shit --- src/c_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/c_init.c') diff --git a/src/c_init.c b/src/c_init.c index 7fb530f..434f456 100644 --- a/src/c_init.c +++ b/src/c_init.c @@ -222,7 +222,7 @@ static char 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); + return ((buf[0] == '\n') ? c_new_line(tcaps) : NULL); } short -- cgit v1.2.3 From 45d3ad71ea69e18b27eb3fa202429e0b73a3826b Mon Sep 17 00:00:00 2001 From: salad Date: Tue, 15 Dec 2020 17:02:34 +0100 Subject: norm and fix ctrl_c to fit c_gnl rewrite --- src/c_init.c | 41 ----------------------------------------- 1 file changed, 41 deletions(-) (limited to 'src/c_init.c') diff --git a/src/c_init.c b/src/c_init.c index 434f456..93f6bb3 100644 --- a/src/c_init.c +++ b/src/c_init.c @@ -145,53 +145,14 @@ char *c_set_ptr(t_bool reset, char key, t_msh *msh) return (p); } -static void - c_add_char(char **line, char *buf, t_caps *tcaps) -{ - int i; - size_t j; - size_t len; - char *dst; - - i = -1; - j = 0; - len = (ft_strlen(*line) + 2); - if (!(dst = (char*)malloc((len) * sizeof(char)))) - return ; - while (++i < (int)len) - { - if (i == (int)tcaps->cpos) - dst[i] = buf[0]; - else - { - dst[i] = line[0][j]; - j++; - } - } - dst[len - 1] = '\0'; - ft_memdel((void**)&line[0]); - *line = ft_strdup(dst); - ft_memdel((void**)&dst); - tcaps->cpos++; - if ((((tcaps->cpos) + tcaps->plen) % - tcaps->ws.ws_col) == 0) - { - write(STDOUT_FILENO, "\n\r", 2); - return ; - } - c_redraw_line(*line, tcaps); -} - static char *c_process_key(char **line, char *buf, t_caps *tcaps, t_msh *msh) { char *ptr; if (*line == NULL) - { if (!(*line = calloc(1, sizeof(char)))) return (NULL); - } if (ft_isprint(buf[0])) c_add_char(line, buf, tcaps); else if (((*((unsigned int *)buf)) == UP_K) || @@ -213,9 +174,7 @@ static char c_back_slash(line, tcaps->plen, tcaps); if ((((tcaps->cpos) + tcaps->plen) % tcaps->ws.ws_col) == 0) - { return (NULL); - } c_redraw_line(*line, tcaps); } else if ((*((unsigned int *)buf)) == CTRL_C) -- cgit v1.2.3 From 658e858cee47e54b8e3023f50d4f972a9ac55f0f Mon Sep 17 00:00:00 2001 From: salad Date: Tue, 15 Dec 2020 17:15:58 +0100 Subject: norm tobecontinued --- src/c_init.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'src/c_init.c') diff --git a/src/c_init.c b/src/c_init.c index 93f6bb3..0994e5d 100644 --- a/src/c_init.c +++ b/src/c_init.c @@ -60,8 +60,6 @@ short static short c_read_cap(char *buf, char *line, t_caps *tcaps, t_msh *msh) { - int tmp; - if (((*((unsigned int *)buf)) == LEFT_K) || ((*((unsigned int *)buf)) == CTRL_B)) return (c_key_left(tcaps->plen, tcaps)); @@ -78,18 +76,8 @@ static short return (c_ctrl_l(line, tcaps, msh)); else if ((*((unsigned int *)buf)) == CTRL_D && line[0] == '\0') - { - c_set_term_raw(0); - write(STDERR_FILENO, "exit\n", 5); - u_eof_fd(msh->fd); - m_dump_hist(msh->curr_hist_ptr, msh); - tmp = msh->ret; - s_destroy(msh); - exit(tmp); - return (0); - } - else - return (0); + return (c_ctrl_d(msh)); + return (0); } char *ft_strrbavchr(const char *s, int c, size_t start) @@ -145,6 +133,8 @@ char *c_set_ptr(t_bool reset, char key, t_msh *msh) return (p); } +/* TODO : key_up_down should manage and set the correct key */ + static char *c_process_key(char **line, char *buf, t_caps *tcaps, t_msh *msh) { -- cgit v1.2.3 From 9ae8f935e955a9cc3ce461071e8d5bf9b227b891 Mon Sep 17 00:00:00 2001 From: salad Date: Tue, 15 Dec 2020 17:24:53 +0100 Subject: norm tobecontinued2 --- src/c_init.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/c_init.c') diff --git a/src/c_init.c b/src/c_init.c index 0994e5d..a8ec6ee 100644 --- a/src/c_init.c +++ b/src/c_init.c @@ -11,12 +11,12 @@ /* ************************************************************************** */ #include -#include #include #include #include #include +#include "b_exit.h" #include "c_ctrls.h" #include "c_init.h" #include "c_keys.h" @@ -24,14 +24,10 @@ #include "c_input.h" #include "c_utils.h" #include "d_define.h" -#include "b_exit.h" +#include "m_prompt.h" #include "s_struct.h" #include "s_com.h" #include "s_line.h" -#include "s_destroy.h" -#include "m_prompt.h" -#include "m_loop.h" -#include "u_utils.h" short c_set_term_raw(char mode) @@ -141,7 +137,7 @@ static char char *ptr; if (*line == NULL) - if (!(*line = calloc(1, sizeof(char)))) + if (!(*line = ft_calloc(1, sizeof(char)))) return (NULL); if (ft_isprint(buf[0])) c_add_char(line, buf, tcaps); -- cgit v1.2.3 From 711bc9edbd9646900fc7e00e7b3457c2070ac31f Mon Sep 17 00:00:00 2001 From: salad Date: Wed, 16 Dec 2020 13:10:11 +0100 Subject: qwe --- src/c_init.c | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) (limited to 'src/c_init.c') diff --git a/src/c_init.c b/src/c_init.c index a8ec6ee..472ee75 100644 --- a/src/c_init.c +++ b/src/c_init.c @@ -76,21 +76,8 @@ static short return (0); } -char *ft_strrbavchr(const char *s, int c, size_t start) -{ - size_t i; - - i = ft_strlen(s) - start; - while (s[i] != c) - { - if (i == 0) - return (NULL); - i--; - } - return ((char*)&s[i]); -} - -char *c_set_ptr(t_bool reset, char key, t_msh *msh) +char + *c_set_ptr(t_bool reset, char key, t_msh *msh) { static char *p = NULL; static char *context = NULL; @@ -109,7 +96,7 @@ char *c_set_ptr(t_bool reset, char key, t_msh *msh) context = msh->prev_hist; } if (key == 1 && context == msh->prev_hist - && p == ft_strrbavchr(msh->prev_hist, '\n', 2) + 1) + && p == ft_strrnchr(msh->prev_hist, '\n', 2) + 1) { p = msh->curr_hist_ptr; context = msh->curr_hist_ptr; @@ -136,9 +123,6 @@ static char { char *ptr; - if (*line == NULL) - if (!(*line = ft_calloc(1, sizeof(char)))) - return (NULL); if (ft_isprint(buf[0])) c_add_char(line, buf, tcaps); else if (((*((unsigned int *)buf)) == UP_K) || -- cgit v1.2.3 From e3958afc911de2c628aa336893123ac871da3817 Mon Sep 17 00:00:00 2001 From: salad Date: Wed, 16 Dec 2020 13:13:50 +0100 Subject: c_keys_next is now c_utils_next --- src/c_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/c_init.c') diff --git a/src/c_init.c b/src/c_init.c index 472ee75..0001660 100644 --- a/src/c_init.c +++ b/src/c_init.c @@ -20,7 +20,7 @@ #include "c_ctrls.h" #include "c_init.h" #include "c_keys.h" -#include "c_keys_next.h" +#include "c_utils_next.h" #include "c_input.h" #include "c_utils.h" #include "d_define.h" -- cgit v1.2.3 From b96c18b5a12dc3f581ee0050aa48b2b3d7df26ec Mon Sep 17 00:00:00 2001 From: salad Date: Wed, 16 Dec 2020 13:46:31 +0100 Subject: check for leaks.......again --- src/c_init.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'src/c_init.c') diff --git a/src/c_init.c b/src/c_init.c index 0001660..59cb5fa 100644 --- a/src/c_init.c +++ b/src/c_init.c @@ -116,28 +116,18 @@ char return (p); } -/* TODO : key_up_down should manage and set the correct key */ - static char *c_process_key(char **line, char *buf, t_caps *tcaps, t_msh *msh) { - char *ptr; - if (ft_isprint(buf[0])) c_add_char(line, buf, tcaps); else if (((*((unsigned int *)buf)) == UP_K) || - ((*((unsigned int *)buf)) == CTRL_P)) - { - ptr = c_set_ptr(FALSE, -1, msh); - c_key_up_down(line, tcaps, ptr); - c_redraw_line(*line, tcaps); - } - else if (((*((unsigned int *)buf)) == DOWN_K) || + ((*((unsigned int *)buf)) == CTRL_P) || + ((*((unsigned int *)buf)) == DOWN_K) || ((*((unsigned int *)buf)) == CTRL_N)) { - ptr = c_set_ptr(FALSE, 1, msh); - c_key_up_down(line, tcaps, ptr); - c_redraw_line(*line, tcaps); + tcaps->key = c_set_key(buf); + c_key_up_down(line, tcaps, msh); } else if ((*((unsigned int *)buf)) == DEL_K) { @@ -167,6 +157,8 @@ short msh->sig = 0; tcaps.plen = (unsigned int)m_plen(msh->ps[psx - 1]); *line = NULL; + if (!(*line = ft_calloc(sizeof(char), 1))) + return (-1); if (!(c_get_win_size(&tcaps.ws))) return (-1); while (!(ft_strchr(nread, '\n'))) -- cgit v1.2.3 From 248372704dff81b91153d9e43a4b29a08551f99f Mon Sep 17 00:00:00 2001 From: salad Date: Wed, 16 Dec 2020 19:41:11 +0100 Subject: ormnshitz --- src/c_init.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/c_init.c') diff --git a/src/c_init.c b/src/c_init.c index 59cb5fa..4bfcf26 100644 --- a/src/c_init.c +++ b/src/c_init.c @@ -157,8 +157,9 @@ short msh->sig = 0; tcaps.plen = (unsigned int)m_plen(msh->ps[psx - 1]); *line = NULL; - if (!(*line = ft_calloc(sizeof(char), 1))) - return (-1); + if (*line == NULL) + if (!(*line = ft_calloc(sizeof(char), 1))) + return (-1); if (!(c_get_win_size(&tcaps.ws))) return (-1); while (!(ft_strchr(nread, '\n'))) -- cgit v1.2.3 From d058b05e6f31a426550e2f74f4d6f22e68b1537d Mon Sep 17 00:00:00 2001 From: salad Date: Wed, 16 Dec 2020 19:42:10 +0100 Subject: fuck --- src/c_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/c_init.c') diff --git a/src/c_init.c b/src/c_init.c index 4bfcf26..1659f3f 100644 --- a/src/c_init.c +++ b/src/c_init.c @@ -122,8 +122,8 @@ static char if (ft_isprint(buf[0])) c_add_char(line, buf, tcaps); else if (((*((unsigned int *)buf)) == UP_K) || - ((*((unsigned int *)buf)) == CTRL_P) || - ((*((unsigned int *)buf)) == DOWN_K) || + ((*((unsigned int *)buf)) == CTRL_P) || + ((*((unsigned int *)buf)) == DOWN_K) || ((*((unsigned int *)buf)) == CTRL_N)) { tcaps->key = c_set_key(buf); -- cgit v1.2.3 From f6cc429d6152f330de5d4aac36fea9810f9f47de Mon Sep 17 00:00:00 2001 From: salad Date: Fri, 18 Dec 2020 14:36:31 +0100 Subject: mergethis --- src/c_init.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/c_init.c') diff --git a/src/c_init.c b/src/c_init.c index 1659f3f..c3c6421 100644 --- a/src/c_init.c +++ b/src/c_init.c @@ -157,9 +157,9 @@ short msh->sig = 0; tcaps.plen = (unsigned int)m_plen(msh->ps[psx - 1]); *line = NULL; - if (*line == NULL) - if (!(*line = ft_calloc(sizeof(char), 1))) - return (-1); + if (!(*line = ft_calloc(sizeof(char), 1))) + return (-1); + ft_printf("[%p]\n\r", (void*)*line); if (!(c_get_win_size(&tcaps.ws))) return (-1); while (!(ft_strchr(nread, '\n'))) -- cgit v1.2.3 From 2cdac53cbc0081b553b704c52164b08e37f8b5e1 Mon Sep 17 00:00:00 2001 From: salad Date: Fri, 18 Dec 2020 14:37:02 +0100 Subject: nomergethislol --- src/c_init.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/c_init.c') diff --git a/src/c_init.c b/src/c_init.c index c3c6421..84098ec 100644 --- a/src/c_init.c +++ b/src/c_init.c @@ -159,7 +159,6 @@ short *line = NULL; if (!(*line = ft_calloc(sizeof(char), 1))) return (-1); - ft_printf("[%p]\n\r", (void*)*line); if (!(c_get_win_size(&tcaps.ws))) return (-1); while (!(ft_strchr(nread, '\n'))) -- cgit v1.2.3 From 62a1c19e2095a8dd0fb66f4e29dce37eae0c5d69 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Fri, 18 Dec 2020 16:00:22 +0100 Subject: Push --- src/c_init.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'src/c_init.c') diff --git a/src/c_init.c b/src/c_init.c index 84098ec..b2fd3d3 100644 --- a/src/c_init.c +++ b/src/c_init.c @@ -76,6 +76,22 @@ static short return (0); } +static void + c_set_ptr_norme(char key, t_bool *sw, char **p, char **context) +{ + if ((key == -1 && *p - *context != 0) || key == 1) + { + *p += (key == -1) ? (2 * key) : (0); + while (*sw == FALSE && ((key == -1 && *p - *context != 0) || key == 1) + && **p != C_LF && **p != C_NUL) + *p += key; + if (*sw == TRUE) + *sw = FALSE; + if (*p - *context != 0 && **p != C_NUL) + *p += 1; + } +} + char *c_set_ptr(t_bool reset, char key, t_msh *msh) { @@ -102,17 +118,7 @@ char context = msh->curr_hist_ptr; sw = TRUE; } - if ((key == -1 && p - context != 0) || key == 1) - { - p += (key == -1) ? (2 * key) : (0); - while (sw == FALSE && ((key == -1 && p - context != 0) || key == 1) - && *p != C_LF && *p != C_NUL) - p += key; - if (sw == TRUE) - sw = FALSE; - if (p - context != 0 && *p != C_NUL) - p += 1; - } + c_set_ptr_norme(key, &sw, &p, &context); return (p); } -- cgit v1.2.3