From 527ebd9aeb4c56a50335675740571028f1f86d91 Mon Sep 17 00:00:00 2001 From: Lukas Jiriste Date: Tue, 5 Mar 2024 09:41:51 +0100 Subject: [PATCH] Make errors print to stderr instead of stdout --- Libft | 2 +- src/checker.c | 7 ++++--- src/push.c | 5 +++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Libft b/Libft index 476d2fe..db179cd 160000 --- a/Libft +++ b/Libft @@ -1 +1 @@ -Subproject commit 476d2fe6a4c2b0a53e1f68d5c26e8dbbac7359e2 +Subproject commit db179cd200163de7d1cd25cc02b868edd0766cb2 diff --git a/src/checker.c b/src/checker.c index 4eda206..eff49a5 100644 --- a/src/checker.c +++ b/src/checker.c @@ -6,13 +6,14 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/01/24 10:31:06 by ljiriste #+# #+# */ -/* Updated: 2024/03/01 10:07:26 by ljiriste ### ########.fr */ +/* Updated: 2024/03/05 09:40:36 by ljiriste ### ########.fr */ /* */ /* ************************************************************************** */ #include "push_swap.h" #include "libft.h" #include +#include // STDERR_FILENO #define COMMANDS_NUM 11 @@ -92,13 +93,13 @@ int main(int argc, char **argv) if (parse(argc, argv, &s.a)) { clean_up(&s); - ft_printf("Error.\n"); + ft_dprintf(STDERR_FILENO, "Error.\n"); return (1); } if (interpret(&s)) { clean_up(&s); - ft_printf("Error.\n"); + ft_dprintf(STDERR_FILENO, "Error.\n"); return (1); } if (is_sorted(&s.a) && s.b.stack.size == 0) diff --git a/src/push.c b/src/push.c index 69f0ab5..909bffd 100644 --- a/src/push.c +++ b/src/push.c @@ -6,7 +6,7 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/01/24 13:17:32 by ljiriste #+# #+# */ -/* Updated: 2024/03/01 12:43:14 by ljiriste ### ########.fr */ +/* Updated: 2024/03/05 09:40:03 by ljiriste ### ########.fr */ /* */ /* ************************************************************************** */ @@ -18,6 +18,7 @@ #include "push_swap.h" #include "libft.h" #include +#include // STDERR_FILENO void get_push_indeces(t_stacks *s, int *ind_a, int *ind_b) { @@ -73,7 +74,7 @@ int main(int argc, char **argv) if (parse(argc, argv, &s.a)) { clean_up(&s); - ft_printf("Error.\n"); + ft_dprintf(STDERR_FILENO, "Error.\n"); return (1); } sort(&s); -- 2.30.2