diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-09-20 15:24:18 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-09-20 15:24:18 +0200 |
commit | 00f646697e6d30d047e0b1e09ae0e55d216ce730 (patch) | |
tree | eb9a7a0734ba0caf46debb0fe7a30442f84af743 /src/p_redirs.c | |
parent | Redirs rework in progress (diff) | |
download | 42-minishell-00f646697e6d30d047e0b1e09ae0e55d216ce730.tar.gz 42-minishell-00f646697e6d30d047e0b1e09ae0e55d216ce730.tar.bz2 42-minishell-00f646697e6d30d047e0b1e09ae0e55d216ce730.tar.xz 42-minishell-00f646697e6d30d047e0b1e09ae0e55d216ce730.tar.zst 42-minishell-00f646697e6d30d047e0b1e09ae0e55d216ce730.zip |
In progress
Diffstat (limited to 'src/p_redirs.c')
-rw-r--r-- | src/p_redirs.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/p_redirs.c b/src/p_redirs.c new file mode 100644 index 0000000..aec3ba6 --- /dev/null +++ b/src/p_redirs.c @@ -0,0 +1,44 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* p_redirs.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:19:27 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:19:29 by rbousset ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + +#include <libft.h> +#include <stdint.h> +#include <stddef.h> + +#include "d_define.h" +#include "s_struct.h" +#include "u_parse.h" + +int8_t p_redirs(char word[], t_com **com) +{ + struct s_com *com_ptr; + char *ptr; + t_quote_mode mode; + + mode = Q_NONE; + ptr = (char *)word; + while (*ptr != C_NUL) + { + if (*ptr == C_DQUOTE) + mode = u_meet_dquote(word, ptr, mode); + else if (*ptr == C_SQUOTE) + mode = u_meet_squote(word, ptr, mode); + else if (mode == Q_NONE && (*ptr == '<' || *ptr == '>') == 1) + { + if (p_get_redir(ptr, (ptr - word), com) != ) + ptr = word; + } + ptr++; + } + return (0); +} + |