mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
redirection parsing: get redirection type from worddesc
This commit is contained in:
parent
a20ea8315d
commit
b0439c9d7d
3 changed files with 27 additions and 1 deletions
1
Makefile
1
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
|
||||
|
|
|
|||
21
src/postprocess/redirections/redirection_type.c
Normal file
21
src/postprocess/redirections/redirection_type.c
Normal 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);
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue