summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Makefile2
-rw-r--r--src/ft_d_enum.h2
-rw-r--r--src/ft_s_destroy.c4
-rw-r--r--src/ft_s_destroy.h2
-rw-r--r--src/ft_s_init.c12
-rw-r--r--src/ft_s_init.h2
-rw-r--r--src/ft_s_struct.h14
-rw-r--r--src/minishell.c28
-rw-r--r--src/minishell.h4
9 files changed, 40 insertions, 30 deletions
diff --git a/Makefile b/Makefile
index 3196174..de7c82c 100644
--- a/Makefile
+++ b/Makefile
@@ -61,7 +61,7 @@ ${OBJS_DIR}%.o: ${SRCS_DIR}%.c ${INCS}
@${MKDIR} ${OBJS_DIR}
${CC} -c ${CFLAGS} ${CDEFS} -I${SRCS_DIR} -I${LFT_INCS_DIR} -o $@ $<
#------------------------------------------------------------------------------#
-${NAME}: ${OBJS} ${LFT_SRCS} ${LFT_INCS_DIR}libft.h
+$(NAME): ${OBJS} ${LFT_SRCS} ${LFT_INCS_DIR}libft.h
@$(MAKE) --no-print-directory -C ${LFT_DIR} ${LFTRULE}
${CC} ${CFLAGS} -o ${NAME} ${OBJS} ${LDFLAGS}
#------------------------------------------------------------------------------#
diff --git a/src/ft_d_enum.h b/src/ft_d_enum.h
index ef276c8..c34f296 100644
--- a/src/ft_d_enum.h
+++ b/src/ft_d_enum.h
@@ -24,6 +24,6 @@ enum
{
FT_RET_FINE,
FT_RET_ALLOC
-}
+};
#endif
diff --git a/src/ft_s_destroy.c b/src/ft_s_destroy.c
index ffb8381..ef132ce 100644
--- a/src/ft_s_destroy.c
+++ b/src/ft_s_destroy.c
@@ -14,7 +14,7 @@
#include "ft_s_destroy.h"
void
-ft_s_destroy(t_data *data)
+ft_s_destroy(t_msh *msh)
{
- ft_memdel((void*)&data);
+ ft_memdel((void*)&msh);
}
diff --git a/src/ft_s_destroy.h b/src/ft_s_destroy.h
index 0d6d030..68a5c09 100644
--- a/src/ft_s_destroy.h
+++ b/src/ft_s_destroy.h
@@ -15,6 +15,6 @@
#include "ft_s_struct.h"
-void ft_s_destroy(t_data *data);
+void ft_s_destroy(t_msh *msh);
#endif
diff --git a/src/ft_s_init.c b/src/ft_s_init.c
index 82293be..103725b 100644
--- a/src/ft_s_init.c
+++ b/src/ft_s_init.c
@@ -12,14 +12,16 @@
#include <ft_s_init.h>
-t_data
-*ft_init_data(void)
+t_msh
+*ft_init_msh(void)
{
- t_data *data;
+ t_msh *msh;
- if (!(data = (t_data*)malloc(sizeof(t_data))))
+ if (!(msh = (t_msh*)malloc(sizeof(t_msh))))
{
return (NULL);
}
- return (data);
+ msh->envp = NULL;
+ msh->lcom = NULL;
+ return (msh);
}
diff --git a/src/ft_s_init.h b/src/ft_s_init.h
index 8297a5e..a941a80 100644
--- a/src/ft_s_init.h
+++ b/src/ft_s_init.h
@@ -16,6 +16,6 @@
#include <ft_s_struct.h>
#include <stdlib.h>
-t_data *ft_init_data(void);
+t_msh *ft_init_msh(void);
#endif
diff --git a/src/ft_s_struct.h b/src/ft_s_struct.h
index 3d3d8a7..e2150eb 100644
--- a/src/ft_s_struct.h
+++ b/src/ft_s_struct.h
@@ -13,9 +13,17 @@
#ifndef FT_S_STRUCT_H
#define FT_S_STRUCT_H
-typedef struct s_data
+typedef struct s_com
{
- char **envp;
-} t_data;
+ char *com;
+ char **args;
+ struct s_com *next;
+} t_com;
+
+typedef struct s_msh
+{
+ struct s_com *lcom;
+ char **envp;
+} t_msh;
#endif
diff --git a/src/minishell.c b/src/minishell.c
index cd08a64..cc0798f 100644
--- a/src/minishell.c
+++ b/src/minishell.c
@@ -12,29 +12,32 @@
#include <libft.h>
#include "minishell.h"
+#include "ft_d_enum.h"
+#include "ft_s_struct.h"
+#include "ft_s_init.h"
+#include "ft_s_destroy.h"
int
main(int argc,
const char *argv[],
char *envp[])
{
- t_data *data;
+ t_msh *msh;
(void)argc;
(void)argv;
- (void)envp;
- if (!(data = ft_init_data()))
+ if (!(msh = ft_init_msh()))
{
- return (1);
+ return (FT_RET_ALLOC);
}
- data->envp = envp;
- while (*data->envp)
+ msh->envp = envp;
+ while (*msh->envp)
{
- ft_printf("%s\n", *data->envp);
- data->envp++;
+ ft_printf("%s\n", *msh->envp);
+ msh->envp++;
}
- ft_s_destroy(data);
- return (0);
+ ft_s_destroy(msh);
+ return (FT_RET_FINE);
}
/*
@@ -42,8 +45,9 @@ main(int argc,
** Files prefixes info
** -------------------
** ft_ -> 42
-** s_ -> structs related
+** b_ -> builtins related
** d_ -> defines related
-** p_ -> parse related
** e_ -> exec related
+** p_ -> parse related
+** s_ -> structs related
*/
diff --git a/src/minishell.h b/src/minishell.h
index 5e50303..a30d8bc 100644
--- a/src/minishell.h
+++ b/src/minishell.h
@@ -13,8 +13,4 @@
#ifndef MINISHELL_H
#define MINISHELL_H
-#include "ft_s_struct.h"
-#include "ft_s_init.h"
-#include "ft_s_destroy.h"
-
#endif