diff options
Diffstat (limited to 'src/c_init.c')
-rw-r--r-- | src/c_init.c | 22 |
1 files changed, 3 insertions, 19 deletions
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) || |