명령어 실행파일의 경로 찾기


int			i;
	char		*temp;
	char		*path;
	char		**paths;
	struct stat	buf;

	temp = search_env("PATH");
	paths = ft_split(temp, ':');
	i = -1;
	while (paths[++i])
	{
		temp = ft_strjoin("/", cmd);
		path = ft_strjoin(paths[i], temp);
		free(temp);
		if (stat(path, &buf) == 0)
		{
			cmd = path;
			break ;
		}
		free(path);
	}
	free_double_arr(paths);
	return (cmd);
}