diff options
| author | Christopher Uhlig | 2025-01-22 02:40:27 +0100 |
|---|---|---|
| committer | Christopher Uhlig | 2025-01-22 02:40:27 +0100 |
| commit | f6e474d27a1398c6d4f2e88c7f2d3797b85217da (patch) | |
| tree | 7dd7bd5f2a151b39498991b567ae51cff8242782 /src/env.c | |
| parent | 78dc50a2bce3c6e31405437189e2990d8fc720ac (diff) | |
| download | minishell-f6e474d27a1398c6d4f2e88c7f2d3797b85217da.tar.gz minishell-f6e474d27a1398c6d4f2e88c7f2d3797b85217da.zip | |
kinda fix for pipe error and again.vs for you db just chnage workfolder gn
Diffstat (limited to 'src/env.c')
| -rw-r--r-- | src/env.c | 25 |
1 files changed, 22 insertions, 3 deletions
@@ -6,11 +6,12 @@ /* By: chuhlig <chuhlig@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/10/17 14:31:07 by chuhlig #+# #+# */ -/* Updated: 2024/12/17 19:36:14 by chuhlig ### ########.fr */ +/* Updated: 2025/01/20 19:12:43 by chuhlig ### ########.fr */ /* */ /* ************************************************************************** */ #include "env.h" +#include "minishell.h" #include <stdlib.h> void getenvlst(t_env **env, char **en) @@ -54,9 +55,27 @@ char *env_get(t_env *env, char *name) { while (env != NULL) { - if (!ft_strncmp(env->name, name, ft_strlen(name))) + if (!ft_strncmp(env->name, name, ft_strlen(env->name))) return (env->value); env = env->next; } return (NULL); -}
\ No newline at end of file +} + +t_env *env_new(char *name) +{ + t_env *result; + + result = malloc(sizeof(t_env)); + if (!result) + return (NULL); + result->name = name; + return (result); +} + +void free_env_node(t_env *node) +{ + free(node->name); + free(node->value); + free(node); +} |
