diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | src/c_init.c | 2 | ||||
-rw-r--r-- | src/m_prompt.c | 12 | ||||
-rw-r--r-- | src/m_prompt.h | 2 |
4 files changed, 8 insertions, 10 deletions
@@ -1,4 +1,4 @@ -default: msan +default: asan #==============================================================================# #--------------------------------- SHELL --------------------------------------# #==============================================================================# diff --git a/src/c_init.c b/src/c_init.c index 1023ced..1cc31b0 100644 --- a/src/c_init.c +++ b/src/c_init.c @@ -127,7 +127,7 @@ short tputs(tgetstr("cr", NULL), 1, ft_putchar); m_prompt_psx(psx, msh); ft_bzero(nread, 5); - tcaps.plen = m_plen(msh->ps[psx - 1]); + tcaps.plen = (unsigned int)m_plen(msh->ps[psx - 1]); tcaps.plen += (psx != 1); if (!(c_get_win_size(&tcaps.ws))) return (-1); diff --git a/src/m_prompt.c b/src/m_prompt.c index 0fbd9f2..68126ff 100644 --- a/src/m_prompt.c +++ b/src/m_prompt.c @@ -59,10 +59,10 @@ static void m_update_psx(unsigned char x, t_msh *msh) ft_strlcpy(msh->ps[x - 1], var, 255); } -unsigned int m_plen(char *prompt) +size_t m_plen(char *prompt) { - unsigned int i; - unsigned int size; + size_t i; + size_t size; i = 0; size = 0; @@ -72,15 +72,13 @@ unsigned int m_plen(char *prompt) { while (prompt[i] != 'm' && prompt[i] != '\0') i++; + i++; } - if (ft_isalnum(prompt[i]) || - ft_ischarset("<>", prompt[i])) + else { size++; i++; } - else - i++; } return (size); } diff --git a/src/m_prompt.h b/src/m_prompt.h index 59f627f..843bab7 100644 --- a/src/m_prompt.h +++ b/src/m_prompt.h @@ -15,7 +15,7 @@ # include "s_struct.h" -unsigned int m_plen(char *prompt); +size_t m_plen(char *prompt); void m_prompt_psx(unsigned char x, t_msh *msh); #endif |