diff options
author | Rudy Bousset <rbousset@z2r5p6.le-101.fr> | 2019-10-29 13:54:42 +0100 |
---|---|---|
committer | Rudy Bousset <rbousset@z2r5p6.le-101.fr> | 2019-10-29 13:54:42 +0100 |
commit | 53a5dc3296b363cdb3375dfa7ef3ff582d3cbd1b (patch) | |
tree | 54b22e10c806be22e1d7e3c2be5f848d012f5ab8 /src/ft_echo.c | |
parent | tons of changes (diff) | |
download | 42-minishell-53a5dc3296b363cdb3375dfa7ef3ff582d3cbd1b.tar.gz 42-minishell-53a5dc3296b363cdb3375dfa7ef3ff582d3cbd1b.tar.bz2 42-minishell-53a5dc3296b363cdb3375dfa7ef3ff582d3cbd1b.tar.xz 42-minishell-53a5dc3296b363cdb3375dfa7ef3ff582d3cbd1b.tar.zst 42-minishell-53a5dc3296b363cdb3375dfa7ef3ff582d3cbd1b.zip |
commit, lotta stuff
Diffstat (limited to '')
-rw-r--r-- | src/ft_echo.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/src/ft_echo.c b/src/ft_echo.c index 66d803f..08fac36 100644 --- a/src/ft_echo.c +++ b/src/ft_echo.c @@ -12,21 +12,16 @@ ft_echo(char **com, uint8_t n) fd = 1; if (!com[1]) ft_putendl_fd("", fd); - else if (ft_strncmp(com[1], "-n", ft_strlen(com[1]))) + else if (!ft_strncmp(com[1], "-n", ft_strlen(com[1]))) + i = 2; + while (i < n) { - while (i < n) - { - ft_putendl_fd(com[i], fd); - i++; - } - } - else - { - while (i < n) - { - ft_putstr_fd(com[i], fd); - i++; - } + ft_putstr_fd(com[i], fd); + if (i != n - 1) + ft_putchar_fd(' ', fd); + i++; } + if (ft_strncmp(com[1], "-n", ft_strlen(com[1]))) + ft_putchar_fd('\n', fd); return (0); } |