summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/m_loop.c2
-rw-r--r--src/p_lblock.c (renamed from src/p_lcom.c)0
-rw-r--r--src/p_lblock.h (renamed from src/p_lcom.h)0
-rw-r--r--src/p_lblock_next.c (renamed from src/p_lcom_next.c)0
-rw-r--r--src/p_lblock_next.h (renamed from src/p_lcom_next.h)0
-rw-r--r--src/p_line.c2
-rw-r--r--src/s_init.c2
-rw-r--r--src/s_struct.h73
8 files changed, 41 insertions, 38 deletions
diff --git a/src/m_loop.c b/src/m_loop.c
index 7dc19e0..9d00f2b 100644
--- a/src/m_loop.c
+++ b/src/m_loop.c
@@ -87,7 +87,7 @@ uint8_t
if (fd == STDIN_FILENO)
m_prompt_psx(1, msh);
gnl = get_next_line(fd, &line);
- if (line[0] != '\0')
+ if (line[0] != C_NUL)
{
line = m_check_multi_backslash(fd, line, msh);
line = m_check_multi_pipe(fd, line, msh);
diff --git a/src/p_lcom.c b/src/p_lblock.c
index a8c42ce..a8c42ce 100644
--- a/src/p_lcom.c
+++ b/src/p_lblock.c
diff --git a/src/p_lcom.h b/src/p_lblock.h
index 796c684..796c684 100644
--- a/src/p_lcom.h
+++ b/src/p_lblock.h
diff --git a/src/p_lcom_next.c b/src/p_lblock_next.c
index 16d8aac..16d8aac 100644
--- a/src/p_lcom_next.c
+++ b/src/p_lblock_next.c
diff --git a/src/p_lcom_next.h b/src/p_lblock_next.h
index 8fbbb99..8fbbb99 100644
--- a/src/p_lcom_next.h
+++ b/src/p_lblock_next.h
diff --git a/src/p_line.c b/src/p_line.c
index 170d8a8..645c7b6 100644
--- a/src/p_line.c
+++ b/src/p_line.c
@@ -67,7 +67,7 @@ void
{
return ;
}
- if (p_lcom(line, msh) < 0)
+ if (p_line_block(line, msh) < 0)
{
f_alloc_and_destroy_msh(msh);
}
diff --git a/src/s_init.c b/src/s_init.c
index 9ef856f..cfe2eeb 100644
--- a/src/s_init.c
+++ b/src/s_init.c
@@ -174,6 +174,8 @@ t_msh
msh->ret = 0;
init_buptr(msh);
msh->curr = NULL;
+ msh->com = NULL;
+ msh->pipes = NULL;
msh->vars = NULL;
set_cwd(cwd, msh);
if ((msh->cwd = ft_strdup(cwd)) == NULL)
diff --git a/src/s_struct.h b/src/s_struct.h
index 1089dc6..f98f948 100644
--- a/src/s_struct.h
+++ b/src/s_struct.h
@@ -26,27 +26,27 @@
** 0: means no redirection
*/
-typedef struct s_lvars
+typedef struct s_lvars
{
- struct s_lvars *next;
- char *name;
- char *val;
-} t_lvars;
+ struct s_lvars *next;
+ char *name;
+ char *val;
+} t_lvars;
-typedef struct s_com
+typedef struct s_com
{
- char **argv;
- char **env_fork;
- char *rdrpath;
- char *bin;
- int32_t rdrfd;
- int8_t redir;
-} t_com;
+ char **argv;
+ char **env_fork;
+ char *rdrpath;
+ char *bin;
+ int32_t rdrfd;
+ int8_t redir;
+} t_com;
-struct s_lpipes
+struct s_lpipes
{
- struct s_com *com;
- struct s_lpipes *next;
+ struct s_com *com;
+ struct s_lpipes *next;
};
/*
@@ -57,28 +57,29 @@ struct s_lpipes
** 2: ||
*/
-typedef struct s_line
+typedef struct s_line
{
- struct s_com *com;
- struct s_lpipes *pipes;
- uint8_t nextif;
- struct s_line *next;
-} t_line;
+ char line[4096];
+ uint8_t nextif;
+ struct s_line_block *next;
+} t_line;
-typedef struct s_msh
+typedef struct s_msh
{
- struct s_line *curr;
- struct s_lvars *vars;
- char **envp;
- char **bu_ref;
- char ps[4][1024];
- char env_fork_tmp[128][1024];
- char sqb_ref[FT_ID_SQB_COUNT][4];
- char *shname;
- char *cwd;
- int32_t fd;
- uint8_t (*bu_ptr[FT_BUILTINS_COUNT])(char **, struct s_msh*);
- uint8_t ret;
-} t_msh;
+ struct s_line_block *curr;
+ struct s_com *com;
+ struct s_lpipes *pipes;
+ struct s_lvars *vars;
+ char **envp;
+ char **bu_ref;
+ char ps[4][1024];
+ char env_fork_tmp[128][1024];
+ char sqb_ref[FT_ID_SQB_COUNT][4];
+ char *shname;
+ char *cwd;
+ int32_t fd;
+ uint8_t (*bu_ptr[FT_BUILTINS_COUNT])(char **, struct s_msh*);
+ uint8_t ret;
+} t_msh;
#endif