structure: moved t_command struct definition from parser header file to core header file

This commit is contained in:
2025-10-30 12:56:35 +01:00
parent a6bf9cb60f
commit cbfedb7bc5
3 changed files with 26 additions and 17 deletions

View File

@@ -6,7 +6,7 @@
/* By: sede-san <sede-san@student.42madrid.com +#+ +:+ +#+ */ /* By: sede-san <sede-san@student.42madrid.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/10/22 19:10:13 by sede-san #+# #+# */ /* Created: 2025/10/22 19:10:13 by sede-san #+# #+# */
/* Updated: 2025/10/23 23:19:58 by sede-san ### ########.fr */ /* Updated: 2025/10/30 12:46:15 by sede-san ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -21,6 +21,7 @@
typedef struct s_minishell t_minishell; typedef struct s_minishell t_minishell;
typedef struct s_variables t_variables; typedef struct s_variables t_variables;
typedef struct s_command t_command;
/** /**
* @brief Structure that holds both environment and internal variables * @brief Structure that holds both environment and internal variables
@@ -51,6 +52,23 @@ typedef struct s_minishell
u_int8_t exit_status; u_int8_t exit_status;
} t_minishell; } t_minishell;
/**
* @brief Structure representing a single command in the shell
*
* This structure holds all the necessary information for executing a command
* in the minishell, including its arguments and executable path.
*
* @param argc Number of arguments in the command (including the command name)
* @param argv Array of strings containing the command and its arguments
* @param path Full path to the executable file for this command
*/
typedef struct s_command
{
int argc;
char **argv;
char *path;
} t_command;
/******************************************************************************/ /******************************************************************************/
/* Functions */ /* Functions */
/******************************************************************************/ /******************************************************************************/

View File

@@ -6,7 +6,7 @@
/* By: sede-san <sede-san@student.42madrid.com +#+ +:+ +#+ */ /* By: sede-san <sede-san@student.42madrid.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/10/20 16:35:10 by sede-san #+# #+# */ /* Created: 2025/10/20 16:35:10 by sede-san #+# #+# */
/* Updated: 2025/10/23 13:25:25 by sede-san ### ########.fr */ /* Updated: 2025/10/30 12:20:08 by sede-san ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -14,9 +14,12 @@
# define MINISHELL_H # define MINISHELL_H
# include "libft.h" # include "libft.h"
# include "ft_printf.h"
# include "chardefs.h"
# include "core.h" # include "core.h"
# include "parser.h" # include "parser.h"
# include "chardefs.h" # include "executor.h"
# include "builtins.h"
# include <readline/readline.h> // readline(3), rl_clear_history(), # include <readline/readline.h> // readline(3), rl_clear_history(),
// rl_on_new_line(), rl_replace_line(), // rl_on_new_line(), rl_replace_line(),
// rl_redisplay() // rl_redisplay()

View File

@@ -6,7 +6,7 @@
/* By: sede-san <sede-san@student.42madrid.com +#+ +:+ +#+ */ /* By: sede-san <sede-san@student.42madrid.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/10/22 19:03:51 by sede-san #+# #+# */ /* Created: 2025/10/22 19:03:51 by sede-san #+# #+# */
/* Updated: 2025/10/23 13:31:09 by sede-san ### ########.fr */ /* Updated: 2025/10/30 12:44:51 by sede-san ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -15,24 +15,12 @@
# include "minishell.h" # include "minishell.h"
/******************************************************************************/
/* Structures & Data Types */
/******************************************************************************/
typedef struct s_command t_command;
typedef struct s_command
{
int argc;
char **argv;
} t_command;
/******************************************************************************/ /******************************************************************************/
/* Functions */ /* Functions */
/******************************************************************************/ /******************************************************************************/
// parser.c // parser.c
extern char *parse(char *line, t_minishell *minishell); extern t_command parse(char *line, t_minishell *minishell);
#endif /* PARSER_H */ #endif /* PARSER_H */