summaryrefslogtreecommitdiffstats
path: root/src/b_export.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/b_export.c')
-rw-r--r--src/b_export.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/b_export.c b/src/b_export.c
index 9cb1c14..8225b51 100644
--- a/src/b_export.c
+++ b/src/b_export.c
@@ -14,12 +14,13 @@
#include <stdlib.h>
#include <stdint.h>
+#include "d_enum.h"
#include "b_env.h"
#include "f_fail.h"
#include "s_struct.h"
#include "u_utils.h"
-static int8_t
+static t_bool
check_valid_identifier(const char *arg)
{
char *ptr;
@@ -27,24 +28,24 @@ static int8_t
ptr = (char*)arg;
if (ft_isalpha(ptr[0]))
{
- return (1);
+ return (TRUE);
}
- return (0);
+ return (FALSE);
}
-static int8_t
+static t_bool
check_equals(const char *arg)
{
char *ptr;
ptr = (char*)arg;
- while (*ptr)
+ while (*ptr != '\0')
{
if (*ptr == '=')
- return (1);
+ return (TRUE);
ptr++;
}
- return (0);
+ return (FALSE);
}
uint8_t
@@ -53,7 +54,7 @@ uint8_t
{
const uint64_t argc = get_argc((const char**)args);
char **ptr;
- int8_t next;
+ t_bool next;
uint8_t r;
if (argc == 0)
@@ -65,16 +66,16 @@ uint8_t
while (*ptr)
{
ft_printf("export: [%s]\n", *ptr);
- next = 0;
- if (!check_valid_identifier(*ptr))
+ next = FALSE;
+ if (check_valid_identifier(*ptr) == FALSE)
{
f_fail_identifier("export", *ptr, msh);
- next = 1;
+ next = TRUE;
r = 1;
}
- if (next == 0 && !check_equals(*ptr))
+ if (next == FALSE && check_equals(*ptr) == FALSE)
{
- next = 1;
+ next = TRUE;
/* TODO: export already set variable */
/* examples: */
/* ~> QWE=qwe */
@@ -83,6 +84,9 @@ uint8_t
/* # non-existant variable QWE */
/* ~> export QWE */
}
+ else if (next == FALSE && check_equals(*ptr) == TRUE)
+ {
+ }
ptr++;
}
/* TODO: finish export */