-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtools.c
More file actions
69 lines (61 loc) · 1.51 KB
/
Copy pathtools.c
File metadata and controls
69 lines (61 loc) · 1.51 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* tools.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mamali <mamali@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/11 16:47:23 by mamali #+# #+# */
/* Updated: 2021/10/16 19:10:16 by mamali ### ########.fr */
/* */
/* ************************************************************************** */
#include "philo.h"
void free_philo(t_philo **node)
{
t_philo *tmp;
while (*node)
{
tmp = *node;
*node = (*node)->next;
free(tmp);
}
}
void free_f(t_fork **node)
{
t_fork *tmp;
while (*node)
{
tmp = *node;
*node = (*node)->next;
free(tmp);
}
}
void free_function(t_fork **fork, t_data *data, t_philo **philo)
{
free_f(fork);
free(data);
free_philo(philo);
}
int handle_error(int ac, char **argv)
{
int i;
int j;
if (ac == 5 || ac == 6)
{
i = 1;
while (argv[i])
{
j = 0;
while (argv[i][j])
{
if (ft_isdigit(argv[i][j]) == 0)
return (0);
j++;
}
i++;
}
}
else
return (0);
return (1);
}