The builtins wasnt protected, now all data received is protected, the hashmap addition is protected and added functionality of env, export and unset (not implemented in this version). Added fixed details documentation in docs/builtins_fixes.md generated by codex and created tests/builtins_edge_cases.sh to test all the builtins to work correctly
35 lines
1.3 KiB
C
35 lines
1.3 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* echo.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: sede-san <sede-san@student.42madrid.com +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2025/10/31 02:41:11 by sede-san #+# #+# */
|
|
/* Updated: 2025/12/01 18:05:51 by sede-san ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "builtins.h"
|
|
#include "echo_def.h"
|
|
|
|
uint8_t builtin_echo(
|
|
t_command cmd,
|
|
t_minishell *msh
|
|
){
|
|
const t_args args = read_args(cmd);
|
|
size_t i;
|
|
|
|
(void)msh;
|
|
i = -1;
|
|
while (args.strings.data.sp[++i])
|
|
{
|
|
ft_putstr(args.strings.data.sp[i]);
|
|
if (args.strings.data.sp[i + 1])
|
|
ft_putchar(SPACE);
|
|
}
|
|
if (args.no_newline.data.b == false)
|
|
ft_putchar(NEWLINE);
|
|
return (EXIT_SUCCESS);
|
|
}
|