blob: 2c8ee7e5336eb9354e0d48e3e62c21fe353b1ca1 (
plain)
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
46
47
48
49
50
51
52
53
54
55
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* debug_tools.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: chuhlig <chuhlig@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/24 15:34:14 by dkaiser #+# #+# */
/* Updated: 2025/01/23 15:21:11 by chuhlig ### ########.fr */
/* */
/* ************************************************************************** */
#include "debug_tools.h"
#include <stdio.h>
#include <stdarg.h>
#include "token.h"
#include <stdio.h>
void dbg(char *msg)
{
if (DEBUG)
{
ft_putstr_fd("\e[33m[DEBUG] ", 0);
ft_putstr_fd(msg, 0);
ft_putendl_fd("\e[0m", 0);
}
}
void panic(char *msg)
{
if (DEBUG)
{
ft_putstr_fd("\e[31m[PANIC] ", 1);
ft_putstr_fd(msg, 1);
ft_putendl_fd("\e[0m", 1);
}
}
void print_token_list(t_token *token_list) {
t_token *current = token_list;
while (current != NULL) {
if (current->type == STRING_TOKEN) {
printf("STRING_TOKEN: %s\n", current->content.string);
} else if (current->type == REDIR_TOKEN) {
printf("REDIR_TOKEN: %d\n", current->content.redir_type);
} else if (current->type == PIPE_TOKEN) {
printf("PIPE_TOKEN\n");
} else if (current->type == NEWLINE_TOKEN) {
printf("NEWLINE_TOKEN\n");
}
current = current->next;
}
}
|