summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/b_export_mute.c47
-rw-r--r--src/b_export_mute.h13
2 files changed, 30 insertions, 30 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);
}
diff --git a/src/b_export_mute.h b/src/b_export_mute.h
index 7253f23..2c12b4a 100644
--- a/src/b_export_mute.h
+++ b/src/b_export_mute.h
@@ -10,15 +10,14 @@
/* */
/* ************************************************************************** */
+#ifndef FT_B_EXPORT_MUTE_H
+# define FT_B_EXPORT_MUTE_H
-#ifndef B_EXPORT_MUTE_H
-#define B_EXPORT_MUTE_H
+# include <stdint.h>
-#include <stdint.h>
+# include "b_export.h"
+# include "s_struct.h"
-#include "b_export.h"
-#include "s_struct.h"
-
-uint8_t b_export_mute(char *args[], t_msh *msh);
+uint8_t b_export_mute(char *args[], t_msh *msh);
#endif