示例#1
0
文件: main.c 项目: pitzzae/21sh
int				main(int argc, char **argv, char **env)
{
	t_dat		t_d;
	char		**newenv;

	t_d.argv = argv;
	if (ft_init_env(&newenv, env) == 0 && argc > 0)
		ft_lst_env_new(env, &t_d.t_env, 0);
	else
	{
		ft_lst_env_new(newenv, &t_d.t_env, 0);
		free(newenv[0]);
		free(newenv[1]);
		free(newenv[2]);
		free(newenv);
	}
	ft_update_shlvl(&t_d.t_env);
	ft_lst_to_env(&t_d.t_env, &newenv, 0);
	t_d.env = newenv;
	ft_init_history(&t_d);
	signal(SIGINT, get_sigint);
	if (!ft_init_termios(&t_d, 1))
		return (-1);
	while (ft_initshell(&t_d, t_d.init_p) == 1)
		;
	return (0);
}
示例#2
0
文件: main.c 项目: Zained/42-select
int		main(int ac, char **av)
{
	t_truc c;

	(void)ac;
	(void)av;
	if (ac == 1)
	{
		ft_putstr("Usage : ./ft_select [argv1] [argv2] ... OR ./ft_select *\n");
		return (0);
	}
	c.lst = NULL;
	ft_signal();
	if (ft_init_termios(&c))
		return (0);
	tputs(tgetstr("cl", NULL), 1, ft_putchar_auto);
	if (ac >= 2)
		ft_loop(av, &c);
	ft_end_termios(&c);
	return (0);
}