aboutsummaryrefslogtreecommitdiff
path: root/src/lexer
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-09-14 15:44:33 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-09-14 15:44:33 +0200
commit7afd22aacdae5d88f560576fd7261801beb60739 (patch)
treef783f22e6866535ec9b09b0f4a65fbe06da7ba4c /src/lexer
parent5c5096d5c6d67686c1ad896cbb7a1b5386abf597 (diff)
downloadminishell-7afd22aacdae5d88f560576fd7261801beb60739.tar.gz
minishell-7afd22aacdae5d88f560576fd7261801beb60739.tar.bz2
minishell-7afd22aacdae5d88f560576fd7261801beb60739.zip
Refactoring redir and preprocess_filename to distiguish between command error and fatal error
Diffstat (limited to 'src/lexer')
-rw-r--r--src/lexer/trim.c9
-rw-r--r--src/lexer/utils.c6
2 files changed, 5 insertions, 10 deletions
diff --git a/src/lexer/trim.c b/src/lexer/trim.c
index 351ad36..a01e07e 100644
--- a/src/lexer/trim.c
+++ b/src/lexer/trim.c
@@ -6,7 +6,7 @@
/* By: nahaddac <nahaddac@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/16 08:18:36 by nahaddac #+# #+# */
-/* Updated: 2020/09/14 11:30:18 by nahaddac ### ########.fr */
+/* Updated: 2020/09/14 15:13:10 by charles ### ########.fr */
/* */
/* ************************************************************************** */
@@ -40,12 +40,7 @@ void del_quote(char *str)
{
while (str[i++] != '\0')
{
- if (str[i] == '\\' && str[i + 1] == '\'')
- {
- i++;
- break;
- }
- else if (str[i] == '\\')
+ if (str[i] == '\\')
i += 2;
if (str[i] == '\'')
break ;
diff --git a/src/lexer/utils.c b/src/lexer/utils.c
index d440de4..b4846d6 100644
--- a/src/lexer/utils.c
+++ b/src/lexer/utils.c
@@ -6,7 +6,7 @@
/* By: nahaddac <nahaddac@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/16 08:18:15 by nahaddac #+# #+# */
-/* Updated: 2020/09/14 11:38:18 by nahaddac ### ########.fr */
+/* Updated: 2020/09/14 15:16:35 by charles ### ########.fr */
/* */
/* ************************************************************************** */
@@ -97,8 +97,8 @@ int quote_len(char *input, int i)
i++;
while (input[i] != quote_type && input[i] != '\0')
{
- if(input[i] == '\\')
- i+=2;
+ if (quote_type == '"' && input[i] == '\\')
+ i++;
i++;
}
while (ft_isblank(input[i + 1]))