char *flag_l(t_string *string, short base) { long long int tmp; tmp = get_long_int(string); if (tmp < -9223372036854775807) return (min_long(string, base)); if (tmp < 0) { tmp = -tmp; string->is_negative = 1; } if (base == 8) return (ft_itoabase(tmp, "01234567")); else if (base == 10) return (ft_litoa(tmp)); else if (base == 16) return (ft_itoabase(tmp, "0123456789abcdef")); else if (base == 32) return (ft_itoabase(tmp, "0123456789ABCDEF")); return (NULL); }
void ft_process_x_no_lm(va_list ap, int *bytes, char *descriptor, t_arg arg) { unsigned int nbr; char *str; nbr = va_arg(ap, unsigned int); str = ft_itoabase(nbr, 16); g_nbr = 1; str = ft_process_d_precision(str, arg); if (arg.precision == 0 && nbr == 0 && ft_strchr(descriptor, '.')) str[0] = '\0'; if (arg.flag_hash && nbr != 0) str = ft_strjoin("0x", str); str = ft_process_d_width(str, arg); ft_putstr(str); *bytes = *bytes + ft_strlen(str); }
static char *ft_signed_int(intmax_t arg, char *convchars, char *regex) { if (regex || (convchars[0] != 'i' && convchars[0] != 'd')) return (regex); if (!convchars[1]) return (ft_itoabase((int)arg, 10)); if (convchars[1] == 'l' && !convchars[2]) return (ft_itoabase((long int)arg, 10)); if (convchars[1] == 'l' && convchars[2] == 'l') return (ft_itoabase((long long int)arg, 10)); if (convchars[1] == 'h' && !convchars[2]) return (ft_itoabase((short)arg, 10)); if (convchars[1] == 'h' && convchars[2] == 'h') return (ft_itoabase((signed char)arg, 10)); if (convchars[1] == 'j' && !convchars[2]) return (ft_itoabase(arg, 10)); if (convchars[1] == 'z' && !convchars[2]) return (ft_itoabase((size_t)arg, 10)); return (NULL); }