-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.c
More file actions
50 lines (43 loc) · 1.38 KB
/
utils.c
File metadata and controls
50 lines (43 loc) · 1.38 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
46
47
48
49
50
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ferenc <ferenc@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/03/30 03:19:11 by elavrich #+# #+# */
/* Updated: 2025/07/23 17:09:32 by ferenc ### ########.fr */
/* */
/* ************************************************************************** */
#include "Minishell.h"
int is_meta(char c)
{
return (c == '|' || c == '<' || c == '>');
}
int is_pipe(char c)
{
return (c == '|');
}
int token_is_redir(t_token *token)
{
if (!token || !token->com)
return (0);
return (is_redir(token->com));
}
void print_list(t_token *tokens)
{
while (tokens)
{
if (tokens->com)
printf("token: %s\n", tokens->com);
tokens = tokens->next;
}
}
char *join_and_free(char *s1, char *s2)
{
char *joined;
joined = ft_strjoin(s1, s2);
free(s1);
free(s2);
return (joined);
}