blob: 08fac368b02b60a731a6a023a2e263dc5e8fbab0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#include <libft.h>
#include <minishell.h>
#include <inttypes.h>
int
ft_echo(char **com, uint8_t n)
{
uint8_t i;
int fd;
i = 1;
fd = 1;
if (!com[1])
ft_putendl_fd("", fd);
else if (!ft_strncmp(com[1], "-n", ft_strlen(com[1])))
i = 2;
while (i < n)
{
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);
}
|