summaryrefslogtreecommitdiffstats
path: root/src/ft_u_utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ft_u_utils.c')
-rw-r--r--src/ft_u_utils.c50
1 files changed, 1 insertions, 49 deletions
diff --git a/src/ft_u_utils.c b/src/ft_u_utils.c
index 594f2c8..7e2eb53 100644
--- a/src/ft_u_utils.c
+++ b/src/ft_u_utils.c
@@ -14,11 +14,6 @@
#include <stdlib.h>
#include <stdint.h>
-#include "ft_f_fail.h"
-#include "ft_s_destroy.h"
-#include "ft_s_lcom.h"
-#include "ft_s_struct.h"
-
uint64_t
ft_get_argc(const char *args[])
{
@@ -41,6 +36,7 @@ char
ptr = envp;
while (*ptr)
{
+ /* TODO: rework this correctly */
if (ft_strncmp("HOME", *ptr, 4) == 0)
{
path = ft_substr(*ptr, 5, ft_strlen(*ptr + 5));
@@ -50,47 +46,3 @@ char
}
return (NULL);
}
-
-/*
-** char *
-** ft_subst_var_value(const char varname[], const t_msh *msh);
-**
-** DESCRIPTION
-** The ft_subst_var_value() function returns
-** a heap-allocated, null-terminated string
-** that may later be free'd containing the
-** value of the variable varname[] including
-** the '$' prefix. NULL is returned if varname[]
-** wasn't found.
-*/
-
-char
- *ft_subst_var_value(const char varname[],
- t_msh *msh)
-{
- char **p_env;
- char *varval;
-
- p_env = msh->envp;
- varval = NULL;
- while (*p_env)
- {
- if (!ft_strncmp(*p_env, varname + 1, ft_strlen(varname + 1) + 1))
- {
- ft_printf("(%s)\n", *p_env);
- while (**p_env != '\0' && **p_env != '=')
- **p_env += 1;
- if (**p_env == '=')
- **p_env += 1;
- if (!(varval = ft_strdup(*p_env)))
- {
- ft_lcom_clear(&msh->curr);
- ft_s_destroy(msh);
- ft_fail_alloc(msh);
- }
- return (varval);
- }
- p_env += 1;
- }
- return (NULL);
-}