From 0b3ba4611649e85694c6fd5ed68a0362872fac6d Mon Sep 17 00:00:00 2001 From: Tanguy MAZE Date: Mon, 18 Mar 2019 17:38:27 +0100 Subject: [PATCH] actually it's not =( --- libft | 2 +- srcs/checker.c | 3 ++- srcs/ps_clean.c | 2 +- srcs/ps_sort.c | 12 +++++++++++- srcs/ps_stktools2.c | 2 +- srcs/push_swap.c | 6 +++--- 6 files changed, 19 insertions(+), 8 deletions(-) diff --git a/libft b/libft index d5eecbe..75ebffd 160000 --- a/libft +++ b/libft @@ -1 +1 @@ -Subproject commit d5eecbed888ecaa348527f7bd18302ed2f9a276b +Subproject commit 75ebffddeadd84c4330e6348e097456ccb4abe19 diff --git a/srcs/checker.c b/srcs/checker.c index e065a28..f672bf3 100644 --- a/srcs/checker.c +++ b/srcs/checker.c @@ -6,7 +6,7 @@ /* By: tmaze +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/02/23 13:35:15 by tmaze #+# #+# */ -/* Updated: 2019/03/18 12:28:54 by tmaze ### ########.fr */ +/* Updated: 2019/03/18 17:24:12 by tmaze ### ########.fr */ /* */ /* ************************************************************************** */ @@ -77,6 +77,7 @@ int read_ops(t_psdata *data) ft_bzero(tmp, 4); while ((ret = ft_getline(&buff)) > 0) { + ft_printf("checker read '%s'\n"); ft_strncpy(tmp, buff, 3); if (ft_strlen(buff) > 4 || !is_op(buff) || (nop = ft_lstnew(tmp, 4)) == NULL) diff --git a/srcs/ps_clean.c b/srcs/ps_clean.c index c2b9c26..fa00654 100644 --- a/srcs/ps_clean.c +++ b/srcs/ps_clean.c @@ -6,7 +6,7 @@ /* By: tmaze +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/03/16 13:14:52 by tmaze #+# #+# */ -/* Updated: 2019/03/16 13:29:57 by tmaze ### ########.fr */ +/* Updated: 2019/03/18 15:19:06 by tmaze ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/srcs/ps_sort.c b/srcs/ps_sort.c index 0c1efd6..8d06ef2 100644 --- a/srcs/ps_sort.c +++ b/srcs/ps_sort.c @@ -6,7 +6,7 @@ /* By: tmaze +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/03/16 13:21:02 by tmaze #+# #+# */ -/* Updated: 2019/03/16 13:27:43 by tmaze ### ########.fr */ +/* Updated: 2019/03/18 17:36:47 by tmaze ### ########.fr */ /* */ /* ************************************************************************** */ @@ -15,6 +15,8 @@ static int join_lists(t_psdata *data, t_stack **last, int inds, int inds2) { while ((*last)->ind == inds2 || data->size_b > 0) + { + ft_printf("last nb %d ind %d inds2 %d\n", (*last)->nb, (*last)->ind, inds2); if (((*last)->ind != inds2 && data->size_b > 0) || (data->size_b > 0 && data->b->nb > (*last)->nb)) { @@ -31,6 +33,7 @@ static int join_lists(t_psdata *data, t_stack **last, int inds, int inds2) data->a->ind = inds; (*last) = get_last_a(data); } + } return (1); } @@ -64,9 +67,16 @@ int sort(t_psdata *data) t_stack *last; int inds; int inds2; + t_stack *ptr; last = get_last_a(data); inds = last->ind + 1; + ptr = data->a; + while (ptr) + { + ft_printf("nb: %d ind %d\n", ptr->nb, ptr->ind); + ptr = ptr->next; + } while (data->a->ind != last->ind) { inds2 = data->a->ind; diff --git a/srcs/ps_stktools2.c b/srcs/ps_stktools2.c index 3cdfb74..4f70179 100644 --- a/srcs/ps_stktools2.c +++ b/srcs/ps_stktools2.c @@ -6,7 +6,7 @@ /* By: tmaze +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/02/25 12:44:08 by tmaze #+# #+# */ -/* Updated: 2019/03/15 15:36:06 by tmaze ### ########.fr */ +/* Updated: 2019/03/18 15:13:10 by tmaze ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/srcs/push_swap.c b/srcs/push_swap.c index 48e8c61..cbbe32d 100644 --- a/srcs/push_swap.c +++ b/srcs/push_swap.c @@ -6,7 +6,7 @@ /* By: tmaze +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/03/03 11:41:49 by tmaze #+# #+# */ -/* Updated: 2019/03/16 13:23:53 by tmaze ### ########.fr */ +/* Updated: 2019/03/18 15:18:04 by tmaze ### ########.fr */ /* */ /* ************************************************************************** */ @@ -19,7 +19,7 @@ void print_ops(t_psdata *data) it = data->op; while (it) { - ft_printf("%s\n", (char*)(it->content)); + ft_printf("%s\n", it->content); it = it->next; } } @@ -41,7 +41,7 @@ int main(int ac, char **av) { mark_groups(&data); if (sort(&data) == 0) - ft_putendl_fd("Error\n", 2); + ft_putendl_fd("Error", 2); else { clean_op(&data);