Move dispatcher to ft_vprintf_percent.c

This commit is contained in:
gbaconni
2022-04-18 00:52:18 +02:00
parent 0269a1dc70
commit 0cd1d2ef1b
10 changed files with 141 additions and 39 deletions

View File

@@ -6,7 +6,7 @@
/* By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/01/20 11:55:58 by gbaconni #+# #+# */
/* Updated: 2022/04/16 00:32:06 by gbaconni ### lausanne.ch */
/* Updated: 2022/04/17 22:40:01 by gbaconni ### lausanne.ch */
/* */
/* ************************************************************************** */
@@ -16,8 +16,17 @@ int ft_vprintf_percent(const char *format, va_list ap)
{
int ret;
(void) format;
(void) ap;
ret = ft_putchar('%');
if (*format == '%')
ret = ft_vprintf_other(format, ap);
else if (*format == 'c')
ret = ft_vprintf_char(format, ap);
else if (*format == 's')
ret = ft_vprintf_string(format, ap);
else if (*format == 'p')
ret = ft_vprintf_pointer(format, ap);
else if (*format == 'd' || *format == 'i' || *format == 'u')
ret = ft_vprintf_decimal(format, ap);
else if (*format == 'x' || *format == 'X')
ret = ft_vprintf_hexadecimal(format, ap);
return (ret);
}