Beispiel #1
0
void			ft_resolve(t_l *lst, t_l *lst2, t_opt *opt)
{
	int		nb;
	t_l		*lst3;

	while (lst->next)
		lst = lst->next;
	nb = lst->position + 1;
	lst = lst->first;
	lst = ft_lstcmp(lst, lst2);
	lst = lst->first;
	lst3 = ft_lstncpy(lst, nb);
	lst3->position = lst->position;
	lst3 = ft_swap(lst3, nb);
	lst3 = lst3->first;
	if (ft_near(lst3))
		lst = ft_bubble(lst, nb, opt);
	else if (nb < 12)
		lst = ft_dinsert(lst, nb, opt);
	else
		lst = ft_fus(lst, nb, opt);
	if (opt && opt->silence && !opt->r && (opt->n = opt->n - 1))
	{
		opt->silence = 0;
		opt->v = 1;
		ft_printf2(0, lst->first, NULL, opt);
	}
}
Beispiel #2
0
int		ft_printf(char const *format, ...)
{
	int			tab[2];
	va_list		ap;
	char		*c;
	t_specs		opt;

	init_tab2(tab);
	c = ft_strdup(format);
	va_start(ap, format);
	while (c[tab[0]])
	{
		if (c[tab[0]] == '{' && verif_colour(c, tab[0]))
			c = treat_colours(c, &tab[0]);
		else if (c[tab[0]] == '%')
		{
			opt = check_options(ap, format, &tab[0]);
			if (c[tab[0]] == 'n')
				treat_n(ap, &tab[0], tab[1]);
			else
				tab[1] += ft_option_printf(ap, c, &tab[0], opt);
		}
		else
			ft_printf2(c, &tab[0], &tab[1]);
	}
	va_end(ap);
	return (tab[1]);
}