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
61 lines
2.0 KiB
C
61 lines
2.0 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* builtins.h :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: sede-san <sede-san@student.42madrid.com +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2025/10/29 22:09:51 by sede-san #+# #+# */
|
|
/* Updated: 2026/02/08 19:42:50 by sede-san ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#ifndef BUILTINS_H
|
|
# define BUILTINS_H
|
|
|
|
# include "ft_args.h"
|
|
# include "minishell.h"
|
|
# include "core.h"
|
|
|
|
typedef uint8_t (*t_builtin_func)(t_command cmd, t_minishell *minishell);
|
|
|
|
/******************************************************************************/
|
|
/* Functions */
|
|
/******************************************************************************/
|
|
|
|
/* builtins.c */
|
|
|
|
extern uint8_t set_builtins(t_minishell *minishell);
|
|
|
|
extern uint8_t is_builtin(const char *command_name, t_minishell *minishell);
|
|
|
|
/* cd.c */
|
|
|
|
extern uint8_t builtin_cd(t_command cmd, t_minishell *minishell);
|
|
|
|
/* echo.c */
|
|
|
|
extern uint8_t builtin_echo(t_command cmd, t_minishell *minishell);
|
|
|
|
/* exit.c */
|
|
|
|
extern uint8_t builtin_exit(t_command cmd, t_minishell *minishell);
|
|
|
|
/* pwd.c */
|
|
|
|
extern uint8_t builtin_pwd(t_command cmd, t_minishell *minishell);
|
|
|
|
/* env.c */
|
|
|
|
extern uint8_t builtin_env(t_command cmd, t_minishell *minishell);
|
|
|
|
/* export.c */
|
|
|
|
extern uint8_t builtin_export(t_command cmd, t_minishell *minishell);
|
|
|
|
/* unset.c */
|
|
|
|
extern uint8_t builtin_unset(t_command cmd, t_minishell *minishell);
|
|
|
|
#endif /* BUILTINS_H */
|