|
@ -6,7 +6,7 @@ |
|
|
/* By: mea <marvin@42.fr> +#+ +:+ +#+ */ |
|
|
/* By: mea <marvin@42.fr> +#+ +:+ +#+ */ |
|
|
/* +#+#+#+#+#+ +#+ */ |
|
|
/* +#+#+#+#+#+ +#+ */ |
|
|
/* Created: 2022/05/02 13:50:44 by narnaud #+# #+# */ |
|
|
/* Created: 2022/05/02 13:50:44 by narnaud #+# #+# */ |
|
|
/* Updated: 2022/05/05 20:46:00 by narnaud ### ########.fr */ |
|
|
/* Updated: 2022/05/06 11:38:29 by narnaud ### ########.fr */ |
|
|
/* */ |
|
|
/* */ |
|
|
/* ************************************************************************** */ |
|
|
/* ************************************************************************** */ |
|
|
|
|
|
|
|
@ -52,6 +52,7 @@ int is_empty(char *line); |
|
|
void halt(int ret_code); |
|
|
void halt(int ret_code); |
|
|
void termios(int ctl); |
|
|
void termios(int ctl); |
|
|
void sigs_handler(int sig_num); |
|
|
void sigs_handler(int sig_num); |
|
|
|
|
|
void handle_status(t_datas *datas, int status); |
|
|
|
|
|
|
|
|
// ----------------------------------Builtins.c
|
|
|
// ----------------------------------Builtins.c
|
|
|
int close_minishell(int exit_code); |
|
|
int close_minishell(int exit_code); |
|
@ -69,6 +70,9 @@ int ft_export(t_datas *datas, t_command *cmd); |
|
|
void exe(t_datas *datas, t_command *cmd); |
|
|
void exe(t_datas *datas, t_command *cmd); |
|
|
int builtin_call(t_datas *datas, t_command *cmd); |
|
|
int builtin_call(t_datas *datas, t_command *cmd); |
|
|
int is_builtin(char *cmd); |
|
|
int is_builtin(char *cmd); |
|
|
|
|
|
pid_t caller(t_datas *datas, t_command *cmd); |
|
|
|
|
|
int piper(t_datas *datas, t_command *cmd); |
|
|
|
|
|
|
|
|
// ----------------------------------Parser.c
|
|
|
// ----------------------------------Parser.c
|
|
|
|
|
|
|
|
|
typedef enum e_type |
|
|
typedef enum e_type |
|
@ -79,17 +83,18 @@ typedef enum e_type |
|
|
ADD, |
|
|
ADD, |
|
|
IN, |
|
|
IN, |
|
|
HD, |
|
|
HD, |
|
|
} t_type; |
|
|
} t_type; |
|
|
|
|
|
|
|
|
typedef struct s_token |
|
|
typedef struct s_token |
|
|
{ |
|
|
{ |
|
|
char *value; |
|
|
char *value; |
|
|
t_type type; |
|
|
t_type type; |
|
|
struct s_token *next; |
|
|
struct s_token *next; |
|
|
} t_token; |
|
|
} t_token; |
|
|
|
|
|
char *expend_str(t_datas *datas, char *line); |
|
|
size_t count_arguments(t_token *tok); |
|
|
size_t count_arguments(t_token *tok); |
|
|
void update_redir(t_datas *datas, t_command *cmd, t_token *tok); |
|
|
void update_redir(t_datas *datas, t_command *cmd, t_token *tok); |
|
|
|
|
|
t_command *parser(t_datas *datas, t_token *tok, t_command *prev); |
|
|
|
|
|
|
|
|
// ----------------------------------Lexer.c
|
|
|
// ----------------------------------Lexer.c
|
|
|
|
|
|
|
|
@ -99,7 +104,7 @@ typedef enum e_state |
|
|
ROOT_ST, |
|
|
ROOT_ST, |
|
|
S_QUOTE_ST, |
|
|
S_QUOTE_ST, |
|
|
D_QUOTE_ST, |
|
|
D_QUOTE_ST, |
|
|
} t_state; |
|
|
} t_state; |
|
|
|
|
|
|
|
|
typedef struct s_lex |
|
|
typedef struct s_lex |
|
|
{ |
|
|
{ |
|
@ -108,12 +113,12 @@ typedef struct s_lex |
|
|
t_type next_type; |
|
|
t_type next_type; |
|
|
t_token *tokens; |
|
|
t_token *tokens; |
|
|
int n_elem; |
|
|
int n_elem; |
|
|
} t_lexer; |
|
|
} t_lexer; |
|
|
|
|
|
|
|
|
int create_token(t_lexer *lex, char str[]); |
|
|
int create_token(t_lexer *lex, char str[]); |
|
|
int check_register(t_lexer *lex, char **line, char *tmp); |
|
|
int check_register(t_lexer *lex, char **line, char *tmp); |
|
|
int replace_var(t_datas *datas, char **line, char *tmp, int tmp_i); |
|
|
int replace_var(t_datas *datas, char **line, char *tmp, int tmp_i); |
|
|
int check_state(t_lexer *lex, char **line); |
|
|
int check_state(t_lexer *lex, char **line); |
|
|
char *expend_str(t_datas *datas, char *line); |
|
|
t_token *lexer(t_datas *datas, char *line); |
|
|
|
|
|
|
|
|
#endif |
|
|
#endif |
|
|