38 lines
1.4 KiB
C
38 lines
1.4 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* parsing.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2023/03/08 14:59:29 by erey-bet #+# #+# */
|
|
/* Updated: 2023/03/27 16:59:25 by erey-bet ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "philo.h"
|
|
|
|
int parsing(char *argv[], t_config *conf)
|
|
{
|
|
if (ft_atoi_check(argv[1]))
|
|
{
|
|
conf->nbr_philo = ft_atoi(argv[1]);
|
|
if (ft_atoi_check(argv[2]))
|
|
{
|
|
conf->time_die = ft_atoi(argv[2]) * 1000;
|
|
if (ft_atoi_check(argv[3]))
|
|
{
|
|
conf->time_eat = ft_atoi(argv[3]) * 1000;
|
|
if (ft_atoi_check(argv[4]))
|
|
{
|
|
conf->time_sleep = ft_atoi(argv[4]) * 1000;
|
|
if (ft_atoi_check(argv[5]))
|
|
conf->must_eat = ft_atoi(argv[5]);
|
|
}
|
|
return (0);
|
|
}
|
|
}
|
|
}
|
|
return (1);
|
|
}
|