Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
yabtaour
GitHub Repository: yabtaour/Minishell-42
Path: blob/main/utils/ft_get_env.c
1407 views
1
/* ************************************************************************** */
2
/* */
3
/* ::: :::::::: */
4
/* ft_get_env.c :+: :+: :+: */
5
/* +:+ +:+ +:+ */
6
/* By: yabtaour <[email protected]> +#+ +:+ +#+ */
7
/* +#+#+#+#+#+ +#+ */
8
/* Created: 2022/07/26 18:17:34 by yabtaour #+# #+# */
9
/* Updated: 2022/07/27 20:36:02 by yabtaour ### ########.fr */
10
/* */
11
/* ************************************************************************** */
12
13
#include "../minishell.h"
14
15
char *ft_get_env(t_data *data, char *name)
16
{
17
t_env *env_clone;
18
19
env_clone = data->lst_env;
20
if (!name)
21
return (NULL);
22
while (env_clone)
23
{
24
if (ft_strcmp(name, env_clone->name) == 0)
25
return (env_clone->value);
26
env_clone = env_clone->next;
27
}
28
return (NULL);
29
}
30
31