void ft_prep_j_int(va_list ap, int *count, int *flags) { char *str; intmax_t n1; uintmax_t n2; str = NULL; if (flags[ATTR_SUB_TYPE] == 'd' || flags[ATTR_SUB_TYPE] == 'i') { n1 = va_arg(ap, intmax_t); str = ft_lltoa_base(n1, 10, "0123456789"); ft_display_int(str, count, flags); } else { n2 = va_arg(ap, uintmax_t); if (flags[ATTR_SUB_TYPE] == 'x') str = ft_ulltoa_base(n2, 16, "0123456789abcdef"); else if (flags[ATTR_SUB_TYPE] == 'X') str = ft_ulltoa_base(n2, 16, "0123456789ABCDEF"); else if (flags[ATTR_SUB_TYPE] == 'o') str = ft_ulltoa_base(n2, 8, "01234567"); else if (flags[ATTR_SUB_TYPE] == 'u') str = ft_ulltoa_base(n2, 10, "0123456789"); ft_display_int(str, count, flags); } }
void im_int(t_conv *conv, va_list va) { if (conv->length[0] == 0) conv->str = ft_itoa(va_arg(va, int)); if (ft_strcmp(conv->length, "hh") == 0) conv->str = ft_itoa((signed char)va_arg(va, int)); if (ft_strcmp(conv->length, "h") == 0) conv->str = ft_itoa((short int)va_arg(va, int)); if (ft_strcmp(conv->length, "l") == 0) conv->str = ft_ltoa(va_arg(va, long int)); if (ft_strcmp(conv->length, "ll") == 0) conv->str = ft_lltoa(va_arg(va, long long int)); if (ft_strcmp(conv->length, "j") == 0) conv->str = ft_lltoa_base(va_arg(va, intmax_t), 10); if (ft_strcmp(conv->length, "z") == 0) conv->str = ft_lltoa_base(va_arg(va, size_t), 10); }
void ft_prep_z_int(va_list ap, int *count, int *flags) { char *str; size_t n; n = va_arg(ap, size_t); str = ft_lltoa_base(n, 10, "0123456789"); ft_display_int(str, count, flags); }
char *ft_ltoa_base(long value, int base) { return (ft_lltoa_base((long long)value, base)); }
char *ft_ultoa_base(unsigned long value, int base) { return (ft_lltoa_base((unsigned long long)value, base)); }