summaryrefslogtreecommitdiffstats
path: root/src/b_export_mute.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/b_export_mute.c')
-rw-r--r--src/b_export_mute.c47
1 files changed, 24 insertions, 23 deletions
diff --git a/src/b_export_mute.c b/src/b_export_mute.c
index ac72a7e..07cd120 100644
--- a/src/b_export_mute.c
+++ b/src/b_export_mute.c
@@ -25,14 +25,30 @@
#include "u_utils.h"
#include "u_vars.h"
-uint8_t
- b_export_mute(char *args[], t_msh *msh)
+static void b_classic_export_mute(char *ptr[], t_msh *msh)
{
- /* TODO: norme */
- char **ptr;
char varval[4096];
char fmt[4096];
- t_bool next;
+
+ if (check_equals(*ptr) == FALSE)
+ {
+ ft_sprintf(fmt, "$%s", *ptr);
+ u_get_custom_var(varval, fmt, 4096, msh);
+ if (varval[0] != C_NUL)
+ {
+ ft_sprintf(fmt, "%s=%s", *ptr, varval);
+ b_add_to_env_from_globals(*ptr, fmt, msh);
+ }
+ }
+ else if (check_equals(*ptr) == TRUE)
+ {
+ b_export_with_equals(*ptr, msh);
+ }
+}
+
+uint8_t b_export_mute(char *args[], t_msh *msh)
+{
+ char **ptr;
uint8_t r;
if (args[0] == NULL)
@@ -41,29 +57,14 @@ uint8_t
ptr = args;
while (*ptr != NULL)
{
- next = FALSE;
if (check_valid_identifier(*ptr) == FALSE)
{
- next = TRUE;
r = 1;
+ ptr++;
+ continue ;
}
- if (next == FALSE && check_equals(*ptr) == FALSE)
- {
- next = TRUE;
- ft_sprintf(fmt, "$%s", *ptr);
- u_get_custom_var(varval, fmt, 4096, msh);
- if (varval[0] != C_NUL)
- {
- ft_sprintf(fmt, "%s=%s", *ptr, varval);
- b_add_to_env_from_globals(*ptr, fmt, msh);
- }
- }
- else if (next == FALSE && check_equals(*ptr) == TRUE)
- {
- b_export_with_equals(*ptr, msh);
- }
+ b_classic_export_mute(ptr, msh);
ptr++;
}
- /* TODO: finish export */
return (r);
}