/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_system.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: bchanot +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/12/20 11:11:15 by bchanot #+# #+# */ /* Updated: 2018/10/14 03:28:18 by bchanot ### ########.fr */ /* */ /* ************************************************************************** */ #include #include #include void ft_system(char *src) { pid_t pid; char **tab; tab = ft_strsplit(src, ' '); pid = fork(); if (pid < 0) ft_putendl("Fail to fork."); if (pid == 0) execve(tab[0], tab, 0); waitpid(pid, 0, 0); ft_memdel2((void ***)&tab); }