summaryrefslogtreecommitdiffstats
path: root/src/ft_history.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ft_history.c')
-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);
+}