Added env hashmap with build_env function to build envp

This commit is contained in:
Maix0 2024-05-04 19:21:56 +02:00
parent f35e986145
commit f86947a852
54 changed files with 2010 additions and 105 deletions

31
includes/app/env.h Normal file
View file

@ -0,0 +1,31 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* env.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/04 18:41:01 by maiboyer #+# #+# */
/* Updated: 2024/05/04 19:08:13 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef ENV_H
#define ENV_H
#include "me/buffered_str/buf_str.h"
#include "me/hashmap/hashmap_env.h"
#include "me/types.h"
#include "me/vec/vec_str.h"
t_hashmap_env *create_env_map(void);
t_error build_envp(t_hashmap_env *envs, t_vec_str *out);
struct s_build_envp_state
{
t_vec_str out;
t_buffer_str buf;
};
#endif /* ENV_H */

View file

@ -0,0 +1,22 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* handle_expension.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/03 15:24:56 by maiboyer #+# #+# */
/* Updated: 2024/05/03 15:25:18 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef HANDLE_EXPENSION_H
#define HANDLE_EXPENSION_H
#include "app/node.h"
#include "app/state.h"
#include "me/types.h"
t_error handle_expension(t_node *self, t_utils *shcat, t_str *ret);
#endif /* HANDLE_EXPENSION_H */

View file

@ -6,7 +6,7 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/02 15:49:56 by maiboyer #+# #+# */
/* Updated: 2024/05/02 15:51:38 by maiboyer ### ########.fr */
/* Updated: 2024/05/04 18:40:53 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
@ -14,6 +14,7 @@
#define STATE_H
#include "app/node.h"
#include "me/hashmap/hashmap_env.h"
#include "me/types.h"
typedef struct s_parser
@ -23,13 +24,13 @@ typedef struct s_parser
typedef struct s_utils
{
t_str name_shell;
t_str str_input;
t_str *strs_input;
t_str *path;
t_str *envp;
t_parser parser;
t_node current_node;
t_str name_shell;
t_str str_input;
t_str *strs_input;
t_str *path;
t_parser parser;
t_hashmap_env *env;
t_node current_node;
} t_utils;
#endif /* STATE_H */

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/28 14:41:15 by rparodi #+# #+# */
/* Updated: 2024/05/02 15:51:57 by maiboyer ### ########.fr */
/* Updated: 2024/05/03 15:22:24 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
@ -18,10 +18,10 @@
#include "me/types.h"
#include <fcntl.h>
#include <stdio.h>
#include <readline/history.h>
#include <readline/readline.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>