diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-04-01 15:55:57 +0200 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-04-01 15:55:57 +0200 |
| commit | 2eb59ee61e49b60472f82c000dd4f3536bd1987c (patch) | |
| tree | 190ac7bc42051ee9fcc7c1d781be16afa4d43075 /include/minishell.h | |
| parent | 551e668e1b7a030fdff236067963100c7d8747a5 (diff) | |
| download | minishell-2eb59ee61e49b60472f82c000dd4f3536bd1987c.tar.gz minishell-2eb59ee61e49b60472f82c000dd4f3536bd1987c.tar.bz2 minishell-2eb59ee61e49b60472f82c000dd4f3536bd1987c.zip | |
Added builtin support in command eval, Refactoring eval/builtin function, Added doc
Diffstat (limited to 'include/minishell.h')
| -rw-r--r-- | include/minishell.h | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/include/minishell.h b/include/minishell.h index 4f33951..a3970dd 100644 --- a/include/minishell.h +++ b/include/minishell.h @@ -52,6 +52,8 @@ # define PIPE_READ 0 +# define BUILTIN_NOT_FOUND -2 + typedef t_ftht* t_path; typedef t_ftht* t_env; @@ -72,13 +74,33 @@ char **env_to_array(t_env env); ** builtin*.c - directory with all builtin commands */ -int builtin_echo(char **argv); -int builtin_cd(t_env env, char **argv); -int builtin_pwd(void); -int builtin_export(t_env env, char **argv); -int builtin_unset(t_env env, char **argv); -int builtin_env(t_env env); -int builtin_exit(void); +/** +** \brief Type of a builtin main function +*/ + +typedef int (*t_builtin_func)(char **argv, t_env env); + +/** +** \brief Entry of builtin lookup array +** \param name Executable name of builtin +** \param func Associated function +*/ + +struct s_builtin_entry +{ + char *name; + t_builtin_func func; +}; + +int builtin_dispatch_run(char **argv, t_env env); +bool builtin_check_exec_name(char *exec_name); +int builtin_echo(char **argv, t_env env); +int builtin_cd(char **argv, t_env env); +int builtin_pwd(char **argv, t_env env); +int builtin_export(char **argv, t_env env); +int builtin_unset(char **argv, t_env env); +int builtin_env(char **argv, t_env env); +int builtin_exit(char **argv, t_env env); /* ** util.c - various utilitary functions |
