-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.c
55 lines (47 loc) · 1.34 KB
/
utils.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
48
49
50
51
52
53
54
55
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hbutt <hbutt@student.s19.be> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/09 17:14:40 by hbutt #+# #+# */
/* Updated: 2024/08/14 19:02:51 by hbutt ### ########.fr */
/* */
/* ************************************************************************** */
#include "pipex.h"
void ft_error(char *msg)
{
int len;
len = ft_strlen(msg);
write(2, msg, len);
write(2, "\n", 1);
exit(0);
}
void ft_error_2(char *msg)
{
ft_putendl_fd(msg, 2);
exit(1);
}
int ft_compare_path(char *s1, char *s2)
{
int i;
i = 0;
if (!s1)
return (1);
while (s1[i] || s2[i])
{
if (s1[i] != s2[i])
return (s1[i] - s2[i]);
i++;
}
return (0);
}
void ft_free_tab(char **tab)
{
int i;
i = -1;
while (tab[++i])
free(tab[i]);
free(tab);
}