Example #1
0
unsigned char	main_loop(char *av[], char *envp[])
{
	int			ret[2];
	char		*choice;
	t_all		*all;
	long long	exit;
	static int	run = 0;

	init(ret, &choice, &envp, &all);
	init_2(&exit);
	while (ret[1] != 0 && (!choice || exit == -2))
	{
		prompt(ret[0]);
		ft_strdel(&choice);
		ret[1] = get_next_line(0, &choice);
		all = make_all(ft_strdup(choice), av, envp);
		(CL_SCR) ? cl_screen(all) : 0;
		(!IS_EXIT && !CL_SCR) ? (ret[0] = manage_choice(all)) : 0;
		manage_env(&all, &envp, &run, &exit);
	}
	prepare_exit(&envp, &all, &choice, ret[1]);
	exit = (exit == -2 || exit == -1) ? 0 : exit;
	return ((unsigned char)exit);
}
 auto make_all( const F & f, const M & m, const R & r, const REST & ... rest )
 { return make_all( f, make_all( m, r, rest ... ) ); }