-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.c
More file actions
73 lines (64 loc) · 1.53 KB
/
utils.c
File metadata and controls
73 lines (64 loc) · 1.53 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jklocker <jklocker@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/30 14:12:43 by jklocker #+# #+# */
/* Updated: 2023/01/30 14:12:44 by jklocker ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
int check_if_flag(char *str)
{
int i;
i = 0;
if (!str)
return (-1);
if (str[i++] != '-')
return (-1);
while (str[i])
{
if (str[i] == 'n')
i++;
else
return (-1);
}
return (0);
}
int check_for_appereance(char *str, char c)
{
int i;
i = 0;
while (str[i])
{
if (str[i] == c)
return (0);
i++;
}
return (1);
}
int check_equality(char *str1, char *str2)
{
int i;
i = 0;
if (ft_strlen(str1) != ft_strlen(str2))
return (-1);
while (str1[i])
{
if (str1[i] == str2[i])
i++;
else
return (-1);
}
return (0);
}
int arg_c(t_node *node)
{
int i;
i = 0;
while (node->full_cmd[i])
i++;
return (i);
}