diff --git a/Makefile b/Makefile index 56f0bec..ea8043e 100644 --- a/Makefile +++ b/Makefile @@ -53,6 +53,7 @@ srcs = \ src/postprocess/redirections/redirection.c \ src/postprocess/redirections/redirection_list.c \ src/postprocess/redirections/redirection_parsing.c \ + src/postprocess/redirections/redirection_type.c \ objs = $(srcs:.c=.o) export objs diff --git a/src/postprocess/redirections/redirection_type.c b/src/postprocess/redirections/redirection_type.c new file mode 100644 index 0000000..3a6ddf5 --- /dev/null +++ b/src/postprocess/redirections/redirection_type.c @@ -0,0 +1,21 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* redirection_type.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: khais +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/03/07 14:56:29 by khais #+# #+# */ +/* Updated: 2025/03/07 14:57:32 by khais ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "redirection_type.h" +#include "libft.h" + +t_redir_type redir_type_from_worddesc(t_worddesc *word) +{ + if (ft_strcmp(">", word->word) == 0) + return (REDIR_OUTPUT); + return (REDIR_INVALID); +} diff --git a/src/postprocess/redirections/redirection_type.h b/src/postprocess/redirections/redirection_type.h index 19897b2..c9b6de4 100644 --- a/src/postprocess/redirections/redirection_type.h +++ b/src/postprocess/redirections/redirection_type.h @@ -6,13 +6,15 @@ /* By: khais +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/03/07 14:37:12 by khais #+# #+# */ -/* Updated: 2025/03/07 14:44:31 by khais ### ########.fr */ +/* Updated: 2025/03/07 14:56:07 by khais ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef REDIRECTION_TYPE_H # define REDIRECTION_TYPE_H +# include "../../parser/worddesc/worddesc.h" + /* ** Type of redirection. */ @@ -30,4 +32,6 @@ typedef enum e_redirection_type REDIR_APPEND, } t_redir_type; +t_redir_type redir_type_from_worddesc(t_worddesc *word); + #endif // REDIRECTION_TYPE_H