diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-08-01 19:00:37 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-08-01 19:00:37 +0200 |
commit | d04b1f10ac2da672383dd05e5d4065d2d7dd8c61 (patch) | |
tree | 874df03f98a0f5c9d97fb1dbe8d470587edd3982 | |
parent | Leak free (diff) | |
download | 42-minishell-d04b1f10ac2da672383dd05e5d4065d2d7dd8c61.tar.gz 42-minishell-d04b1f10ac2da672383dd05e5d4065d2d7dd8c61.tar.bz2 42-minishell-d04b1f10ac2da672383dd05e5d4065d2d7dd8c61.tar.xz 42-minishell-d04b1f10ac2da672383dd05e5d4065d2d7dd8c61.tar.zst 42-minishell-d04b1f10ac2da672383dd05e5d4065d2d7dd8c61.zip |
Opti
-rw-r--r-- | src/p_lcom_next.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/p_lcom_next.c b/src/p_lcom_next.c index f340294..b106032 100644 --- a/src/p_lcom_next.c +++ b/src/p_lcom_next.c @@ -133,11 +133,10 @@ static void } static char - **p_add_to_variables_and_delete( /* t_bool equals[], */ - char *words[], - t_bool reg, - int64_t i, - t_msh *msh) + **p_add_to_variables_and_delete(char *words[], + t_bool reg, + int64_t i, + t_msh *msh) { int64_t j; int64_t k; @@ -184,10 +183,12 @@ char { char *ptr; t_bool reg; + t_bool isvar; int64_t i; i = 0; reg = TRUE; + isvar = TRUE; while (words[i]) { ptr = words[i]; @@ -196,9 +197,13 @@ char if (*ptr == '\0' || words[i][0] == '=') { reg = FALSE; + if (i == 0) + isvar = FALSE; break ; } i++; } - return (p_add_to_variables_and_delete(/* equals, */words, reg, i, msh)); + if (isvar == TRUE) + return (p_add_to_variables_and_delete(words, reg, i, msh)); + return (words); } |