diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-07-30 19:17:05 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-07-30 19:17:05 +0200 |
commit | ced3be528b52b59ad613f282e37d653c16ef85d9 (patch) | |
tree | c50b34c0d8937dd402e7d7e5ba14cb5ad77a87f8 /src/u_vars.c | |
parent | Removed todo (diff) | |
download | 42-minishell-ced3be528b52b59ad613f282e37d653c16ef85d9.tar.gz 42-minishell-ced3be528b52b59ad613f282e37d653c16ef85d9.tar.bz2 42-minishell-ced3be528b52b59ad613f282e37d653c16ef85d9.tar.xz 42-minishell-ced3be528b52b59ad613f282e37d653c16ef85d9.tar.zst 42-minishell-ced3be528b52b59ad613f282e37d653c16ef85d9.zip |
I'm retarded
Diffstat (limited to 'src/u_vars.c')
-rw-r--r-- | src/u_vars.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/u_vars.c b/src/u_vars.c index fafc2fa..9978df5 100644 --- a/src/u_vars.c +++ b/src/u_vars.c @@ -20,7 +20,6 @@ #include "s_lcom.h" #include "s_struct.h" - static char *set_rva(const char varname[], t_msh *msh) @@ -117,9 +116,24 @@ static char *get_cstm_vr(const char varname[], t_msh *msh) { - (void)varname; - (void)msh; - return (NULL); + t_lvars *ptr; + char *varval; + + ptr = msh->vars; + while (ptr != NULL && + ft_strncmp(varname + 1, ptr->name, ft_strlen(varname + 1)) != 0) + { + ptr = ptr->next; + } + if (ptr != NULL) + { + varval = ft_strdup(ptr->val); + return (varval); + } + else + { + return (NULL); + } } /* |