summaryrefslogtreecommitdiffstats
path: root/src/m_prompt.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-09-10 19:28:08 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-09-10 19:28:08 +0200
commit20b9a703186d7bf06936467ae3e8108cfbee43dd (patch)
tree0a183595d7f5f0ec1ae1d4364c4d7118f7f33231 /src/m_prompt.c
parentRemoved debug printf (diff)
download42-minishell-20b9a703186d7bf06936467ae3e8108cfbee43dd.tar.gz
42-minishell-20b9a703186d7bf06936467ae3e8108cfbee43dd.tar.bz2
42-minishell-20b9a703186d7bf06936467ae3e8108cfbee43dd.tar.xz
42-minishell-20b9a703186d7bf06936467ae3e8108cfbee43dd.tar.zst
42-minishell-20b9a703186d7bf06936467ae3e8108cfbee43dd.zip
I was born an idiot I swear
Diffstat (limited to '')
-rw-r--r--src/m_prompt.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/m_prompt.c b/src/m_prompt.c
index d0269e4..dc17939 100644
--- a/src/m_prompt.c
+++ b/src/m_prompt.c
@@ -24,15 +24,21 @@ static char
*m_subst_prompt_rice(char var[], t_msh *msh)
{
char tmp[PATH_MAX];
+ char *ptr;
size_t i;
size_t j;
i = 0;
- while (var[i] != '\0')
+ while (var[i] != C_NUL)
{
- if (var[i] == '\\')
+ if (var[i] == C_BACKS)
{
- if (var[i + 1] == 'w')
+ if (var[i + 1] == '0' && var[i + 2] == '3' && var[i + 3] == '3')
+ {
+ ft_memmove(var + i, var + i + 3, ft_strlen(var + i + 3) + 1);
+ var[i] = C_ESC;
+ }
+ else if (var[i + 1] == 'w')
{
u_get_var_value(tmp, "$PWD", PATH_MAX, msh);
if (tmp[0] != C_NUL)