summaryrefslogtreecommitdiffstats
path: root/src/p_lblock_next.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-09-12 15:07:22 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-09-12 15:07:22 +0200
commit477ea057edf32486e944ef4e33023e9ab6636e07 (patch)
treee8d6996c27b5bb6fde380eadea0c751bb9c2e117 /src/p_lblock_next.c
parenthow tf will I norm this (diff)
download42-minishell-477ea057edf32486e944ef4e33023e9ab6636e07.tar.gz
42-minishell-477ea057edf32486e944ef4e33023e9ab6636e07.tar.bz2
42-minishell-477ea057edf32486e944ef4e33023e9ab6636e07.tar.xz
42-minishell-477ea057edf32486e944ef4e33023e9ab6636e07.tar.zst
42-minishell-477ea057edf32486e944ef4e33023e9ab6636e07.zip
Aliases work, fucker
Diffstat (limited to 'src/p_lblock_next.c')
-rw-r--r--src/p_lblock_next.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/p_lblock_next.c b/src/p_lblock_next.c
index 8b755da..707acc0 100644
--- a/src/p_lblock_next.c
+++ b/src/p_lblock_next.c
@@ -113,13 +113,13 @@ static t_bool
void
p_subst_alias(char word[], t_msh *msh)
{
- char *ptr;
+ char value[ARG_MAX];
char tmp[255];
size_t locat[2];
+ char *ptr;
t_bool good;
t_quote_mode mode;
- (void)msh;
mode = Q_NONE;
ptr = word;
ptr = p_skip_whitespace(ptr);
@@ -157,7 +157,14 @@ void
ft_strlcpy(tmp,
word + locat[0],
((locat[1] - locat[0] < 253) ? (locat[1] - locat[0]) : (254)) + 1);
- ft_printf("(%s)\n", tmp);
+ if (u_get_alias_value(value, tmp, ARG_MAX, msh) != 0)
+ return ;
+ (void)ft_memmove(word + (locat[0] + ft_strlen(value)),
+ word + locat[1],
+ ft_strlen(word + locat[1]) + 1 * sizeof(char));
+ (void)ft_memmove(word + locat[0],
+ value,
+ ft_strlen(value) * sizeof(char));
}
}