aboutsummaryrefslogtreecommitdiff
path: root/include/minishell.h
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-02-28 09:41:52 +0100
committerCharles <sircharlesaze@gmail.com>2020-02-28 12:38:58 +0100
commitcc1b57c96cc8c0fdd53e781b54a83bb9c743179a (patch)
treeb58d43c6fc5b3b57cdeb28f9a21f421d3400196c /include/minishell.h
parent83e7d63bc9c2d4a246df3cc8555127f3b956f960 (diff)
downloadminishell-cc1b57c96cc8c0fdd53e781b54a83bb9c743179a.tar.gz
minishell-cc1b57c96cc8c0fdd53e781b54a83bb9c743179a.tar.bz2
minishell-cc1b57c96cc8c0fdd53e781b54a83bb9c743179a.zip
Added environment and state
Also dummy files eval.c parse.c
Diffstat (limited to 'include/minishell.h')
-rw-r--r--include/minishell.h65
1 files changed, 27 insertions, 38 deletions
diff --git a/include/minishell.h b/include/minishell.h
index cc28e10..5e27ffa 100644
--- a/include/minishell.h
+++ b/include/minishell.h
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/26 15:33:51 by cacharle #+# #+# */
-/* Updated: 2020/02/27 18:07:06 by cacharle ### ########.fr */
+/* Updated: 2020/02/28 12:34:21 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -27,58 +27,39 @@
# include "libft_lst.h"
# include "libft_util.h"
-typedef int t_status;
+# include "ms_parse.h"
-typedef enum
-{
- REDIRECTION_OUT,
- REDIRECTION_IN,
- REDIRECTION_APPEND
-} t_redirection_type;
+# define MS_PATH_KEY "PATH"
typedef struct
{
- char *filename;
- t_redirection_type type;
-} t_redirection;
+ t_ftht *commands;
+ t_ftlst *dirs;
+} t_path;
typedef struct
{
- char *name;
- char **argv;
- t_ftlst *redirections;
-} t_command;
+ t_path *path;
+ t_ftht *environment;
+} t_state;
-typedef enum
-{
- SEPARATOR_SEMICOLON,
- SEPARATOR_PIPE,
- SEPARATOR_AND,
- SEPARATOR_OR,
-} t_separator;
+/*
+** state.c
+*/
-typedef struct
-{
- t_ftlst *commands;
- t_ftlst *separators;
-} t_parsing;
+int ms_state_init(t_state *state, const char **envp);
+void ms_state_destroy(t_state *state);
/*
-** parse/.c
+** eval.c
*/
-t_parsing *ms_parse(char *input);
+int ms_eval(t_parsing *parsing);
/*
** path.c
*/
-typedef struct
-{
- t_ftht *commands;
- t_ftlst *dirs;
-} t_path;
-
t_path *ms_path_update(t_path *path, const char *path_str);
void ms_path_destroy(t_path *path);
@@ -86,15 +67,17 @@ void ms_path_destroy(t_path *path);
** environment.c
*/
-// t_ftht *ms_environment_update(t_ftht *environment, char **envp);
-// char **ms_environment_(t_ftht *environment, char **envp);
+t_ftht *ms_environment_from_array(const char **envp);
+char **ms_environment_to_array(t_ftht *environment);
+// probably bloat
// void ms_environment_destroy(t_ftht *environment);
-
/*
** builtin*.c
*/
+typedef int t_status;
+
typedef t_status (*t_builtin_func)(int argc, char **argv, char **envp);
t_builtin_func ms_echo;
t_builtin_func ms_cd;
@@ -104,4 +87,10 @@ t_builtin_func ms_unset;
t_builtin_func ms_env;
t_builtin_func ms_exit;
+/*
+** util.c
+*/
+
+void ms_ht_del_str_entry(t_ftht_content *content);
+
#endif