-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpush_command.c
More file actions
45 lines (40 loc) · 1.35 KB
/
Copy pathpush_command.c
File metadata and controls
45 lines (40 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* push_command.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tbui-quo <tbui-quo@student.42wolfsburg.d> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/09/22 20:17:33 by tbui-quo #+# #+# */
/* Updated: 2023/09/22 20:17:33 by tbui-quo ### ########.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
void push(t_stack **dest, t_stack **src)
{
t_stack *node_to_push;
if (*src == NULL)
return ;
node_to_push = *src;
*src = (*src)->next;
if (*dest == NULL)
{
*dest = node_to_push;
node_to_push->next = NULL;
}
else
{
node_to_push->next = *dest;
*dest = node_to_push;
}
}
void pa(t_stack **a, t_stack **b)
{
push(a, b);
ft_putstr_fd("pa\n", STDOUT_FILENO);
}
void pb(t_stack **b, t_stack **a)
{
push(b, a);
ft_putstr_fd("pb\n", STDOUT_FILENO);
}