splited execution into multiple files and normed everything
This commit is contained in:
28
srcs/echo.c
28
srcs/echo.c
@ -6,26 +6,19 @@
|
||||
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/02/07 15:30:37 by tomoron #+# #+# */
|
||||
/* Updated: 2024/03/04 13:02:28 by marde-vr ### ########.fr */
|
||||
/* Updated: 2024/03/05 19:00:53 by marde-vr ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "minishell.h"
|
||||
#include <unistd.h>
|
||||
|
||||
int echo(t_cmd *args)
|
||||
void put_args(t_cmd *args)
|
||||
{
|
||||
int put_nl;
|
||||
int first;
|
||||
|
||||
put_nl = 1;
|
||||
first = 1;
|
||||
while (args && args->token && !strcmp(args->token, "-n"))
|
||||
{
|
||||
put_nl = 0;
|
||||
args = args->next;
|
||||
}
|
||||
while (args && args->type !=PIPE)
|
||||
while (args && args->type != PIPE)
|
||||
{
|
||||
if (args->type != ARG)
|
||||
args = args->next;
|
||||
@ -38,7 +31,20 @@ int echo(t_cmd *args)
|
||||
}
|
||||
args = args->next;
|
||||
}
|
||||
if (put_nl && !first)
|
||||
}
|
||||
|
||||
int echo(t_cmd *args)
|
||||
{
|
||||
int put_nl;
|
||||
|
||||
put_nl = 1;
|
||||
while (args && args->token && !strcmp(args->token, "-n"))
|
||||
{
|
||||
put_nl = 0;
|
||||
args = args->next;
|
||||
}
|
||||
put_args(args);
|
||||
if (put_nl)
|
||||
ft_putchar_fd('\n', STDOUT_FILENO);
|
||||
return (0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user