Exemple #1
0
static void	ft_change_dir(t_dat *dat, char **cmd_split)
{
	DIR		*dir;

	dir = opendir(cmd_split[1]);
	if (dir == NULL)
		ft_check_cd(cmd_split[1]);
	else
	{
		chdir(cmd_split[1]);
		closedir(dir);
		ft_change_env(dat);
	}
}
Exemple #2
0
static int			ft_knew_cmd(char **args, char **envp, int argc)
{
	int		arg0;

	if ((arg0 = ft_test_arg0(args[0])) != 0)
	{
		if (arg0 == 1)
			return (ft_check_cd(envp, args, argc));
		if (arg0 == 2)
			return (ft_check_exit(envp, args, argc));
		if (arg0 == 3)
			return (ft_check_setenv(envp, args, argc));
		if (arg0 == 4)
			return (ft_check_unsetenv(envp, args, argc));
		if (arg0 == 5)
			return (ft_check_env(envp, args, argc));
	}
	return (-10);
}