redirection parsing: get redirection type from worddesc

This commit is contained in:
Khaïs COLIN 2025-03-07 14:58:43 +01:00
parent a20ea8315d
commit b0439c9d7d
Signed by: logistic-bot
SSH key fingerprint: SHA256:RlpiqKeXpcPFZZ4y9Ou4xi2M8OhRJovIwDlbCaMsuAo
3 changed files with 27 additions and 1 deletions

View file

@ -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

View file

@ -0,0 +1,21 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* redirection_type.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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);
}

View file

@ -6,13 +6,15 @@
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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