aboutsummaryrefslogtreecommitdiff
path: root/include/minishell.h
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-02-26 16:16:38 +0100
committerCharles <sircharlesaze@gmail.com>2020-02-26 16:16:38 +0100
commit5e90ab4b33570dd14c96c8ed32e2477b788aa75c (patch)
tree711350531ecc92d4de945a03128bc06203688b5f /include/minishell.h
parent2a57d3b97fb27fb24deaa4da894b01e1957a528b (diff)
downloadminishell-5e90ab4b33570dd14c96c8ed32e2477b788aa75c.tar.gz
minishell-5e90ab4b33570dd14c96c8ed32e2477b788aa75c.tar.bz2
minishell-5e90ab4b33570dd14c96c8ed32e2477b788aa75c.zip
Added parsing API
Diffstat (limited to 'include/minishell.h')
-rw-r--r--include/minishell.h73
1 files changed, 61 insertions, 12 deletions
diff --git a/include/minishell.h b/include/minishell.h
index f47fc65..f273a6f 100644
--- a/include/minishell.h
+++ b/include/minishell.h
@@ -1,3 +1,15 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* minishell.h :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/02/26 15:33:51 by cacharle #+# #+# */
+/* Updated: 2020/02/26 16:10:56 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
#ifndef MINISHELL_H
# define MINISHELL_H
@@ -9,27 +21,64 @@ typedef struct
{
int argc;
char **argv;
-} t_command;
+} t_command;
+
+typedef int t_status;
+
+typedef enum
+{
+ REDIRECTION_OUT,
+ REDIRECTION_IN,
+ REDIRECTION_APPEND
+} t_redirection_type;
-// void find_exe(char *name);
+typedef struct
+{
+ char *filename;
+ t_redirection_type type;
+} t_redirection;
-typedef int t_status;
+typedef struct
+{
+ char *name;
+ char **argv;
+ t_ftlst *redirections;
+} t_command;
+
+// parsing steps
+// 1. interpolation des variable
+
+typedef enum
+{
+ SEPARATOR_SEMICOLON,
+ SEPARATOR_PIPE,
+ SEPARATOR_AND,
+ SEPARATOR_OR,
+} t_separator;
+
+typedef struct
+{
+ t_ftlst *commands;
+ t_ftlst *separators;
+} t_parsing;
/*
-**
+** parse/.c
*/
+t_parsing *ms_parse(char *input);
+
/*
** builtin*.c
*/
-typedef t_status (*t_builtin_func)(int argc, char **argv, char **envp);
-t_builtin_func ms_echo;
-t_builtin_func ms_cd;
-t_builtin_func ms_pwd;
-t_builtin_func ms_export;
-t_builtin_func ms_unset;
-t_builtin_func ms_env;
-t_builtin_func ms_exit;
+typedef t_status (*t_builtin_func)(int argc, char **argv, char **envp);
+t_builtin_func ms_echo;
+t_builtin_func ms_cd;
+t_builtin_func ms_pwd;
+t_builtin_func ms_export;
+t_builtin_func ms_unset;
+t_builtin_func ms_env;
+t_builtin_func ms_exit;
#endif