mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
46 lines
1.7 KiB
C
46 lines
1.7 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* env_manip.h :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: jguelen <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2025/02/14 13:46:39 by jguelen #+# #+# */
|
|
/* Updated: 2025/02/19 13:08:58 by khais ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#ifndef ENV_MANIP_H
|
|
# define ENV_MANIP_H
|
|
|
|
# include <stdlib.h>
|
|
# include <stdbool.h>
|
|
# include "libft.h"
|
|
|
|
typedef struct s_env
|
|
{
|
|
char *key;
|
|
char *value;
|
|
struct s_env *next;
|
|
} t_env;
|
|
|
|
char *envp_get_key(char *line);
|
|
char *envp_get_val(char *line);
|
|
char *env_get_val(t_env *env, char *key);
|
|
size_t env_get_size(t_env *env);
|
|
/**/
|
|
void env_rm_entry(t_env **env, char *key);
|
|
/*WARNING: env_set_entry does NOT check for the actual validity of an
|
|
identifier (i.e. key) in the sense that it does not check what characters
|
|
compose it.*/
|
|
t_env *env_set_entry(t_env **env, char *key, char *value);
|
|
char **envp_from_env(t_env *env);
|
|
t_env *env_from_envp(char **envp);
|
|
/*env_manip_utils*/
|
|
void env_destroy_node(t_env *node);
|
|
void env_destroy(t_env *env);
|
|
void envp_destroy(char **envp);
|
|
t_env *env_find_node_bykey(t_env *env, char *key);
|
|
bool identifier_isvalid(char *id);
|
|
|
|
#endif
|