From af87168372fbaa52b652c4e47d140ac53efe9d07 Mon Sep 17 00:00:00 2001 From: gbaconni Date: Fri, 15 Apr 2022 00:26:47 +0200 Subject: [PATCH] Fix for other in ft_vprintf --- Makefile | 4 +++- libftprintf/ft_vprintf.c | 6 +++--- libftprintf/ft_vprintf_other.c | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 5c0895e..d6fdeee 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ # By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2022/01/18 15:11:16 by gbaconni #+# #+# # -# Updated: 2022/04/15 00:01:26 by gbaconni ### lausanne.ch # +# Updated: 2022/04/15 00:23:05 by gbaconni ### lausanne.ch # # # # **************************************************************************** # # @@ -84,6 +84,8 @@ test: clean $(NAME) @$(PREFIX) ./$(NAME) "%d" 42 || true @$(PREFIX) ./$(NAME) "%x" 42 || true @$(PREFIX) ./$(NAME) "%X" 42 || true + @$(PREFIX) ./$(NAME) "42" "" || true + @$(PREFIX) ./$(NAME) "%%" "" || true test2: debug @$(MAKE) test DEBUG=1 diff --git a/libftprintf/ft_vprintf.c b/libftprintf/ft_vprintf.c index 3b2734d..733439b 100644 --- a/libftprintf/ft_vprintf.c +++ b/libftprintf/ft_vprintf.c @@ -6,7 +6,7 @@ /* 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 */ +/* Updated: 2022/04/15 00:25:52 by gbaconni ### lausanne.ch */ /* */ /* ************************************************************************** */ @@ -19,9 +19,9 @@ int ft_vprintf(char const *format, va_list ap) ret = 0; while (*format) { - if (*format++ == '%') + if (*format == '%') { - if (*format == '%') + if (*format++ == '%') ret += ft_vprintf_percent(format, ap); else if (*format == 'c') ret += ft_vprintf_char(format, ap); diff --git a/libftprintf/ft_vprintf_other.c b/libftprintf/ft_vprintf_other.c index 92ff2f4..20b12e2 100644 --- a/libftprintf/ft_vprintf_other.c +++ b/libftprintf/ft_vprintf_other.c @@ -6,7 +6,7 @@ /* By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/01/20 12:58:03 by gbaconni #+# #+# */ -/* Updated: 2022/04/13 08:01:05 by gbaconni ### lausanne.ch */ +/* Updated: 2022/04/15 00:23:22 by gbaconni ### lausanne.ch */ /* */ /* ************************************************************************** */