Ejemplo n.º 1
0
int		ft_printxo2(t_list *lst, int base, unsigned long long nb, int spaces)
{
	if (lst->diese && nb)
	{
		lst->result += (lst->precision > ft_baselen(nb, 0, base) ?
				ft_print_space(lst->size - lst->precision - base) :
				ft_print_space(lst->size - ft_baselen(nb, 0, base) -
					spaces));
		lst->result += diese_flag(lst);
		lst->result += ft_print_zeros(lst->precision -
				((base == 8) ? 1 : 0),
				ft_baselen(nb, 0, base));
		ft_put_base(nb, base, lst);
		return (0);
	}
	lst->result += ((lst->precision > ft_baselen(nb, 0, base)) ?
			ft_print_space(lst->size - lst->precision) :
			ft_print_space(lst->size - ft_baselen(nb, 0, base)));
	lst->result += ft_print_zeros(lst->precision, ft_baselen(nb, 0, base));
	if (lst->precision == 0 && lst->modified_precision && !lst->diese)
	{
		if ((lst->type != 'o' && lst->type != 'O') || lst->size != 0)
			lst->result += ft_print_char(' ');
		return (0);
	}
	ft_put_base(nb, base, lst);
	return (0);
}
Ejemplo n.º 2
0
int ft_print_str(char *str)
{
    int pos;

    if (!str)
        write(2, "(null)", 6);
    else
    {
        pos = 0;
        while (str[pos])
        {
            ft_print_char(str[pos]);
            pos++;
        }
    }
    return ((!str) ? 6 : pos);
}