summaryrefslogtreecommitdiffstats
path: root/src/p_lcom_next.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-09-01 16:40:05 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-09-01 16:40:05 +0200
commit06217e697520e5c97393bc06b89fda073efa7ea6 (patch)
tree7f0c744900487395ffc36ed4185035876633bef3 /src/p_lcom_next.c
parentSecured malloc (diff)
download42-minishell-06217e697520e5c97393bc06b89fda073efa7ea6.tar.gz
42-minishell-06217e697520e5c97393bc06b89fda073efa7ea6.tar.bz2
42-minishell-06217e697520e5c97393bc06b89fda073efa7ea6.tar.xz
42-minishell-06217e697520e5c97393bc06b89fda073efa7ea6.tar.zst
42-minishell-06217e697520e5c97393bc06b89fda073efa7ea6.zip
Update
Diffstat (limited to '')
-rw-r--r--src/p_lcom_next.c47
1 files changed, 25 insertions, 22 deletions
diff --git a/src/p_lcom_next.c b/src/p_lcom_next.c
index b04d393..28ad821 100644
--- a/src/p_lcom_next.c
+++ b/src/p_lcom_next.c
@@ -76,29 +76,32 @@ char
int8_t redir)
{
char **words;
- char *subst;
- size_t i;
- if (redir == 0)
- {
- if (!(words = ft_split(word, ' ')))
- return (NULL);
- return (words);
- }
- i = 0;
- while (word[i] && ft_ischarset("<>", word[i]) == FALSE)
- i++;
- while (redir > 0 && ft_isdigit(word[i]) == TRUE)
- i--;
- if (!(subst = ft_substr(word, 0, i)))
- return (NULL);
- if (!(words = ft_split(subst, ' ')))
- {
- ft_memdel((void*)&subst);
- return (NULL);
- }
- ft_memdel((void*)&subst);
return (words);
+ /* char **words; */
+ /* char *subst; */
+ /* size_t i; */
+
+ /* if (redir == 0) */
+ /* { */
+ /* if (!(words = ft_split(word, ' '))) */
+ /* return (NULL); */
+ /* return (words); */
+ /* } */
+ /* i = 0; */
+ /* while (word[i] && ft_ischarset("<>", word[i]) == FALSE) */
+ /* i++; */
+ /* while (redir > 0 && ft_isdigit(word[i]) == TRUE) */
+ /* i--; */
+ /* if (!(subst = ft_substr(word, 0, i))) */
+ /* return (NULL); */
+ /* if (!(words = ft_split(subst, ' '))) */
+ /* { */
+ /* ft_memdel((void*)&subst); */
+ /* return (NULL); */
+ /* } */
+ /* ft_memdel((void*)&subst); */
+ /* return (words); */
}
char
@@ -184,7 +187,7 @@ static char
k = i;
while (i - k < j)
{
- if (!(rewords[i - k] = ft_strdup(words[i])))
+ if ((rewords[i - k] = ft_strdup(words[i])) == NULL)
{
ft_delwords(words);
f_alloc_and_destroy_msh(msh);