summaryrefslogtreecommitdiffstats
path: root/src/p_line.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-08-28 14:25:49 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-08-28 14:25:49 +0200
commit9e901f1070ac4a3b709c62472c8874b2ad2e120d (patch)
treeacc9ae3a49b8c3af1c82cb71808469475c48ba6e /src/p_line.c
parentHistfile TODOed (diff)
download42-minishell-9e901f1070ac4a3b709c62472c8874b2ad2e120d.tar.gz
42-minishell-9e901f1070ac4a3b709c62472c8874b2ad2e120d.tar.bz2
42-minishell-9e901f1070ac4a3b709c62472c8874b2ad2e120d.tar.xz
42-minishell-9e901f1070ac4a3b709c62472c8874b2ad2e120d.tar.zst
42-minishell-9e901f1070ac4a3b709c62472c8874b2ad2e120d.zip
Quick tabs fix
Diffstat (limited to '')
-rw-r--r--src/p_line.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/p_line.c b/src/p_line.c
index 8b13424..ec148e3 100644
--- a/src/p_line.c
+++ b/src/p_line.c
@@ -37,6 +37,22 @@ static void
}
}
+static void
+ p_subst_spaces(char line[])
+{
+ char *ptr;
+
+ ptr = line;
+ while (*ptr != '\0')
+ {
+ if (ft_isspace(*ptr) == TRUE)
+ {
+ *ptr = ' ';
+ }
+ ptr++;
+ }
+}
+
static t_bool
p_check_whitespaces_only(char line[])
{
@@ -45,7 +61,7 @@ static t_bool
ptr = line;
while (*ptr != '\0')
{
- if (*ptr != ' ' && *ptr != '\t')
+ if (ft_isspace(*ptr) == FALSE)
{
return (FALSE);
}
@@ -59,6 +75,7 @@ void
t_msh *msh)
{
p_delete_comments(line);
+ p_subst_spaces(line);
if (p_check_whitespaces_only(line) == TRUE)
{
return ;