summaryrefslogtreecommitdiffstats
path: root/src/p_line.c
diff options
context:
space:
mode:
authorsalad <fmoenne-@student.le-101.fr>2020-10-26 13:42:56 +0100
committersalad <fmoenne-@student.le-101.fr>2020-10-26 13:42:56 +0100
commit0277ddfac754ab4ad5bdd2b692e31a717efbe569 (patch)
tree49d7c5fd3a12248af85e2c3a3254bc1538ae5775 /src/p_line.c
parentreqdy for MERGE (diff)
parentTODO update (diff)
download42-minishell-0277ddfac754ab4ad5bdd2b692e31a717efbe569.tar.gz
42-minishell-0277ddfac754ab4ad5bdd2b692e31a717efbe569.tar.bz2
42-minishell-0277ddfac754ab4ad5bdd2b692e31a717efbe569.tar.xz
42-minishell-0277ddfac754ab4ad5bdd2b692e31a717efbe569.tar.zst
42-minishell-0277ddfac754ab4ad5bdd2b692e31a717efbe569.zip
merge wif master
Diffstat (limited to '')
-rw-r--r--src/p_line.c28
1 files changed, 5 insertions, 23 deletions
diff --git a/src/p_line.c b/src/p_line.c
index 8b13424..c8381c8 100644
--- a/src/p_line.c
+++ b/src/p_line.c
@@ -16,26 +16,10 @@
#include "d_enum.h"
#include "f_fail.h"
#include "p_line.h"
-#include "p_lcom.h"
+#include "p_lblock.h"
#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++;
- }
-}
+#include "u_utils.h"
static t_bool
p_check_whitespaces_only(char line[])
@@ -45,7 +29,7 @@ static t_bool
ptr = line;
while (*ptr != '\0')
{
- if (*ptr != ' ' && *ptr != '\t')
+ if (ft_iswhitespace(*ptr) == FALSE)
{
return (FALSE);
}
@@ -55,15 +39,13 @@ static t_bool
}
void
- p_line(char line[],
- t_msh *msh)
+ p_line(char line[], t_msh *msh)
{
- p_delete_comments(line);
if (p_check_whitespaces_only(line) == TRUE)
{
return ;
}
- if (p_lcom(line, msh) < 0)
+ if (p_line_block(line, msh) < 0)
{
f_alloc_and_destroy_msh(msh);
}