minishell/src/debug/print_commands.c
2025-02-25 17:54:44 +01:00

53 lines
1.7 KiB
C

/* ************************************************************************** */
/* */
/* :::::::: */
/* print_commands.c :+: :+: */
/* +:+ */
/* By: marvin <marvin@student.42.fr> +#+ */
/* +#+ */
/* Created: 2025/02/18 20:06:37 by qmennen #+# #+# */
/* Updated: 2025/02/23 12:43:35 by Quinten ######## odam.nl */
/* */
/* ************************************************************************** */
#include "minishell.h"
void print_commands(void *param)
{
t_command *command;
int i;
command = (t_command *)param;
if (!command)
return ;
printf("command: %s\n", command->command);
printf("-- Args: ");
i = 0;
while (command->args[i])
printf("%s ", command->args[i++]);
printf("\n");
printf("-- Input redirects:\n");
ft_lstiter(command->redirect_in, print_redirects);
printf("-- Output redirects:\n");
ft_lstiter(command->redirect_out, print_redirects);
}
void print_redirects(void *param)
{
t_redirect *redirect;
redirect = (t_redirect *)param;
if (!redirect)
return ;
printf(" Redirect %i value %s\n", redirect->type, redirect->value);
}
void token_print(void *param)
{
t_token *token;
token = (t_token *)param;
printf("token type %i, value %s\n", token->type, token->value);
}