src/pipex.c
/**
 * Executes the given shell command.
 * Command can be given as an absolute path like "/bin/ls" or
 * by just typing "ls". If command does not exists
 * 
 * @param cmd The whole command with args.
 * @param envp Enviroment pointer.
 */
Executes the given shell command.
Command can be given as an absolute path like "/bin/ls" or
by just typing "ls". If command does not exists

@param cmd The whole command with args.
@param envp Enviroment pointer.
Executes the given shell command . Command can be given as an absolute path like " / bin / ls " or by just typing " ls " . If command does not exists @param cmd The whole command with args . @param envp Enviroment pointer .
static void	ft_exec(char *cmd, char **envp)
{
	t_i32	i;
	char	*path;
	char	**args;
	i = 0;
	args = ft_split(cmd, ' ');
	if (args[0][0] == '/' || args[0][0] == '.' || \
		(args[0][0] == '.' && args[0][1] == '.'))
		path = args[0];
	else
		path = ft_getexec(args[0], envp);
	execve(path, args, envp);
	ft_cleanup(args);
	ft_assert("Command does not exist", NOT_FOUND);
}
static void ft_exec ( char * cmd , char * * envp ) { t_i32 i ; char * path ; char * * args ; i = 0 ; args = ft_split ( cmd , ' ' ) ; if ( args [ 0 ] [ 0 ] == ' ' || args [ 0 ] [ 0 ] == ' ' || ( args [ 0 ] [ 0 ] == ' ' && args [ 0 ] [ 1 ] == ' ' ) ) path = args [ 0 ] ; else path = ft_getexec ( args [ 0 ] , envp ) ; execve ( path , args , envp ) ; ft_cleanup ( args ) ; ft_assert ( " " , NOT_FOUND ) ; }
Executes the given shell command.
Executes the given shell command .