summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-04-23 16:29:20 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-04-23 16:29:20 +0200
commit58f7f3e9d2a61d46e57ffe324ae6ae7f21e875a3 (patch)
treed43399d8ac6ce24496b86918496d57c37d628698
parentVery good redirs (diff)
download42-minishell-58f7f3e9d2a61d46e57ffe324ae6ae7f21e875a3.tar.gz
42-minishell-58f7f3e9d2a61d46e57ffe324ae6ae7f21e875a3.tar.bz2
42-minishell-58f7f3e9d2a61d46e57ffe324ae6ae7f21e875a3.tar.xz
42-minishell-58f7f3e9d2a61d46e57ffe324ae6ae7f21e875a3.tar.zst
42-minishell-58f7f3e9d2a61d46e57ffe324ae6ae7f21e875a3.zip
Prepared builtins templates
Diffstat (limited to '')
-rw-r--r--Makefile5
-rw-r--r--src/ft_b_builtins.h3
-rw-r--r--src/ft_b_cd.c24
-rw-r--r--src/ft_b_cd.h22
-rw-r--r--src/ft_b_pwd.c24
-rw-r--r--src/ft_b_pwd.h22
-rw-r--r--src/ft_b_unset.c24
-rw-r--r--src/ft_b_unset.h22
-rw-r--r--src/ft_e_builtins.c (renamed from src/ft_e_builtin.c)2
-rw-r--r--src/ft_e_builtins.h (renamed from src/ft_e_builtin.h)6
-rw-r--r--src/ft_e_lcom.c2
-rw-r--r--src/ft_m_funptr.c6
12 files changed, 153 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 2970572..82e9194 100644
--- a/Makefile
+++ b/Makefile
@@ -15,11 +15,14 @@ LFT_SRCS_DIR = ${LFT_DIR}src/
#--------------------------------- FILES --------------------------------------#
#==============================================================================#
SRCS_NAME = minishell.c
+SRCS_NAME += ft_b_cd.c
SRCS_NAME += ft_b_echo.c
SRCS_NAME += ft_b_env.c
SRCS_NAME += ft_b_exit.c
SRCS_NAME += ft_b_export.c
-SRCS_NAME += ft_e_builtin.c
+SRCS_NAME += ft_b_pwd.c
+SRCS_NAME += ft_b_unset.c
+SRCS_NAME += ft_e_builtins.c
SRCS_NAME += ft_e_lcom.c
SRCS_NAME += ft_f_fail.c
SRCS_NAME += ft_f_file.c
diff --git a/src/ft_b_builtins.h b/src/ft_b_builtins.h
index 21ffe0b..36e6498 100644
--- a/src/ft_b_builtins.h
+++ b/src/ft_b_builtins.h
@@ -13,9 +13,12 @@
#ifndef FT_B_BUILTINS_H
#define FT_B_BUILTINS_H
+#include "ft_b_cd.h"
#include "ft_b_echo.h"
#include "ft_b_env.h"
#include "ft_b_exit.h"
#include "ft_b_export.h"
+#include "ft_b_pwd.h"
+#include "ft_b_unset.h"
#endif
diff --git a/src/ft_b_cd.c b/src/ft_b_cd.c
new file mode 100644
index 0000000..c0bf04b
--- /dev/null
+++ b/src/ft_b_cd.c
@@ -0,0 +1,24 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_b_cd.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 */
+/* */
+/* ************************************************************************** */
+
+#include <stdint.h>
+#include "ft_s_struct.h"
+
+uint8_t
+ ft_b_cd(char *args[],
+ t_msh *msh)
+{
+ (void)args;
+ (void)msh;
+ /* TODO: do cd */
+ return (0);
+}
diff --git a/src/ft_b_cd.h b/src/ft_b_cd.h
new file mode 100644
index 0000000..e789cc0
--- /dev/null
+++ b/src/ft_b_cd.h
@@ -0,0 +1,22 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_b_cd.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 FT_B_CD_H
+#define FT_B_CD_H
+
+#include <stdint.h>
+#include "ft_s_struct.h"
+
+uint8_t ft_b_cd(char *args[],
+ t_msh *msh);
+
+#endif
diff --git a/src/ft_b_pwd.c b/src/ft_b_pwd.c
new file mode 100644
index 0000000..f06a320
--- /dev/null
+++ b/src/ft_b_pwd.c
@@ -0,0 +1,24 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_b_pwd.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 */
+/* */
+/* ************************************************************************** */
+
+#include <stdint.h>
+#include "ft_s_struct.h"
+
+uint8_t
+ ft_b_pwd(char *args[],
+ t_msh *msh)
+{
+ (void)args;
+ (void)msh;
+ /* TODO: do pwd */
+ return (0);
+}
diff --git a/src/ft_b_pwd.h b/src/ft_b_pwd.h
new file mode 100644
index 0000000..653c9e4
--- /dev/null
+++ b/src/ft_b_pwd.h
@@ -0,0 +1,22 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_b_pwd.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 FT_B_PWD_H
+#define FT_B_PWD_H
+
+#include <stdint.h>
+#include "ft_s_struct.h"
+
+uint8_t ft_b_pwd(char *args[],
+ t_msh *msh);
+
+#endif
diff --git a/src/ft_b_unset.c b/src/ft_b_unset.c
new file mode 100644
index 0000000..a382aca
--- /dev/null
+++ b/src/ft_b_unset.c
@@ -0,0 +1,24 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_b_unset.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 */
+/* */
+/* ************************************************************************** */
+
+#include <stdint.h>
+#include "ft_s_struct.h"
+
+uint8_t
+ ft_b_unset(char *args[],
+ t_msh *msh)
+{
+ (void)args;
+ (void)msh;
+ /* TODO: do unset */
+ return (0);
+}
diff --git a/src/ft_b_unset.h b/src/ft_b_unset.h
new file mode 100644
index 0000000..5ab1b2b
--- /dev/null
+++ b/src/ft_b_unset.h
@@ -0,0 +1,22 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_b_unset.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 FT_B_UNSET_H
+#define FT_B_UNSET_H
+
+#include <stdint.h>
+#include "ft_s_struct.h"
+
+uint8_t ft_b_unset(char *args[],
+ t_msh *msh);
+
+#endif
diff --git a/src/ft_e_builtin.c b/src/ft_e_builtins.c
index 4f58f44..34a8534 100644
--- a/src/ft_e_builtin.c
+++ b/src/ft_e_builtins.c
@@ -1,7 +1,7 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
-/* ft_e_builtin.c :+: :+: :+: */
+/* ft_e_builtins.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
diff --git a/src/ft_e_builtin.h b/src/ft_e_builtins.h
index 45dad81..21908b8 100644
--- a/src/ft_e_builtin.h
+++ b/src/ft_e_builtins.h
@@ -1,7 +1,7 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
-/* ft_e_builtin.h :+: :+: :+: */
+/* ft_e_builtins.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
@@ -10,8 +10,8 @@
/* */
/* ************************************************************************** */
-#ifndef FT_E_BUILTIN_H
-#define FT_E_BUILTIN_H
+#ifndef FT_E_BUILTINS_H
+#define FT_E_BUILTINS_H
#include <stdint.h>
#include "ft_s_struct.h"
diff --git a/src/ft_e_lcom.c b/src/ft_e_lcom.c
index 7922997..c0a137a 100644
--- a/src/ft_e_lcom.c
+++ b/src/ft_e_lcom.c
@@ -11,7 +11,7 @@
/* ************************************************************************** */
#include <libft.h>
-#include "ft_e_builtin.h"
+#include "ft_e_builtins.h"
#include "ft_s_struct.h"
static uint8_t
diff --git a/src/ft_m_funptr.c b/src/ft_m_funptr.c
index 22b390f..0682a20 100644
--- a/src/ft_m_funptr.c
+++ b/src/ft_m_funptr.c
@@ -22,10 +22,10 @@ void
ft_init_buptr(t_msh *msh)
{
msh->bu_ptr[0] = ft_b_echo;
- /* msh->bu_ptr[1] = ft_b_cd; */
- /* msh->bu_ptr[2] = ft_b_pwd; */
+ msh->bu_ptr[1] = ft_b_cd;
+ msh->bu_ptr[2] = ft_b_pwd;
msh->bu_ptr[3] = ft_b_export;
- /* msh->bu_ptr[4] = ft_b_unset; */
+ msh->bu_ptr[4] = ft_b_unset;
msh->bu_ptr[5] = ft_b_env;
msh->bu_ptr[6] = ft_b_exit;
/* TODO: them builtins */