exit sur la sortie d'erreure et parsing des variables $ mieux

This commit is contained in:
Tom Moron
2024-02-12 20:12:39 +01:00
parent f63d26dea7
commit 979e4e54a0
21 changed files with 33154 additions and 51 deletions

15
minishell.h Normal file → Executable file
View File

@ -6,7 +6,7 @@
/* By: tomoron <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/02/04 17:31:38 by tomoron #+# #+# */
/* Updated: 2024/02/09 18:17:30 by tomoron ### ########.fr */
/* Updated: 2024/02/11 22:54:49 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
@ -14,11 +14,21 @@
# define MINISHELL_H
# include <readline/readline.h>
# include <readline/history.h>
# include <limits.h>
# include <stdio.h>//debug
# include "libft/libft.h"
typedef enum e_token_type
{
ARG,
PIPE,
OR,
AND
} t_token_type;
typedef struct s_cmd
{
t_token_type type;
char *token;
struct s_cmd *next;
} t_cmd;
@ -32,7 +42,7 @@ typedef struct s_env
extern int g_return_code;
t_cmd *ft_cmd_add_back(t_cmd *res, char *token);
t_cmd *ft_cmd_add_back(t_cmd *res, char *token, t_token_type type);
void ft_free_cmd(t_cmd *cmd);
void ft_exec_command(t_cmd *cmd, t_env *env);
int ft_echo(t_cmd *args);
@ -45,4 +55,5 @@ int ft_get_token_len(char *cmd, t_env *env);
int ft_add_var_to_str(char *res, char **command, t_env *env);
int get_var_name_len(char *command);
char *ft_getenv(t_env *env, char *var_name);
int ft_pwd(void);
#endif