diff options
author | salad <fmoenne-@student.le-101.fr> | 2020-12-15 17:02:34 +0100 |
---|---|---|
committer | salad <fmoenne-@student.le-101.fr> | 2020-12-15 17:02:34 +0100 |
commit | 45d3ad71ea69e18b27eb3fa202429e0b73a3826b (patch) | |
tree | 38560fb06053c21e0adba60102a225e625f386bd /src/c_init.c | |
parent | start refactoring shit (diff) | |
download | 42-minishell-45d3ad71ea69e18b27eb3fa202429e0b73a3826b.tar.gz 42-minishell-45d3ad71ea69e18b27eb3fa202429e0b73a3826b.tar.bz2 42-minishell-45d3ad71ea69e18b27eb3fa202429e0b73a3826b.tar.xz 42-minishell-45d3ad71ea69e18b27eb3fa202429e0b73a3826b.tar.zst 42-minishell-45d3ad71ea69e18b27eb3fa202429e0b73a3826b.zip |
norm and fix ctrl_c to fit c_gnl rewrite
Diffstat (limited to 'src/c_init.c')
-rw-r--r-- | src/c_init.c | 41 |
1 files changed, 0 insertions, 41 deletions
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) |