Example #1
0
int		main(void)
{
	char		*line1;
	char		*line2;
	t_dlist		*list;

	ft_putstr("\n WELCOME ON MINISHELL2 BY PBOURDON \n");
	list = NULL;
	list = dlist_new(list);
	list = ft_cpy_env(list);
	if (ft_list_size(list->p_head) == 0)
		list = ft_cpy_env2(list);
	ft_putstr("$>");
	while (get_next_line(1, &line1, 0) == 1)
	{
		line2 = ft_delete_tab(line1);
		list = ft_choose(line2, list);
		free(line2);
		free(line1);
		if (list == NULL)
			return (0);
		ft_show_prompt();
	}
	return (0);
}
Example #2
0
void			ft_cleaner(t_data **path, t_cmd *cmd, int value)
{
	static t_data	**save_path = NULL;
	static t_cmd	*save_cmd = NULL;
	static char		**environ = NULL;

	if (value == 0)
	{
		if (path)
			save_path = path;
		if (cmd && !save_cmd)
			save_cmd = cmd;
		environ = ft_cpy_env(0);
	}
	else
		ft_do_clean(environ, save_path, save_cmd);
	return ;
}