From e15ab68b09173e01f0f3e173e5a1c89628936b03 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Sat, 15 Aug 2020 17:28:10 +0200 Subject: Now deletes comments --- src/p_line.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src') 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); -- cgit v1.2.3