」 feat: Added some security to the parsing

This commit is contained in:
2024-07-03 19:13:43 +02:00
parent 9f25b17170
commit d24f097ae9
6 changed files with 21 additions and 79 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/30 16:08:28 by adjoly ### ########.fr */
/* Updated: 2024/07/03 19:07:12 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -18,11 +18,12 @@
*/
# 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_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_NO_CMD "No command in the pipe"
# define ERROR_COREDUMP "(core dumped)"

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/25 12:20:26 by adjoly #+# #+# */
/* Updated: 2024/06/30 17:27:13 by adjoly ### ########.fr */
/* Updated: 2024/07/03 19:03:35 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -36,6 +36,7 @@ typedef enum s_quote
bool check_syntax(char *readline);
void send_error(char *msg, char **argv);
bool check_redir(t_list *redir);
bool check_argv(t_list *token);
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]);