diff options
author | salad <fmoenne-@student.le-101.fr> | 2020-12-15 13:37:41 +0100 |
---|---|---|
committer | salad <fmoenne-@student.le-101.fr> | 2020-12-15 13:37:41 +0100 |
commit | cbde2aa474cc289cc6db127ebcedeb7e5502d7be (patch) | |
tree | 5c530500265c737f2db68913c65595a87784a280 /src/c_utils.c | |
parent | qwe (diff) | |
download | 42-minishell-cbde2aa474cc289cc6db127ebcedeb7e5502d7be.tar.gz 42-minishell-cbde2aa474cc289cc6db127ebcedeb7e5502d7be.tar.bz2 42-minishell-cbde2aa474cc289cc6db127ebcedeb7e5502d7be.tar.xz 42-minishell-cbde2aa474cc289cc6db127ebcedeb7e5502d7be.tar.zst 42-minishell-cbde2aa474cc289cc6db127ebcedeb7e5502d7be.zip |
onto something
Diffstat (limited to 'src/c_utils.c')
-rw-r--r-- | src/c_utils.c | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/src/c_utils.c b/src/c_utils.c index 2414638..048b845 100644 --- a/src/c_utils.c +++ b/src/c_utils.c @@ -35,7 +35,7 @@ char if (line != NULL) { ret = ft_strdup(line); - line[0] = '\0'; + *line = '\0'; } tcaps->cpos = 0; tputs(tgetstr("cr", NULL), 1, ft_putchar); @@ -44,36 +44,14 @@ char { write(1, "\n", 1); } - /* ft_printf("[%s][%s]\n", ret, line); */ return (ret); } -char - *c_insert_char(char *str, char c, t_caps *tcaps) -{ - int i; - size_t j; - size_t len; - char *dst; +/* char */ +/* *c_insert_char(char *str, char c, t_caps *tcaps) */ +/* { */ - i = -1; - j = 0; - len = (ft_strlen(str) + 2); - if (!(dst = (char*)malloc((len) * sizeof(char)))) - return (NULL); - while (++i < (int)len) - { - if (i == (int)tcaps->cpos) - dst[i] = c; - else - { - dst[i] = str[j]; - j++; - } - } - ft_memdel((void**)&str); - return (dst); -} +/* } */ char *c_delchar(char *str, unsigned short cpos) |