/* ************************************************************************** */ /* LE - / */ /* / */ /* main.c .:: .:/ . .:: */ /* +:+:+ +: +: +:+:+ */ /* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ /* #+# #+ #+ #+# */ /* Created: 2019/10/29 08:47:37 by rbousset #+# ## ## #+# */ /* Updated: 2019/10/29 08:47:39 by rbousset ### #+. /#+ ###.fr */ /* / */ /* / */ /* ************************************************************************** */ #include <libft.h> #include <minishell.h> #include <stdlib.h> #include <stddef.h> #include <unistd.h> #include <inttypes.h> int main(void) { char c; char *arg; uint8_t i; int ret; i = 0; arg = NULL; while (1) { ft_putstr(FT_PS1); if (arg) { free(arg); arg = NULL; } if (!(arg = (char*)ft_calloc(129, sizeof(char)))) return (1); i = 0; while (read(1, &c, 1) > 0) { if (c == '\n') break ; arg[i] = c; i++; } arg[i] = '\0'; ft_history(arg); ret = ft_process_arg(arg); } free(arg); arg = NULL; return (0); }