Add initial code

This commit is contained in:
gbaconni
2022-04-13 08:01:46 +02:00
parent 3c563477d5
commit 65a087aa34
23 changed files with 947 additions and 0 deletions

42
libftprintf/ft_vprintf.c Normal file
View File

@@ -0,0 +1,42 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_vprintf.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/01/20 11:43:52 by gbaconni #+# #+# */
/* Updated: 2022/04/13 01:24:00 by gbaconni ### lausanne.ch */
/* */
/* ************************************************************************** */
#include "libftprintf.h"
int ft_vprintf(char const *format, va_list ap)
{
int ret;
ret = 0;
while (*format)
{
if (*format++ == '%')
{
if (*format == '%')
ret += ft_vprintf_percent(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);
}
else
ret += ft_vprintf_other(format, ap);
format++;
}
return (ret);
}