variables d'environnement dans le parsing
This commit is contained in:
35
ft_echo.c
Normal file
35
ft_echo.c
Normal file
@ -0,0 +1,35 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_echo.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tomoron <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/02/07 15:30:37 by tomoron #+# #+# */
|
||||
/* Updated: 2024/02/07 23:15:04 by tomoron ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "minishell.h"
|
||||
|
||||
int ft_echo(t_cmd *args)
|
||||
{
|
||||
int put_nl;
|
||||
|
||||
put_nl = 1;
|
||||
while(args && !strcmp(args->token,"-n"))
|
||||
{
|
||||
put_nl = 0;
|
||||
args = args->next;
|
||||
}
|
||||
while(args)
|
||||
{
|
||||
ft_putstr_fd(args->token, STDOUT_FILENO);
|
||||
if(args->next)
|
||||
ft_putchar_fd(' ',STDOUT_FILENO);
|
||||
args = args->next;
|
||||
}
|
||||
if(put_nl)
|
||||
ft_putchar_fd('\n',STDOUT_FILENO);
|
||||
return(0);
|
||||
}
|
Reference in New Issue
Block a user