-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils5.c
47 lines (42 loc) · 1.36 KB
/
utils5.c
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utils5.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: akhalid <akhalid@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/03/01 00:11:10 by akhalid #+# #+# */
/* Updated: 2022/03/01 00:12:14 by akhalid ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
char *ft_strchr(const char *str, int c)
{
char *ptr;
char sym;
ptr = (char *)str;
sym = (char)c;
while (*ptr && !(*ptr == sym))
ptr++;
if (*ptr == sym)
return (ptr);
else
return (NULL);
}
int check_ambigous_file(t_token **tokens)
{
int i;
i = 0;
while (tokens[i])
{
if (tokens[i]->type != WRD && tokens[i]->type != PIPE
&& tokens[i]->type != HRDOC)
{
if (ft_strchr(tokens[i + 1]->val, ' '))
return (1);
i++;
}
i++;
}
return (0);
}