🗑️」 clean(builtins/echo): cleaned garbage

This commit is contained in:
y-syo
2024-07-18 14:45:15 +02:00
parent 6ac6f778e3
commit 72b4180d55
3 changed files with 9 additions and 10 deletions

View File

@ -6,7 +6,7 @@
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/22 13:05:18 by adjoly #+# #+# */
/* Updated: 2024/07/18 14:31:31 by mmoussou ### ########.fr */
/* Updated: 2024/07/18 14:43:54 by mmoussou ### ########.fr */
/* */
/* ************************************************************************** */
@ -21,7 +21,7 @@ void ft_pwd(void);
void ft_cd(t_env *env, char *args);
void ft_echo(char **args, int fd);
void ft_echo(char **args);
char *ret_cwd(void);

View File

@ -6,7 +6,7 @@
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/29 19:19:57 by adjoly #+# #+# */
/* Updated: 2024/07/18 14:37:39 by mmoussou ### ########.fr */
/* Updated: 2024/07/18 14:44:45 by mmoussou ### ########.fr */
/* */
/* ************************************************************************** */
@ -37,12 +37,11 @@ size_t __nl_option(char **args)
return (i);
}
void ft_echo(char **args, int fd)
void ft_echo(char **args)
{
char **tmp;
bool new_line;
fd = STDOUT_FILENO;
tmp = args;
if (__nl_option(args) > 0)
new_line = false;
@ -51,11 +50,11 @@ void ft_echo(char **args, int fd)
tmp += __nl_option(args);
while (*tmp && tmp)
{
ft_putstr_fd(*tmp, fd);
ft_putstr_fd(*tmp, STDOUT_FILENO);
tmp++;
if (*tmp != NULL)
ft_putchar_fd(' ', fd);
ft_putchar_fd(' ', STDOUT_FILENO);
}
if (new_line == true)
ft_putchar_fd('\n', fd);
ft_putchar_fd('\n', STDOUT_FILENO);
}

View File

@ -6,7 +6,7 @@
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/15 21:03:31 by mmoussou #+# #+# */
/* Updated: 2024/07/18 14:41:32 by mmoussou ### ########.fr */
/* Updated: 2024/07/18 14:44:07 by mmoussou ### ########.fr */
/* */
/* ************************************************************************** */
@ -22,7 +22,7 @@ void exec_cmd(t_cmd *cmd, char **env, t_env *env_t)
if (i)
{
if (i == 5)
ft_echo(cmd->argv + 1, cmd->outfile);
ft_echo(cmd->argv + 1);
if (i == 2)
ft_cd(env_t, (cmd->argv)[1]);
if (i == 6)