summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/d_define.h1
-rw-r--r--src/m_prompt.c11
2 files changed, 9 insertions, 3 deletions
diff --git a/src/d_define.h b/src/d_define.h
index 50b0f3c..6d3cc45 100644
--- a/src/d_define.h
+++ b/src/d_define.h
@@ -67,6 +67,7 @@
*/
#define C_NUL 0x00
+#define C_LF 0x0a
#define C_SUB 0x1a
#define C_ESC 0x1b
#define C_DQUOTE 0x22
diff --git a/src/m_prompt.c b/src/m_prompt.c
index 2d88088..ff491c8 100644
--- a/src/m_prompt.c
+++ b/src/m_prompt.c
@@ -34,9 +34,14 @@ static char
{
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);
+ (void)ft_memmove(var + i, var + i + 3, ft_strlen(var + i + 3) + 1);
var[i] = C_ESC;
}
+ else if (var[i + 1] == 'n')
+ {
+ (void)ft_memmove(var + i, var + i + 1, ft_strlen(var + i + 1) + 1);
+ var[i] = C_LF;
+ }
else if (var[i + 1] == 'w')
{
u_get_var_value(tmp, "$PWD", PATH_MAX, msh);
@@ -65,9 +70,9 @@ static char
ft_strsubst_s(var, "\\w", "?");
}
else if (var[i + 1] == 'v')
- var = ft_strsubst(var, "\\v", FT_MSH_VERSION);
+ ft_strsubst_s(var, "\\v", FT_MSH_VERSION);
else if (var[i + 1] == 's')
- var = ft_strsubst(var, "\\s", FT_PROGNAME);
+ ft_strsubst_s(var, "\\s", FT_PROGNAME);
}
i++;
}