/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_cases_mandatory_two.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: thrieg +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/10/22 18:52:33 by thrieg #+# #+# */ /* Updated: 2025/02/16 19:07:58 by thrieg ### ########.fr */ /* */ /* ************************************************************************** */ #include "../libft.h" #include "ft_printf.h" int ft_case_x(t_vector *vec, va_list *args) { char *str_to_cat; str_to_cat = ft_utoa_base(va_arg(*args, unsigned int), "0123456789abcdef"); if (!ft_vector_concat(vec, str_to_cat, ft_strlen(str_to_cat))) return (free(str_to_cat), 0); free(str_to_cat); return (1); } int ft_case_upperx(t_vector *vec, va_list *args) { char *str_to_cat; str_to_cat = ft_utoa_base(va_arg(*args, unsigned int), "0123456789ABCDEF"); if (!ft_vector_concat(vec, str_to_cat, ft_strlen(str_to_cat))) return (free(str_to_cat), 0); free(str_to_cat); return (1); } int ft_case_d(t_vector *vec, va_list *args) { char *str_to_cat; str_to_cat = ft_itoa(va_arg(*args, int)); if (!ft_vector_concat(vec, str_to_cat, ft_strlen(str_to_cat))) return (free(str_to_cat), 0); free(str_to_cat); return (1); } int ft_case_i(t_vector *vec, va_list *args) { char *str_to_cat; str_to_cat = ft_itoa(va_arg(*args, int)); if (!ft_vector_concat(vec, str_to_cat, ft_strlen(str_to_cat))) return (free(str_to_cat), 0); free(str_to_cat); return (1); }