summaryrefslogtreecommitdiffstats
path: root/src/p_line.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-08-15 18:00:23 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-08-15 18:00:23 +0200
commit56ccad6b85a5f3f17eebaf4ba511e07ba760b050 (patch)
treeb7073ccf7712baf52ee5c7792130029495249d3f /src/p_line.c
parentNow deletes comments (diff)
download42-minishell-56ccad6b85a5f3f17eebaf4ba511e07ba760b050.tar.gz
42-minishell-56ccad6b85a5f3f17eebaf4ba511e07ba760b050.tar.bz2
42-minishell-56ccad6b85a5f3f17eebaf4ba511e07ba760b050.tar.xz
42-minishell-56ccad6b85a5f3f17eebaf4ba511e07ba760b050.tar.zst
42-minishell-56ccad6b85a5f3f17eebaf4ba511e07ba760b050.zip
Can read scripts, but need to handle fails
Diffstat (limited to '')
-rw-r--r--src/p_line.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/p_line.c b/src/p_line.c
index af1ba64..8b13424 100644
--- a/src/p_line.c
+++ b/src/p_line.c
@@ -37,11 +37,32 @@ static void
}
}
+static t_bool
+ p_check_whitespaces_only(char line[])
+{
+ char *ptr;
+
+ ptr = line;
+ while (*ptr != '\0')
+ {
+ if (*ptr != ' ' && *ptr != '\t')
+ {
+ return (FALSE);
+ }
+ ptr++;
+ }
+ return (TRUE);
+}
+
void
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)
{
f_alloc_and_destroy_msh(msh);