summaryrefslogtreecommitdiffstats
path: root/src/ft_history.c
diff options
context:
space:
mode:
authorRudy Bousset <rbousset@z2r5p6.le-101.fr>2019-10-30 20:35:40 +0100
committerRudy Bousset <rbousset@z2r5p6.le-101.fr>2019-10-30 20:35:40 +0100
commitc9b17eb1b25a22ed024aaafc1e669dfbfe1bc5b0 (patch)
tree016157eeda1c0690e82096eff48b284626ed09cb /src/ft_history.c
parentwork work (diff)
download42-minishell-c9b17eb1b25a22ed024aaafc1e669dfbfe1bc5b0.tar.gz
42-minishell-c9b17eb1b25a22ed024aaafc1e669dfbfe1bc5b0.tar.bz2
42-minishell-c9b17eb1b25a22ed024aaafc1e669dfbfe1bc5b0.tar.xz
42-minishell-c9b17eb1b25a22ed024aaafc1e669dfbfe1bc5b0.tar.zst
42-minishell-c9b17eb1b25a22ed024aaafc1e669dfbfe1bc5b0.zip
work work
Diffstat (limited to '')
-rw-r--r--src/ft_history.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/ft_history.c b/src/ft_history.c
new file mode 100644
index 0000000..fa28100
--- /dev/null
+++ b/src/ft_history.c
@@ -0,0 +1,17 @@
+#include <libft.h>
+#include <minishell.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+int
+ft_history(const char *arg)
+{
+ int fd;
+ int ret;
+
+ if ((fd = open("joe-sh_history", O_RDWR | O_CREAT)) == -1)
+ return (1);
+ ret = write(1, arg + "\n", ft_strlen(arg) + 1);
+ close(fd);
+ return (ret);
+}