void print_uint(va_list *valist, t_spec_flags *opts) { char *str; uintmax_t nbr; int len; nbr = printf_uintcast(valist, opts); str = ft_ulltoa(nbr); len = MAX((int)ft_strlen(str), opts->precision); if (!opts->minus) ft_putnchar(opts->width - len, opts->zero ? '0' : ' '); ft_putnchar(opts->precision - ft_strlen(str), '0'); if (nbr != 0 || !opts->precision_set || opts->precision > 0) ft_putstr(str); if (opts->minus) ft_putnchar(opts->width - len, ' '); free(str); }
static char *fill_word(char type, long long nbr) { char *word; word = NULL; if (type == 'd' || type == 'D' || type == 'i') word = ft_lltoa(nbr); else if (type == 'u' || type == 'U') word = ft_ulltoa((unsigned long long)nbr); else if (type == 'x' || type == 'p') word = ft_lltoah(nbr, 1); else if (type == 'X') word = ft_lltoah(nbr, 2); else if (type == 'o' || type == 'O') word = ft_lltoao(nbr); else if (type == 'b') word = ft_lltoab(nbr); return (word); }