[ADD] export builtin (unfinished)
This commit is contained in:
parent
f578b5311b
commit
532b4e959f
12 changed files with 199 additions and 66 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jschaft <cecile.schaft@orange.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/23 14:15:12 by mcolonna #+# #+# */
|
||||
/* Updated: 2024/06/28 11:52:13 by mcolonna ### ########.fr */
|
||||
/* Updated: 2024/06/28 14:25:50 by mcolonna ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -27,4 +27,7 @@ int echo_builtin(const char **argv);
|
|||
// Execute cd builtin
|
||||
int cd_builtin(t_env *env, t_call call);
|
||||
|
||||
// Execute export builtin
|
||||
int export_builtin(t_env *env, t_call call);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jschaft <cecile.schaft@orange.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/23 14:15:12 by mcolonna #+# #+# */
|
||||
/* Updated: 2024/06/13 16:39:07 by mcolonna ### ########.fr */
|
||||
/* Updated: 2024/06/28 14:01:25 by mcolonna ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -21,7 +21,6 @@ typedef struct s_env
|
|||
t_memclass mc_command; // open during the execution of a command
|
||||
int errorstatus; // Error status of the last executed command
|
||||
t_list *variables; // Shell variables
|
||||
char *const *envp; // Environment variables
|
||||
bool exit; // Set to true to exit minishell
|
||||
} t_env;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: mcolonna <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/06/27 13:43:21 by mcolonna #+# #+# */
|
||||
/* Updated: 2024/06/28 13:10:43 by mcolonna ### ########.fr */
|
||||
/* Updated: 2024/06/28 14:22:50 by mcolonna ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -17,6 +17,7 @@ typedef struct s_variable
|
|||
{
|
||||
const char *name;
|
||||
const char *value;
|
||||
bool exported;
|
||||
} t_variable;
|
||||
|
||||
// Set a variable to a new value.
|
||||
|
|
@ -26,4 +27,13 @@ void variables_set(t_list *variables, const char *name,
|
|||
// Get the value of a variable from its name.
|
||||
const char *variables_get(t_list *variables, const char *name);
|
||||
|
||||
// Set a variable as exported.
|
||||
void variables_export(t_list *variables, const char *name);
|
||||
|
||||
// Unset a variable.
|
||||
void variables_unset(t_list *variables, const char *name);
|
||||
|
||||
// Get a envp of all exported variables.
|
||||
char *const *variables_envp(t_list *variables, t_memclass mc);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue