|
@ -12,11 +12,9 @@ |
|
|
|
|
|
|
|
|
#ifndef MINISHELL_H |
|
|
#ifndef MINISHELL_H |
|
|
# define MINISHELL_H |
|
|
# define MINISHELL_H |
|
|
# define ENVP_LIMIT 1024 |
|
|
# define ENVP_MAX_SIZE 1024 |
|
|
# define PIPE_MAX_SIZE 8192 |
|
|
# define STR_MAX_SIZE 1024 |
|
|
# define PATHS_MAX_SIZE 126 |
|
|
# define PATHS_MAX_SIZE 126 |
|
|
# define PROMPT_PREFIX 0 |
|
|
|
|
|
# define DEBUG 0 |
|
|
|
|
|
|
|
|
|
|
|
# include "libft/libft.h" |
|
|
# include "libft/libft.h" |
|
|
# include <fcntl.h> |
|
|
# include <fcntl.h> |
|
@ -55,9 +53,8 @@ void sigs_handler(int sig_num); |
|
|
void halt(t_datas *datas, int ret_code); |
|
|
void halt(t_datas *datas, int ret_code); |
|
|
|
|
|
|
|
|
// ----------------------------------Utils_2.c
|
|
|
// ----------------------------------Utils_2.c
|
|
|
int replace_var(t_datas *datas, char **line, \ |
|
|
|
|
|
char *tmp, int tmp_i); |
|
|
|
|
|
int file_error(char *cmd, char *file, char *msg); |
|
|
int file_error(char *cmd, char *file, char *msg); |
|
|
|
|
|
int replace_var(t_datas *datas, char **line, char *tmp, int tmp_i); |
|
|
char *expend_str(t_datas *datas, char *line); |
|
|
char *expend_str(t_datas *datas, char *line); |
|
|
|
|
|
|
|
|
// ----------------------------------Builtins.c
|
|
|
// ----------------------------------Builtins.c
|
|
@ -67,16 +64,13 @@ int ft_cd(t_command *cmd); |
|
|
int ft_exit(t_datas *datas, t_command *cmd); |
|
|
int ft_exit(t_datas *datas, t_command *cmd); |
|
|
|
|
|
|
|
|
// ----------------------------------Env.c
|
|
|
// ----------------------------------Env.c
|
|
|
int is_valid_identifier(char *ident); |
|
|
|
|
|
int ft_unset(t_datas *datas, t_command *cmd); |
|
|
int ft_unset(t_datas *datas, t_command *cmd); |
|
|
int ft_env(t_datas *datas, t_command *cmd); |
|
|
int ft_env(t_datas *datas, t_command *cmd); |
|
|
int ft_export(t_datas *datas, t_command *cmd); |
|
|
int ft_export(t_datas *datas, t_command *cmd); |
|
|
|
|
|
|
|
|
// ----------------------------------Caller.c
|
|
|
// ----------------------------------Caller.c
|
|
|
void exe(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 builtin_call(t_datas *datas, t_command *cmd); |
|
|
int piper(t_datas *datas, t_command *cmd); |
|
|
int piper(t_datas *datas, t_command *cmd); |
|
|
|
|
|
|
|
|
// ----------------------------------Parser.c
|
|
|
// ----------------------------------Parser.c
|
|
@ -97,11 +91,7 @@ typedef struct s_token |
|
|
struct s_token *next; |
|
|
struct s_token *next; |
|
|
} t_token; |
|
|
} t_token; |
|
|
|
|
|
|
|
|
size_t count_arguments(t_token *tok); |
|
|
t_command *parser(t_datas *datas, t_token *tok,t_command *prev); |
|
|
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
|
|
|
typedef enum e_state |
|
|
typedef enum e_state |
|
@ -121,9 +111,6 @@ typedef struct s_lex |
|
|
int n_elem; |
|
|
int n_elem; |
|
|
} t_lexer; |
|
|
} t_lexer; |
|
|
|
|
|
|
|
|
int create_token(t_lexer *lex, char str[]); |
|
|
|
|
|
int check_register(t_lexer *lex, char **line, char *tmp); |
|
|
|
|
|
int check_state(t_lexer *lex, char **line); |
|
|
|
|
|
t_token *lexer(t_datas *datas, char *line); |
|
|
t_token *lexer(t_datas *datas, char *line); |
|
|
|
|
|
|
|
|
#endif |
|
|
#endif |
|
|