summaryrefslogtreecommitdiffstats
path: root/src/s_lcom.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/s_lcom.c (renamed from src/ft_s_lcom.c)34
1 files changed, 16 insertions, 18 deletions
diff --git a/src/ft_s_lcom.c b/src/s_lcom.c
index d56ba7f..f1ef2a4 100644
--- a/src/ft_s_lcom.c
+++ b/src/s_lcom.c
@@ -1,7 +1,7 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
-/* ft_s_lcom.c :+: :+: :+: */
+/* s_lcom.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
@@ -14,12 +14,12 @@
#include <stdlib.h>
#include <stdint.h>
-#include "ft_p_lcom.h"
-#include "ft_p_lcom_next.h"
-#include "ft_s_struct.h"
+#include "p_lcom.h"
+#include "p_lcom_next.h"
+#include "s_struct.h"
static int8_t
- ft_fill_lcom(char *words[],
+ fill_lcom(char *words[],
t_lcom **lcom)
{
/* TODO: norme */
@@ -49,11 +49,8 @@ static int8_t
j = 0;
while (i > 0 && j < i)
{
- if (!((*lcom)->argv[j] =
- (char*)malloc((ft_strlen(words[j]) + 1) * sizeof(char))))
+ if (!((*lcom)->argv[j] = ft_strdup(words[j])))
return (-1);
- ft_strlcpy((*lcom)->argv[j], words[j],
- ft_strlen(words[j]) + 1);
j++;
}
(*lcom)->argv[j] = 0;
@@ -61,7 +58,7 @@ static int8_t
}
t_lcom
- *ft_lcom_last(t_lcom *lcom)
+ *lcom_last(t_lcom *lcom)
{
while (lcom->next != NULL)
lcom = lcom->next;
@@ -69,7 +66,7 @@ t_lcom
}
void
- ft_lcom_add_back(t_lcom **alcom,
+ lcom_add_back(t_lcom **alcom,
t_lcom *new)
{
t_lcom *tmp;
@@ -78,13 +75,13 @@ void
*alcom = new;
else
{
- tmp = ft_lcom_last(*alcom);
+ tmp = lcom_last(*alcom);
tmp->next = new;
}
}
void
- ft_lcom_clear(t_lcom **lcom)
+ lcom_clear(t_lcom **lcom)
{
t_lcom *tmp;
t_lcom *renext;
@@ -107,7 +104,7 @@ void
}
t_lcom
- *ft_lcom_new(const char word[],
+ *lcom_new(const char word[],
t_msh *msh)
{
/* TODO: norme */
@@ -128,13 +125,14 @@ t_lcom
return (link);
}
link->pipes = NULL;
- if (ft_get_redir(word, &link) != 0)
+ if (get_redir(word, &link) != 0)
return (NULL);
- if (!(words = ft_subst_args(word, link->redir)))
+ if (!(words = p_subst_args(word, link->redir)))
return (NULL);
- if (!(words = ft_subst_vars(words, msh)))
+ if (!(words = p_subst_vars(words, msh)))
return (NULL);
- if (ft_fill_lcom(words, &link) < 0)
+ words = p_check_args_equals(words, msh);
+ if (fill_lcom(words, &link) < 0)
{
ft_delwords(words);
return (NULL);