summaryrefslogtreecommitdiffstats
path: root/src/p_lblock.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/p_lblock.c (renamed from src/p_lcom.c)30
1 files changed, 13 insertions, 17 deletions
diff --git a/src/p_lcom.c b/src/p_lblock.c
index 13b4d11..377757d 100644
--- a/src/p_lcom.c
+++ b/src/p_lblock.c
@@ -1,7 +1,7 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
-/* p_lcom.c :+: :+: :+: */
+/* p_lblock.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
@@ -25,8 +25,7 @@
#include "s_struct.h"
static void
- rdr_err_check(char *ptr,
- t_com **com)
+ rdr_err_check(char *ptr, t_com **com)
{
if ((*com)->redir == -1 && ft_ischarset("><", *(ptr + 1)) == TRUE)
{
@@ -43,8 +42,7 @@ static void
}
static int8_t
- get_rdrpath(char *ptr,
- t_com **com)
+ get_rdrpath(char *ptr, t_com **com)
{
char *p_rdrpath;
@@ -86,8 +84,7 @@ static void
}
int8_t
- get_redir(const char word[],
- t_com **com)
+ p_get_redir(const char word[], t_com **com)
{
/* TODO: norme */
char *ptr;
@@ -124,25 +121,25 @@ int8_t
}
int8_t
- p_lcom(const char line[],
- t_msh *msh)
+ p_line_block(const char line[], t_msh *msh)
{
/* TODO: norme */
uint64_t i;
- t_line *link;
+ t_line_block *link;
char **words;
char *ptr;
uint8_t nextif;
t_bool next;
i = 0;
- if ((words = p_split_line(line)) == NULL)
+ nextif = 0;
+ if ((words = p_split_line((char*)line)) == NULL)
return (-1);
while (words[i] != NULL)
{
- if (words[i][ft_strlen(words[i]) - 1] == ';')
+ if (words[i][ft_strlen(words[i]) - 1] == '0')
nextif = 0;
- else if (words[i][ft_strlen(words[i]) - 1] == '&')
+ else if (words[i][ft_strlen(words[i]) - 1] == '1')
nextif = 1;
else
nextif = 2;
@@ -150,15 +147,14 @@ int8_t
next = FALSE;
if ((ptr = ft_strchr(words[i], '|')) != NULL)
{
- if ((link = s_line_new(NULL, msh)) == NULL)
+ if ((link = s_line_new(NULL, 0)) == NULL)
return (-1);
- if ((split_pipes(words[i], link, msh)) == NULL)
+ if ((s_split_pipes(words[i], msh)) == NULL)
return (-1);
next = TRUE;
}
- if (next == FALSE && (link = s_line_new(words[i], msh)) == NULL)
+ if (next == FALSE && (link = s_line_new(words[i], nextif)) == NULL)
return (-1);
- link->nextif = nextif;
s_line_add_back(&msh->curr, link);
i++;
}