From 9e901f1070ac4a3b709c62472c8874b2ad2e120d Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Fri, 28 Aug 2020 14:25:49 +0200 Subject: Quick tabs fix --- src/p_line.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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 ; -- cgit v1.2.3