-
Notifications
You must be signed in to change notification settings - Fork 0
/
2_0_init.c
34 lines (31 loc) · 1.33 KB
/
2_0_init.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* 2_0_init.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: anhigo-s <anhigo-s@student.42sp.org.br> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/03/17 00:00:31 by anhigo-s #+# #+# */
/* Updated: 2022/03/28 21:37:22 by anhigo-s ### ########.fr */
/* */
/* ************************************************************************** */
#include "philosophers.h"
t_philo init_args(char **argv)
{
t_philo data_struct;
data_struct.args.nbr_philo = ft_atoi(argv[1]);
data_struct.args.time_die = ft_atoi(argv[2]);
data_struct.args.time_eat = ft_atoi(argv[3]);
data_struct.args.time_sleep = ft_atoi(argv[4]);
data_struct.philo_alive = true;
if (argv[5])
{
data_struct.args.optional = ft_atoi(argv[5]);
return (data_struct);
}
else
{
data_struct.args.optional = 0;
return (data_struct);
}
}