summaryrefslogtreecommitdiffstats
path: root/src/p_line.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-08-15 17:28:10 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-08-15 17:28:10 +0200
commite15ab68b09173e01f0f3e173e5a1c89628936b03 (patch)
tree0faf2d0bffb230e4eebcdd4abf2103772b6f72ea /src/p_line.c
parentCleaner (diff)
download42-minishell-e15ab68b09173e01f0f3e173e5a1c89628936b03.tar.gz
42-minishell-e15ab68b09173e01f0f3e173e5a1c89628936b03.tar.bz2
42-minishell-e15ab68b09173e01f0f3e173e5a1c89628936b03.tar.xz
42-minishell-e15ab68b09173e01f0f3e173e5a1c89628936b03.tar.zst
42-minishell-e15ab68b09173e01f0f3e173e5a1c89628936b03.zip
Now deletes comments
Diffstat (limited to 'src/p_line.c')
-rw-r--r--src/p_line.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/p_line.c b/src/p_line.c
index 6e02525..af1ba64 100644
--- a/src/p_line.c
+++ b/src/p_line.c
@@ -20,10 +20,28 @@
#include "s_destroy.h"
#include "s_struct.h"
+static void
+ p_delete_comments(char line[])
+{
+ char *ptr;
+
+ ptr = line;
+ while (*ptr != '\0')
+ {
+ if (*ptr == '#')
+ {
+ *ptr = '\0';
+ return ;
+ }
+ ptr++;
+ }
+}
+
void
p_line(char line[],
t_msh *msh)
{
+ p_delete_comments(line);
if (p_lcom(line, msh) < 0)
{
f_alloc_and_destroy_msh(msh);