Пример #1
0
int		main(int ac, char **av)
{
	t_all			all;
	int				ret;

	all.elem = NULL;
	all.win.nb_elem = 0;
	all.show = 1;
	if (ac > 1 && av[1] != NULL)
	{
		ft_signal();
		if (init_term(&all))
			return (-1);
		if ((ret = init_lst(&(all.elem), av, &all)) == TRUE)
		{
			memoire(&all, 0);
			ret = ft_select(&all);
		}
		if (reset_term(&all) == -1)
			return (-1);
		if (ret == -2)
			print_select(&all);
		if (all.win.nb_elem > 0)
			freelst(&all);
	}
	return (0);
}
Пример #2
0
static void		handle_sigcont(void)
{
	if (isatty(1))
	{
		ft_signal(ON);
		ft_terminal_on();
		print_list();
	}
}
Пример #3
0
static void		handle_sigtstp(void)
{
	if (isatty(1))
	{
		ft_terminal_off(&g_term_save);
		ft_signal(OFF);
		ioctl(0, TIOCSTI, "\032");
	}
}
Пример #4
0
static int		in_while(char **key, t_env **env, t_hist **hst, t_edit **lst)
{
	int		value;

	value = 0;
	ft_bzero(*key, 7);
	if ((value = ft_sigleton(0)) > 0)
		ft_signal(env, lst, value, hst);
	else
	{
		if (read(0, *key, 6) == -1)
			return (-1);
		if (*key[0] == 4 && *key[1] == 0 && *key[2] == 1 && *key[3] == -64)
			ft_exit_eof(env);
		if (ft_sigleton(0) == 0)
			ft_check_key(*key, lst, hst, env);
		if ((value = ft_sigleton(0)) == 3)
			ft_signal(env, lst, value, hst);
	}
	return (0);
}
Пример #5
0
int	main(int argc, char *argv[])
{
	g_term = (t_term *)malloc(sizeof(t_term));
	g_term->cursor = (t_cursor *)malloc(sizeof(t_cursor));
	ft_init_terminal_data(g_term);
	ft_terminal_raw_mode(g_term);
	if (argc > 1)
		ft_terminal_parse_args(g_term, argv);
	ft_signal();
	if (argc > 1 && g_term->arg_count > 1)
		ft_terminal_run(g_term);
	free(g_term);
	return (0);
}
Пример #6
0
int				main(int ac, char **av)
{
	t_select	params;

	params.list = NULL;
	if (ac <= 1)
		return (-1);
	ft_signal();
	if (init_term(&params) == -1)
		return (-1);
	if (ft_select(ac, av, &params) == -1)
		return (-1);
	if (restore_term(&params) == -1)
		return (-1);
	return (0);
}
Пример #7
0
int		main(void)
{
	extern char		**environ;
	t_list			*env;
	t_cmd			*cmd;
	char			*input;

	ft_signal();
	env = tab_to_lst(environ);
	while ((input = prompt_controller(env, 1)))
	{
		cmd = cmd_controller(input, env);
		launcher_controller(cmd, &env);
		cmd_delall(&cmd);
		ft_strdel(&input);
	}
	ft_putstr("exit\n");
	return (0);
}
Пример #8
0
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);
}