diff --git a/ft_printf.c b/ft_printf.c index c6ff56a..7ecc90e 100644 --- a/ft_printf.c +++ b/ft_printf.c @@ -6,12 +6,11 @@ /* By: erey-bet +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/10/12 16:27:59 by erey-bet #+# #+# */ -/* Updated: 2022/11/22 22:53:10 by erey-bet ### ########.fr */ +/* Updated: 2022/11/25 15:34:18 by erey-bet ### ########.fr */ /* */ /* ************************************************************************** */ #include "ft_printf.h" -#include static int ft_is_format(const char c) { @@ -19,7 +18,7 @@ static int ft_is_format(const char c) || c == 'u' || c == 'x' || c == 'X' || c == '%'); } -static int ft_post_character_bis(char format, va_list args) +static int ft_post_character(char format, va_list args) { int count; @@ -43,24 +42,6 @@ static int ft_post_character_bis(char format, va_list args) return (count); } -static int ft_post_character(char format, va_list args) -{ - int count; - - count = ft_post_character_bis(format, args); - if (count == -1) - { - ft_putstr("(null)"); - count = 6; - } - else if (count == -2) - { - ft_putstr("(nil)"); - count = 5; - } - return (count); -} - int ft_printf(const char *str, ...) { va_list args; diff --git a/ft_printf.h b/ft_printf.h index 5aeeb07..cb7550d 100644 --- a/ft_printf.h +++ b/ft_printf.h @@ -6,7 +6,7 @@ /* By: erey-bet +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/09/26 16:31:10 by erey-bet #+# #+# */ -/* Updated: 2022/11/21 19:31:17 by erey-bet ### ########.fr */ +/* Updated: 2022/11/25 15:34:24 by erey-bet ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,8 +14,8 @@ # define FT_PRINTF_H # include -# include # include +# include int ft_printf(const char *str, ...); void ft_putchar(char c); diff --git a/ft_putstr.c b/ft_putstr.c index de781fd..09b9e02 100644 --- a/ft_putstr.c +++ b/ft_putstr.c @@ -6,7 +6,7 @@ /* By: erey-bet +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/10/05 00:32:38 by erey-bet #+# #+# */ -/* Updated: 2022/10/15 23:15:57 by erey-bet ### ########.fr */ +/* Updated: 2022/11/25 15:30:49 by erey-bet ### ########.fr */ /* */ /* ************************************************************************** */ @@ -18,7 +18,7 @@ int ft_putstr(char *s) count = 0; if (s == NULL) - return (-1); + return (ft_putstr("(null)")); while (*s) { ft_putchar(*s); diff --git a/ft_putvd.c b/ft_putvd.c index 0faf5d3..1d40d47 100644 --- a/ft_putvd.c +++ b/ft_putvd.c @@ -6,7 +6,7 @@ /* By: erey-bet +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/10/14 23:01:21 by erey-bet #+# #+# */ -/* Updated: 2022/11/21 19:26:59 by erey-bet ### ########.fr */ +/* Updated: 2022/11/25 15:29:24 by erey-bet ### ########.fr */ /* */ /* ************************************************************************** */ @@ -18,7 +18,7 @@ int ft_putvd(void *v) unsigned long u; if (v == NULL) - return (-2); + return (ft_putstr("(nil)")); u = (unsigned long)v; count = 2; ft_putstr("0x");