summaryrefslogtreecommitdiffstats
path: root/src/p_line.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-09-08 18:31:51 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-09-08 18:31:51 +0200
commitd0038f19a7cb23749588b72c9febcf114d9d31e9 (patch)
treee7daa5c0058d7d293d1d93fe9068d5ad59afcabe /src/p_line.c
parentIn progress (diff)
download42-minishell-d0038f19a7cb23749588b72c9febcf114d9d31e9.tar.gz
42-minishell-d0038f19a7cb23749588b72c9febcf114d9d31e9.tar.bz2
42-minishell-d0038f19a7cb23749588b72c9febcf114d9d31e9.tar.xz
42-minishell-d0038f19a7cb23749588b72c9febcf114d9d31e9.tar.zst
42-minishell-d0038f19a7cb23749588b72c9febcf114d9d31e9.zip
static hist, words fix
Diffstat (limited to '')
-rw-r--r--src/p_line.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/p_line.c b/src/p_line.c
index 9c96610..170d8a8 100644
--- a/src/p_line.c
+++ b/src/p_line.c
@@ -19,6 +19,7 @@
#include "p_lcom.h"
#include "s_destroy.h"
#include "s_struct.h"
+#include "u_utils.h"
static void
p_delete_comments(char line[])
@@ -30,8 +31,11 @@ static void
{
if (*ptr == '#')
{
- *ptr = '\0';
- return ;
+ if ((ptr - line) == 0 || ft_iswhitespace(*(ptr - 1)) == TRUE)
+ {
+ *ptr = '\0';
+ return ;
+ }
}
ptr++;
}