summaryrefslogtreecommitdiffstats
path: root/src/p_lblock_next.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-09-12 06:32:26 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-09-12 06:32:26 +0200
commit291cabef51915c280c26e567d864b6ea3fc56dbd (patch)
treef8f354f3ba029d3af13491bbd1147bbae6424dc1 /src/p_lblock_next.c
parentFormat (diff)
download42-minishell-291cabef51915c280c26e567d864b6ea3fc56dbd.tar.gz
42-minishell-291cabef51915c280c26e567d864b6ea3fc56dbd.tar.bz2
42-minishell-291cabef51915c280c26e567d864b6ea3fc56dbd.tar.xz
42-minishell-291cabef51915c280c26e567d864b6ea3fc56dbd.tar.zst
42-minishell-291cabef51915c280c26e567d864b6ea3fc56dbd.zip
In progress
Diffstat (limited to '')
-rw-r--r--src/p_lblock_next.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/p_lblock_next.c b/src/p_lblock_next.c
index 0a982a5..036d6b5 100644
--- a/src/p_lblock_next.c
+++ b/src/p_lblock_next.c
@@ -92,11 +92,35 @@ void
}
}
+static char
+ *p_skip_whitespace(char *ptr)
+{
+ while (*ptr != C_NUL && ft_iswhitespace(*ptr))
+ ptr++;
+ return (ptr);
+}
+
void
p_subst_alias(char word[], t_msh *msh)
{
- (void)word;
+ char *ptr;
+ size_t first;
+ t_quote_mode mode;
+
(void)msh;
+ mode = Q_NONE;
+ ptr = word;
+ p_skip_whitespace(ptr);
+ first = 1;
+ while (*ptr != C_NUL)
+ {
+ if (*ptr == C_DQUOTE)
+ mode = u_meet_dquote(word, ptr, mode);
+ if (*ptr == C_SQUOTE)
+ mode = u_meet_squote(word, ptr, mode);
+ if (ft_iswhitespace(*ptr) == TRUE && p_meet_whitespace((char*)word, ptr, mode) == TRUE)
+ ptr++;
+ }
}
char