summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-07-30 18:22:32 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-07-30 18:22:32 +0200
commitf441e00ea60a5e485d853d5dd3ac99a8535a40cc (patch)
treec6caa787b7b51b5cd04fe010dbdde87abce3e09b
parentLess retarded stuff (diff)
download42-minishell-f441e00ea60a5e485d853d5dd3ac99a8535a40cc.tar.gz
42-minishell-f441e00ea60a5e485d853d5dd3ac99a8535a40cc.tar.bz2
42-minishell-f441e00ea60a5e485d853d5dd3ac99a8535a40cc.tar.xz
42-minishell-f441e00ea60a5e485d853d5dd3ac99a8535a40cc.tar.zst
42-minishell-f441e00ea60a5e485d853d5dd3ac99a8535a40cc.zip
In progress
Diffstat (limited to '')
-rw-r--r--src/b_export.c10
-rw-r--r--src/b_export_next.c12
-rw-r--r--src/b_export_next.h18
-rw-r--r--src/u_vars_next.c3
4 files changed, 42 insertions, 1 deletions
diff --git a/src/b_export.c b/src/b_export.c
index 5e7ee14..95ccf40 100644
--- a/src/b_export.c
+++ b/src/b_export.c
@@ -64,6 +64,7 @@ uint8_t
r = 0;
while (*ptr)
{
+ ft_printf("export: [%s]\n", *ptr);
next = 0;
if (!check_valid_identifier(*ptr))
{
@@ -72,7 +73,16 @@ uint8_t
r = 1;
}
if (next == 0 && !check_equals(*ptr))
+ {
next = 1;
+ /* TODO: export already set variable */
+ /* examples: */
+ /* ~> QWE=qwe */
+ /* ~> export QWE */
+ /* -------------- */
+ /* # non-existant variable QWE */
+ /* ~> export QWE */
+ }
ptr++;
}
/* TODO: finish export */
diff --git a/src/b_export_next.c b/src/b_export_next.c
new file mode 100644
index 0000000..44d2b9b
--- /dev/null
+++ b/src/b_export_next.c
@@ -0,0 +1,12 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* b_export_next.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/02/14 17:19:27 by rbousset #+# #+# */
+/* Updated: 2020/02/14 17:19:29 by rbousset ### ########lyon.fr */
+/* */
+/* ************************************************************************** */
+
diff --git a/src/b_export_next.h b/src/b_export_next.h
new file mode 100644
index 0000000..4a8781b
--- /dev/null
+++ b/src/b_export_next.h
@@ -0,0 +1,18 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* b_export_next.h :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/02/14 17:19:27 by rbousset #+# #+# */
+/* Updated: 2020/02/14 17:19:29 by rbousset ### ########lyon.fr */
+/* */
+/* ************************************************************************** */
+
+#ifndef B_EXPORT_NEXT_H
+#define B_EXPORT_NEXT_H
+
+#include "s_struct.h"
+
+#endif
diff --git a/src/u_vars_next.c b/src/u_vars_next.c
index 8134de3..8e02c26 100644
--- a/src/u_vars_next.c
+++ b/src/u_vars_next.c
@@ -64,7 +64,8 @@ void
{
/* TODO: Handle this fail */
}
- (void)ft_strlcpy(msh->envp[env_line], new_line_fmt, ft_strlen(new_line_fmt) + 1);
+ (void)ft_strlcpy(msh->envp[env_line],
+ new_line_fmt, ft_strlen(new_line_fmt) + 1);
}
else
{