diff options
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | command_handling.c | 4 | ||||
| -rw-r--r-- | main.c | 13 | ||||
| -rw-r--r-- | push_swap.h | 4 |
4 files changed, 11 insertions, 12 deletions
@@ -5,7 +5,7 @@ LIBFT = libft CC = cc CFLAGS = -Wall -Wextra -Werror -SRC_FILES = main.c input_handling.c +SRC_FILES = main.c input_handling.c stack_utils.c command_handling.c OBJ_FILES = $(SRC_FILES:%.c=%.o) LIB_DIR = $(LIBFT) diff --git a/command_handling.c b/command_handling.c index e25f47c..b1fe85a 100644 --- a/command_handling.c +++ b/command_handling.c @@ -6,11 +6,10 @@ /* By: dkaiser <dkaiser@student.42heilbronn.de +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/04/13 14:38:47 by dkaiser #+# #+# */ -/* Updated: 2024/04/13 14:43:45 by dkaiser ### ########.fr */ +/* Updated: 2024/04/13 14:47:55 by dkaiser ### ########.fr */ /* */ /* ************************************************************************** */ -#include "libft/libft.h" #include "push_swap.h" static int add_cmd_to_queue(t_list **cmds, enum e_pscmd cmd) @@ -21,6 +20,7 @@ static int add_cmd_to_queue(t_list **cmds, enum e_pscmd cmd) ptr_cmd = malloc(sizeof(enum e_pscmd)); if (!ptr_cmd) return (1); + *ptr_cmd = cmd; new_elem = ft_lstnew(ptr_cmd); if (!new_elem) { @@ -6,11 +6,10 @@ /* By: dkaiser <dkaiser@student.42heilbronn.de +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/04/12 17:03:30 by dkaiser #+# #+# */ -/* Updated: 2024/04/12 18:55:38 by dkaiser ### ########.fr */ +/* Updated: 2024/04/13 14:52:31 by dkaiser ### ########.fr */ /* */ /* ************************************************************************** */ -#include "libft/libft.h" #include "push_swap.h" static void print_content(void *content) @@ -21,6 +20,8 @@ static void print_content(void *content) int main(int argc, char *argv[]) { t_list *stack_a; + t_list *stack_b; + t_list *pscmds; stack_a = create_stack(argc, argv); if (!stack_a) @@ -28,12 +29,10 @@ int main(int argc, char *argv[]) ft_putendl_fd("Error", 2); return 1; } + stack_b = NULL; + pscmds = NULL; - ft_lstiter(stack_a, print_content); - - // TODO: Sort stack // TODO: Optimize commands - // TODO: Print commands - + print_commands(pscmds); return 0; } diff --git a/push_swap.h b/push_swap.h index 332da4e..8cfc473 100644 --- a/push_swap.h +++ b/push_swap.h @@ -6,7 +6,7 @@ /* By: dkaiser <dkaiser@student.42heilbronn.de +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/04/12 16:59:09 by dkaiser #+# #+# */ -/* Updated: 2024/04/13 14:45:16 by dkaiser ### ########.fr */ +/* Updated: 2024/04/13 14:46:45 by dkaiser ### ########.fr */ /* */ /* ************************************************************************** */ @@ -39,6 +39,6 @@ void stack_rrotate(t_list **stack); void run_command(t_list **stack_a, t_list **stack_b, t_list **cmds, enum e_pscmd cmd); -void print_commands(t_list *cmds) +void print_commands(t_list *cmds); #endif // PUSH_SWAP_H |
