/* ************************************************************************** */ /* LE - / */ /* / */ /* main.c .:: .:/ . .:: */ /* +:+:+ +: +: +:+:+ */ /* By: rbousset +:+ +: +: +:+ */ /* #+# #+ #+ #+# */ /* Created: 2019/10/29 08:47:37 by rbousset #+# ## ## #+# */ /* Updated: 2019/10/29 08:47:39 by rbousset ### #+. /#+ ###.fr */ /* / */ /* / */ /* ************************************************************************** */ #include #include #include #include #include int main(void) { char c; char *arg; uint8_t i; i = 0; while (1) { if (!(arg = (char*)ft_calloc(129, sizeof(char)))) return (1); write(1, "joe-shell~> ", 12); i = 0; while (read(1, &c, 1) > 0) { if (c == '\n') break ; if (i > 128) { write(1, "Command too long!\n", 18); return (2); } arg[i] = c; i++; } arg[i] = '\0'; } free(arg); return (0); }