update: integrated hashmaps in builtins, and replaced command calls by builtins

This commit is contained in:
2025-12-02 09:11:01 +01:00
parent dce51960b1
commit b1cf1d8560
6 changed files with 83 additions and 25 deletions

View File

@@ -6,33 +6,43 @@
/* By: sede-san <sede-san@student.42madrid.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/10/29 22:09:51 by sede-san #+# #+# */
/* Updated: 2025/11/02 03:13:46 by sede-san ### ########.fr */
/* Updated: 2025/12/01 17:53:57 by sede-san ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef BUILTINS_H
# define BUILTINS_H
# include "libft.h"
# include "minishell.h"
# include "ft_args.h"
typedef unsigned char (*t_builtin_func)(t_command cmd, t_minishell *msh);
/******************************************************************************/
/* Functions */
/******************************************************************************/
// cd.c
/* builtins.c */
extern u_int8_t set_builtins(t_minishell *msh);
extern u_int8_t is_builtin(const char *command_name, t_minishell *msh);
/* cd.c */
extern u_int8_t builtin_cd(t_command cmd, t_minishell *msh);
// echo.c
/* echo.c */
extern u_int8_t builtin_echo(t_command cmd);
extern u_int8_t builtin_echo(t_command cmd, t_minishell *msh);
// exit.c
/* exit.c */
extern u_int8_t builtin_exit(t_command cmd, t_minishell *msh);
// pwd.c
/* pwd.c */
extern u_int8_t builtin_pwd(t_command cmd, t_minishell *msh);

View File

@@ -6,7 +6,7 @@
/* By: sede-san <sede-san@student.42madrid.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/10/22 19:10:13 by sede-san #+# #+# */
/* Updated: 2025/12/01 13:33:37 by sede-san ### ########.fr */
/* Updated: 2025/12/01 17:02:10 by sede-san ### ########.fr */
/* */
/* ************************************************************************** */
@@ -49,6 +49,7 @@ typedef struct s_variables
typedef struct s_minishell
{
t_variables variables;
t_hashmap *builtins;
u_int8_t exit_status;
u_int8_t exit;
} t_minishell;