-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.c
More file actions
43 lines (37 loc) · 1.3 KB
/
utils.c
File metadata and controls
43 lines (37 loc) · 1.3 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: almelo <almelo@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/03/29 16:56:16 by almelo #+# #+# */
/* Updated: 2023/03/31 23:51:13 by almelo ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
int is_operator(int c)
{
return (c == '|' || c == '<' || c == '>');
}
int is_metachar(int c)
{
return (ft_isspace(c) || is_operator(c));
}
int is_quote(int c)
{
return (c == '\"' || c == '\'');
}
void init_index(t_index *i)
{
i->key = 0;
i->new = 0;
i->old = 0;
i->start = 0;
}
void copy_char(char *new_content, char *content, t_index *i)
{
new_content[i->new] = content[i->old];
i->new++;
i->old++;
}