diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-04-21 17:56:16 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-04-21 17:56:16 +0200 |
commit | a55f16b240a61dbea25f678166d0b9e98e8d78a3 (patch) | |
tree | b867c50fc60b09f862ed6fc71faa03159de65087 /src/ft_b_echo.c | |
parent | Good so far (diff) | |
download | 42-minishell-a55f16b240a61dbea25f678166d0b9e98e8d78a3.tar.gz 42-minishell-a55f16b240a61dbea25f678166d0b9e98e8d78a3.tar.bz2 42-minishell-a55f16b240a61dbea25f678166d0b9e98e8d78a3.tar.xz 42-minishell-a55f16b240a61dbea25f678166d0b9e98e8d78a3.tar.zst 42-minishell-a55f16b240a61dbea25f678166d0b9e98e8d78a3.zip |
Messy echo
Diffstat (limited to '')
-rw-r--r-- | src/ft_b_echo.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/ft_b_echo.c b/src/ft_b_echo.c index 326967d..6a3af34 100644 --- a/src/ft_b_echo.c +++ b/src/ft_b_echo.c @@ -13,16 +13,31 @@ #include <libft.h> #include <stdint.h> #include "ft_s_struct.h" +#include "ft_u_utils.h" uint8_t ft_b_echo(char *args[], t_msh *msh) { + char **ptr; + int8_t nopt; + (void)msh; - while (*args) + ptr = args; + nopt = 0; + if (ft_strncmp(ptr[0], "-n", 2) == 0) + { + nopt = 1; + ptr += 1; + } + ft_printf("%s", *ptr); + ptr++; + while (*ptr) { - ft_printf("%s\n", *args); - args++; + ft_printf(" %s", *ptr); + ptr++; } + if (nopt == 0) + ft_printf("\n"); return (0); } |