/* ************************************************************************** */ /* */ /* ::: o_ :::::: ::: */ /* ft_printf.c :+: / :+::+: :+: */ /* +:+ > +:++:+ +:+ */ /* By: whaffman +#+ +:+ +#++#++:++#++ */ /* +#+ +#+#+ +#++#+ +#+ \o/ */ /* Created: 2024/10/11 14:49:07 by whaffman #+#+# #+#+# #+# #+# | */ /* Updated: 2024/10/27 16:37:46 by whaffman ### ### ### ### / \ */ /* */ /* ************************************************************************** */ #include #include #include "libft.h" #include "ft_printf.h" int ft_printf(const char *format, ...) { int wrote; int result; va_list args; result = 0; va_start(args, format); while (*format && result >= 0) { if (*format == '%') wrote = parse_placeholder(&format, args); else wrote = write(1, format, 1); if (wrote < 0) { result = wrote; break ; } result += wrote; format++; } va_end(args); return (result); }