diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-09-05 15:57:20 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-09-05 15:57:20 +0200 |
commit | 8e8508c068111729d74d43d51bd6f2f9b9e1cdc0 (patch) | |
tree | 71ae106df2588c5a25c60b76da47e16a38debf5d /src/p_args_quotes.c | |
parent | commit (diff) | |
download | 42-minishell-8e8508c068111729d74d43d51bd6f2f9b9e1cdc0.tar.gz 42-minishell-8e8508c068111729d74d43d51bd6f2f9b9e1cdc0.tar.bz2 42-minishell-8e8508c068111729d74d43d51bd6f2f9b9e1cdc0.tar.xz 42-minishell-8e8508c068111729d74d43d51bd6f2f9b9e1cdc0.tar.zst 42-minishell-8e8508c068111729d74d43d51bd6f2f9b9e1cdc0.zip |
In progress
Diffstat (limited to 'src/p_args_quotes.c')
-rw-r--r-- | src/p_args_quotes.c | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/src/p_args_quotes.c b/src/p_args_quotes.c deleted file mode 100644 index e6fdd92..0000000 --- a/src/p_args_quotes.c +++ /dev/null @@ -1,77 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* p_args_quotes.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 "d_define.h" - -/* static void */ -/* p_arg_squotes(char word[]) */ -/* { */ -/* char *ptr; */ - -/* ptr = word; */ -/* while ((ptr = ft_strchr(ptr, C_SQUOTE)) != NULL) */ -/* { */ -/* ft_memmove(word + (ptr - word), ptr + 1, ft_strlen(ptr + 1) + 1); */ -/* } */ -/* } */ - -static void - p_arg_dquotes(char word[]) -{ - char *ptr; - - ptr = word; - while ((ptr = ft_strchr(ptr, C_DQUOTE)) != NULL) - { - if (ptr - word == 0) - ft_memmove(word, word + 1, ft_strlen(word)); - else if (ptr - word == 1 && *(ptr - 1) == C_BS) - ptr++; - else if (ptr - word > 1 && *(ptr - 1) == C_BS && - *(ptr - 2) != C_BS) - ptr++; - else - ft_memmove(word + (ptr - word), ptr + 1, ft_strlen(ptr + 1) + 1); - } -} - -void - p_args_quotes(char *words[]) -{ - char **ptr; - char *dq_ptr; - char *sq_ptr; - - ptr = words; - dq_ptr = NULL; - sq_ptr = NULL; - while (*ptr != NULL) - { - dq_ptr = ft_strchr(*ptr, C_DQUOTE); - sq_ptr = ft_strchr(*ptr, C_SQUOTE); - if (dq_ptr != NULL && sq_ptr != NULL) - { - if (dq_ptr < sq_ptr) - p_arg_dquotes(*ptr); - } - /* if (**ptr == C_SQUOTE) */ - /* p_arg_squotes(*ptr); */ - /* else if (**ptr == C_DQUOTE) */ - /* p_arg_dquotes(*ptr); */ - ptr++; - dq_ptr = NULL; - sq_ptr = NULL; - } -} |