summaryrefslogtreecommitdiffstats
path: root/src/ft_history.c
blob: fa2810030fe77f174d60d5bfc24dabd4769fba54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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);
}