35 lines
1.5 KiB
C
35 lines
1.5 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_sorting.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: lfirmin <lfirmin@student.42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2024/06/19 04:56:45 by lfirmin #+# #+# */
|
|
/* Updated: 2024/06/19 07:51:17 by lfirmin ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
#include "ftprintf.h"
|
|
|
|
int ft_sorting(va_list list, const char str, int fd)
|
|
{
|
|
int count;
|
|
|
|
count = 0;
|
|
if (str == 'c')
|
|
count += ft_printchar(fd, va_arg(list, int));
|
|
else if (str == 's')
|
|
count += ft_printstr(fd, va_arg(list, char *));
|
|
else if (str == 'p')
|
|
count += ft_print_ptr(fd, va_arg(list, unsigned long long));
|
|
else if (str == 'd' || str == 'i')
|
|
count += ft_print_nbr(fd, va_arg(list, int));
|
|
else if (str == 'u')
|
|
count += ft_print_unsigned(fd, va_arg(list, unsigned int));
|
|
else if (str == 'x' || str == 'X')
|
|
count += ft_print_ith(fd, va_arg(list, unsigned int), str);
|
|
else if (str == '%')
|
|
count += ft_printpercent(fd);
|
|
return (count);
|
|
}
|