」 feat: Did a lot of things, don't know what but it work

This commit is contained in:
2024-06-30 18:03:58 +02:00
parent 3d7669d056
commit f0c0830c4d
19 changed files with 188 additions and 111 deletions

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/20 20:25:06 by adjoly #+# #+# */
/* Updated: 2024/06/29 16:25:47 by adjoly ### ########.fr */
/* Updated: 2024/06/30 16:08:28 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -16,12 +16,17 @@
/**
* Here we define all the error message
*/
# include <stdbool.h>
# define ERROR_SYNTAX ": syntax error"
# define ERROR_NO_REDIR ": need redirection file"
# define ERROR_NO_EOF ": need delimiter to heredoc"
# define ERROR_NO_FILE "No such file or directory"
# define ERROR_CMD_PIPE "No command after pipe"
# define ERROR_COREDUMP "(core dumped)"
char *get_program_name(char *argv_one);
bool send_error_parsing(char *msg);
#endif

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/25 12:20:26 by adjoly #+# #+# */
/* Updated: 2024/06/29 15:31:02 by adjoly ### ########.fr */
/* Updated: 2024/06/30 17:27:13 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -33,18 +33,20 @@ typedef enum s_quote
DOUBLE = 34
} t_quote;
bool check_syntax(char *readline, char **argv);
bool check_syntax(char *readline);
void send_error(char *msg, char **argv);
void check_redir(t_list *redir, char **argv);
t_cmd *get_redir_fd(void *content, t_env *env);
t_list *get_cmd_list(t_list *list, t_env *env);
bool check_redir(t_list *redir);
t_cmd *get_redir_fd(void *content);
t_list *get_cmd_list(t_list *list);
void open_redir(t_redirection *redir, t_cmd *cmd, t_redir_sign sign[2]);
char **split_argv(char *readline);
char *env_var_replace(char *readline, t_env *env);
size_t get_size_with_env(char *readline, t_env *env);
size_t strlen_till_char(char *s, int c);
void check_quote(char *readline);
bool check_quote(char *readline);
t_quote __is_quote(char c);
char *search_for_next_quote(char *s, t_quote quote_type);
bool check_pipe(char *readline);
char **split_argv(char *readline);
/**
* @brief Take the argv of a command a split the argv and the
@ -82,7 +84,7 @@ t_quote __is_quote(char c);
* ONLY FOR DEBUG TO BE REMOVED
*/
void print_quote_type(t_quote type);
void print_redir_sign(t_redirection_sign redir_sign);
void print_redir_sign(t_redir_sign redir_sign);
void print_token(t_token *token);
void print_redir(t_redirection *redir);

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/18 20:14:15 by adjoly #+# #+# */
/* Updated: 2024/06/26 12:45:41 by adjoly ### ########.fr */
/* Updated: 2024/06/30 17:18:32 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -21,12 +21,12 @@ typedef enum s_redirection_sign
HEREDOC,
OUTFILE,
OUT_APPEND,
} t_redirection_sign;
} t_redir_sign;
typedef struct s_redirection
{
char *file_name;
t_redirection_sign sign;
char *file_name;
t_redir_sign sign;
} t_redirection;
typedef struct s_token
@ -42,7 +42,7 @@ typedef struct s_token
*
* @return (t_redirection_sign) The sign of the redirecition
*/
t_redirection_sign __to_redir_sign(char *redir_sign);
t_redir_sign __to_redir_sign(char *redir_sign);
/**
* @brief Take a string and split the filename and the redirect