diff options
author | salad <fmoenne-@student.le-101.fr> | 2020-11-02 21:37:01 +0100 |
---|---|---|
committer | salad <fmoenne-@student.le-101.fr> | 2020-11-02 21:37:01 +0100 |
commit | 765a2b4ff157f3303f0f8d7d6379cb849004a679 (patch) | |
tree | d6cdb352bd539667dd56c76562a0cba11cc9dc9a /src/c_init.c | |
parent | merge happenned (diff) | |
download | 42-minishell-765a2b4ff157f3303f0f8d7d6379cb849004a679.tar.gz 42-minishell-765a2b4ff157f3303f0f8d7d6379cb849004a679.tar.bz2 42-minishell-765a2b4ff157f3303f0f8d7d6379cb849004a679.tar.xz 42-minishell-765a2b4ff157f3303f0f8d7d6379cb849004a679.tar.zst 42-minishell-765a2b4ff157f3303f0f8d7d6379cb849004a679.zip |
strplen
Diffstat (limited to 'src/c_init.c')
-rw-r--r-- | src/c_init.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/c_init.c b/src/c_init.c index 6847c14..53af0a3 100644 --- a/src/c_init.c +++ b/src/c_init.c @@ -23,6 +23,30 @@ #include "s_struct.h" #include "m_prompt.h" +unsigned int + c_plen(char *prompt) +{ + unsigned int i; + unsigned int size; + + i = 0; + size = 0; + while (prompt[i] != '\0') + { + if (ft_isalpha(prompt[i])) + { + i++; + size++; + } + else + { + + i++; + } + } + return (size); +} + short c_set_term_raw(char mode) { @@ -128,6 +152,7 @@ short c_init_line(psx, &tcaps); tputs(tgetstr("cr", NULL), 1, ft_putchar); m_prompt_psx(psx, msh); + ft_printf("%u", c_plen(msh->ps[0])); ft_bzero(nread, 5); if (!(c_get_win_size(&tcaps.ws))) return (-1); |