summaryrefslogtreecommitdiffstats
path: root/src/u_vars.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/u_vars.c (renamed from src/ft_u_vars.c)62
1 files changed, 31 insertions, 31 deletions
diff --git a/src/ft_u_vars.c b/src/u_vars.c
index cb020e3..3f3a1a5 100644
--- a/src/ft_u_vars.c
+++ b/src/u_vars.c
@@ -1,7 +1,7 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
-/* ft_u_vars.c :+: :+: :+: */
+/* u_vars.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
@@ -14,24 +14,24 @@
#include <stdlib.h>
#include <stdint.h>
-#include "ft_d_define.h"
-#include "ft_f_fail.h"
-#include "ft_s_destroy.h"
-#include "ft_s_lcom.h"
-#include "ft_s_struct.h"
+#include "d_define.h"
+#include "f_fail.h"
+#include "s_destroy.h"
+#include "s_lcom.h"
+#include "s_struct.h"
static char
- *ft_set_rva(const char varname[],
+ *set_rva(const char varname[],
t_msh *msh)
{
char *rvarname;
if (!(rvarname = (char*)malloc((ft_strlen(varname) + 1) * sizeof(char))))
{
- ft_lcom_clear(&msh->curr);
- ft_s_destroy(msh);
- ft_fail_alloc(msh);
+ lcom_clear(&msh->curr);
+ s_destroy(msh);
+ fail_alloc(msh);
}
ft_memcpy((char*)rvarname, (const char*)varname + 1,
ft_strlen(varname + 1));
@@ -41,7 +41,7 @@ static char
}
static char
- *ft_dup_env(char *p_env,
+ *dup_env(char *p_env,
char *rvarname,
t_msh *msh)
{
@@ -50,16 +50,16 @@ static char
if (!(varval = ft_strdup(p_env)))
{
ft_memdel((void*)&rvarname);
- ft_lcom_clear(&msh->curr);
- ft_s_destroy(msh);
- ft_fail_alloc(msh);
+ lcom_clear(&msh->curr);
+ s_destroy(msh);
+ fail_alloc(msh);
}
ft_memdel((void*)&rvarname);
return (varval);
}
static char
- *ft_get_frm_env(char rvarname[],
+ *get_frm_env(char rvarname[],
t_msh *msh)
{
char **p_env;
@@ -76,7 +76,7 @@ static char
pp_env += 1;
if (*pp_env == '=')
pp_env += 1;
- varval = ft_dup_env(pp_env, rvarname, msh);
+ varval = dup_env(pp_env, rvarname, msh);
return (varval);
}
p_env += 1;
@@ -85,7 +85,7 @@ static char
}
static char
- *ft_get_special_var(const char varname[],
+ *get_special_var(const char varname[],
t_msh *msh)
{
char *varval;
@@ -94,9 +94,9 @@ static char
{
if (!(varval = ft_uitoa(msh->ret)))
{
- ft_lcom_clear(&msh->curr);
- ft_s_destroy(msh);
- ft_fail_alloc(msh);
+ lcom_clear(&msh->curr);
+ s_destroy(msh);
+ fail_alloc(msh);
}
return (varval);
}
@@ -104,9 +104,9 @@ static char
{
if (!(varval = ft_strdup(msh->shname)))
{
- ft_lcom_clear(&msh->curr);
- ft_s_destroy(msh);
- ft_fail_alloc(msh);
+ lcom_clear(&msh->curr);
+ s_destroy(msh);
+ fail_alloc(msh);
}
return (varval);
}
@@ -114,7 +114,7 @@ static char
}
static char
- *ft_get_cstm_vr(const char varname[],
+ *get_cstm_vr(const char varname[],
t_msh *msh)
{
(void)varname;
@@ -124,10 +124,10 @@ static char
/*
** char *
-** ft_subst_var_value(const char varname[], const t_msh *msh);
+** subst_var_value(const char varname[], const t_msh *msh);
**
** DESCRIPTION
-** The ft_subst_var_value() function returns
+** The 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
@@ -136,7 +136,7 @@ static char
*/
char
- *ft_subst_var_value(const char varname[],
+ *subst_var_value(const char varname[],
t_msh *msh)
{
/* TODO: check behaviour on empty vars -> "QWE=" */
@@ -145,18 +145,18 @@ char
char *rvarname;
varval = NULL;
- if ((varval = ft_get_special_var(varname, msh)) != NULL)
+ if ((varval = get_special_var(varname, msh)) != NULL)
{
return (varval);
}
- else if ((varval = ft_get_cstm_vr(varname, msh)) != NULL)
+ else if ((varval = get_cstm_vr(varname, msh)) != NULL)
{
return (varval);
}
else
{
- rvarname = ft_set_rva(varname, msh);
- varval = ft_get_frm_env(rvarname, msh);
+ rvarname = set_rva(varname, msh);
+ varval = get_frm_env(rvarname, msh);
return (varval);
}
return (NULL);